-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdilogRemezApprox.m
35 lines (25 loc) · 897 Bytes
/
dilogRemezApprox.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(*
Approximation of PolyLog[2,x]/x by a rational function using Remez
algorithm on the interval [0, 1/2).
*)
Needs["FunctionApproximations`"];
(* maximum number of terms in Li2 series,
so that [0,0.5]^nMax << machine precision *)
nMax = 200;
(* claculation precision *)
prec = 100;
(* output precision *)
outPrec = 20;
(* series for PolyLog[2,x]/x *)
Li2x[x_, n_:nMax] := Sum[x^(i-1)/i^2, {i,1,n}];
{abscissa, {appox, maxErr}} =
MiniMaxApproximation[Li2x[x], {x, {0,1/2}, 7, 7},
WorkingPrecision -> prec,
MaxIterations -> 1000];
FormatCoeffs[expr_, x_, prec_] :=
NumberForm[#, prec]& /@ CoefficientList[expr, x]
Print["Numerator coefficients: ",
FormatCoeffs[#,x,outPrec]& @ Numerator[appox]];
Print["Denominator coefficients: ",
FormatCoeffs[#,x,outPrec]& @ Denominator[appox]];
Print["max error: ", InputForm @ maxErr];