In[]:=
$Version
Out[]=
15.0.1 for Mac OS X ARM (64-bit) (July 2, 2026)
Throughout this notebook we use the function from the package, ensured by a fresh kernel. At first we compute the best minimax approximation to the square root function on [0,1] by a polynomial of degree 5. Since we want to minimize the absolute error we have to use GeneralMiniMaxApproximation. So the square root function can be defined explicitly or implicitly. Both variants work quite well. They give identical solutions showing the characterizing Chebyshev alternant of the error.
In[]:=
Needs["FunctionApproximations`"]​​sqrexP=GeneralMiniMaxApproximation[{t,Sqrt[t],1},{t,{0,1},5,0},t]​​sqrimP=GeneralMiniMaxApproximation[{t^2,t,1},{t,{0,1},5,0},t]
Out[]=
{{0.,0.0142025,0.131525,0.375967,0.671397,0.909262,1.},{0.0278451+4.75365t-20.6463
2
t
+47.7753
3
t
-49.5921
4
t
+18.7094
5
t
,-0.0278451}}
Out[]=
{{0.,0.119174,0.362664,0.613161,0.819388,0.953552,1.},{0.0278451+4.75365t-20.6463
2
t
+47.7753
3
t
-49.5921
4
t
+18.7094
5
t
,-0.0278451}}
In[]:=
Plot[{Sqrt[t]-sqrexP[[2,1]],sqrexP[[2,2]],-sqrexP[[2,2]]},{t,0,1}]​​Plot[{Sqrt[t]-sqrimP[[2,1]],sqrimP[[2,2]],-sqrimP[[2,2]]},{t,0,1}]
Out[]=
Out[]=
Now we compute the minimax approximation to the celebrated Runge function on [0,5] by a linear polynomial. The result is wrong, as the error function reveals.
In[]:=
runge[t_]=1/(1+t^2);​​ruP=GeneralMiniMaxApproximation[{t,runge[t],1},{t,{0,5},1,0},t]​​Plot[{runge[t]-ruP[[2,1]],-ruP[[2,2]],ruP[[2,2]]},{t,0,5}]
Out[]=
{{0.,1.83552,5.},{0.790931-0.192308t,0.209069}}
Out[]=
The correct polynomial is (up to the shown precision)
In[]:=
ruc[t_]=0.7974355-0.1942119t;
with the error
In[]:=
ec=MaxValue[{Abs[runge[t]-ruc[t]],0≤t≤5},t]​​Plot[{runge[t]-ruc[t],-ec,ec},{t,0,5}]
Out[]=
0.212086
Out[]=
Minimax approximation by polynomials of degree 2 and 3 fails.
In[]:=
GeneralMiniMaxApproximation[{t,runge[t],1},{t,{0,5},#1,0},t]&/@{2,3}
MiniMaxApproximation
::extalt
:The extrema of the error do not alternate in sign. It may be that MiniMaxApproximation has lost track of the extrema by going too fast. If so try increasing the values in the option Brake. It may be that the WorkingPrecision is insufficient. Otherwise there is an extra extreme value of the error, and MiniMaxApproximation cannot deal with this problem.
​
MiniMaxApproximation
::extalt
:The extrema of the error do not alternate in sign. It may be that MiniMaxApproximation has lost track of the extrema by going too fast. If so try increasing the values in the option Brake. It may be that the WorkingPrecision is insufficient. Otherwise there is an extra extreme value of the error, and MiniMaxApproximation cannot deal with this problem.
​
Out[]=
{{{0.,1.26814,3.63466,5.},1.07648-0.553342t+0.0711682
2
t
,{-0.0764835,-0.105811,0.0649082,-0.05052}},{{0.,0.465678,2.52584,4.24416,5.},1.11311-0.818665t+0.217219
2
t
-0.0194054
3
t
,{-0.113111,0.0447673,0.0170886,-0.0151807,0.0138713}}}
In[]:=
GeneralMiniMaxApproximation[{t,runge[t],1},{t,{0,5},#1,0},t,Brake->{12,10}]&/@{2,3}
MiniMaxApproximation
::extalt
:The extrema of the error do not alternate in sign. It may be that MiniMaxApproximation has lost track of the extrema by going too fast. If so try increasing the values in the option Brake. It may be that the WorkingPrecision is insufficient. Otherwise there is an extra extreme value of the error, and MiniMaxApproximation cannot deal with this problem.
​
MiniMaxApproximation
::extalt
:The extrema of the error do not alternate in sign. It may be that MiniMaxApproximation has lost track of the extrema by going too fast. If so try increasing the values in the option Brake. It may be that the WorkingPrecision is insufficient. Otherwise there is an extra extreme value of the error, and MiniMaxApproximation cannot deal with this problem.
​
Out[]=
{{{0.,1.26814,3.63466,5.},1.07648-0.553342t+0.0711682
2
t
,{-0.0764835,-0.105811,0.0649082,-0.05052}},{{0.,0.465678,2.52584,4.24416,5.},1.11311-0.818665t+0.217219
2
t
-0.0194054
3
t
,{-0.113111,0.0447673,0.0170886,-0.0151807,0.0138713}}}
Surprisingly, degrees 4 and 5 are okay.
In[]:=
ru45P=GeneralMiniMaxApproximation[{t,runge[t],1},{t,{0,5},#1,0},t]&/@{4,5}
Out[]=
{{{0.,0.317373,1.16578,2.66237,4.29528,5.},{1.03755-0.521307t-0.0268552
2
t
+0.0506225
3
t
-0.00653845
4
t
,-0.0375467}},{{0.,0.28771,0.985806,2.09825,3.45539,4.57095,5.},{1.02155-0.318552t-0.417692
2
t
+0.30002
3
t
-0.0691805
4
t
+0.00537884
5
t
,-0.0215477}}}
In[]:=
Plot[{runge[t]-ru45P[[2,2,1]],ru45P[[2,2,2]],-ru45P[[2,2,2]]},{t,0,5}]
Out[]=
Or not so surprising? There seem to be problems if the interval boundaries do not belong to the extrema of the error of the best minimax approximation. Let’s try to find out. As we see, the first and last abscissa of the alternant are pinned at the interval boundaries.
In[]:=
ru1P=GeneralMiniMaxApproximation[{t,runge[t],1},{t,{0,5},1,0},t,Bias->-0.2,PrintFlag->True,PlotFlag->True]​​Plot[{runge[t]-ru1P[[2,1]],-ru1P[[2,2]],ru1P[[2,2]]},{t,0,5}]
{0.177172}
{0.0262981}
{0.000812651}
{7.51349×
-7
10
}
{6.41556×
-13
10
}
{{0.,0.0859678},{1.74629,-0.295168},{5.,0.189321}}
{0.0113536}
{{0.,0.11517},{1.76635,-0.27461},{5.,0.193915}}
{0.013291}
{{0.,0.148609},{1.79014,-0.251175},{5.,0.199231}}
{0.0135807}
{{0.,0.182134},{1.81479,-0.22779},{5.,0.204633}}
{0.00934309}
{{0.,0.20456},{1.8319,-0.212202},{5.,0.208309}}
{0.00196815}
{{0.,0.209068},{1.83552,-0.209069},{5.,0.209068}}
{4.67632×
-6
10
}
Out[]=
{{0.,1.83552,5.},{0.790931-0.192308t,0.209069}}
Out[]=
See also runge_minimax _Resource _ 2026. nb