1
|
2467 Views
|
3 Replies
|
5 Total Likes
View groups...
Share
GROUPS:

# Problem or bug with MeijerG function (sharp jump)?

Posted 10 years ago
 Hi, I run into the MeijerG function with the specific case ListLinePlot[{Table[{x, 0.31830988618379064* MeijerG[{{0, 1/2}, {}} , {{0, 1/2}, {-1/2}} , x*x]}, {x, -24, 0, 1}]}, PlotRange -> All] However, the curve is not continuous. Can anybody help to give some hints about the problem?
3 Replies
Sort By:
Posted 10 years ago
 You have encountered the limitations of using machine precision calculations in the internal numerical algorithms for MeijerG. Though I am not sure why you are using ListLinePlot, here is an example using Plot with its WorkingPrecision option set to a higher non-MachinePrecision value. Also note that I changed your floating point value to an exact number so that the floating point value would not conflict with the higher precision computations specified by the WorkingPrecision option. Plot[27235615/85563208 MeijerG[{{0, 1/2}, {}}, {{0, 1/2}, {-(1/2)}}, x^2], {x, -24, 0}, PlotRange -> All, WorkingPrecision -> 50] However, the behavior of where the "cliff" discontinuity appears in the function is a bit odd and depends on what the value of the WorkingPrecision option is. So it appears not to be a branch cut crossing, but it is unclear what is happening in the internal algorithm that is causing it to truncate and return a value of 0 to the left of the WorkingPrecision-dependent discontinuity.Take a look at the following to see how the discontinuity is depending on the value of WorkingPrecision : Manipulate[ Plot[27235615/85563208 MeijerG[{{0, 1/2}, {}}, {{0, 1/2}, {-(1/2)}}, x^2], {x, -30, 0}, PlotRange -> All, WorkingPrecision -> wp], {wp, 30, 200}, ContinuousAction -> False] Here are two screenshots of this manipulate at different values of the WorkingPrecision slider: and Posted 10 years ago
 I think this needs a special-functions expert. The function does go to zero abruptly and stay there. In:= MeijerG[{{0,1/2},{}},{{0,1/2},{-1/2}},x*x] /. {{x->-5.9},{x->-6},{x->-6.1},{x->-6.2},{x->-6.3},{x->-6.4}} //N Out= {0.490874,0.392699,1.5708,0.,0.,0.} In:= qq = 0.3183098861837906400000000000000000000000000; In:=Plot[{qq*MeijerG[{{0, 1/2}, {}}, {{0, 1/2}, {-1/2}}, x*x]}, {x, -24, 0} , PlotRange -> All, WorkingPrecision -> 25] Posted 10 years ago
 A developer I asked said this cliff comes from cancellations while summing the series. His suggestions were higher Working Precision (which David showed nicely) and using a simpler-function version of the expression.  In:= fsfe=FullSimplify[ FunctionExpand[ MeijerG[{{0,1/2},{}},{{0,1/2},{-1/2}},x*x] ], {x<0} ] Out= ( Pi (-1+E^x^2 (1+Erf[x] )))/x In:= qq = Rationalize[0.318309886183790640, 0]; In:= Plot[ qq * fsfe, {x,-24,0}, PlotRange->All, WorkingPrecision->20, AxesOrigin->{0,0}] Here, the WorkingPrecision->20 eliminated one artifact in the curve. The original code can be modified simply. Note the N[.. ,20] around the MeijerG call. That was enough extra precision to prevent cancellations at larger x's. In:= ListLinePlot[{ Table[{x, qq* N[MeijerG[{{0, 1/2}, {}} , {{0, 1/2}, {-1/2}} , x*x], 20] }, {x, -24, 0, 1}] }, PlotRange -> All] 