5
$\begingroup$

How can I output all zero-point data by graphing?

f[x_] := Hypergeometric1F1[
   1 + (-2 (2 - 2 Sqrt[2 x]) - 4 Sqrt[2 x])/(4 Sqrt[2 (-x)]), 2, 
   10 Sqrt[2 (-x)] ];
Plot[Re[f[x]], {x, 0, 10}]

For example, in Hypergeometric1F1 above, by means of graphing we can check the correctness of the number of zeros found.

A preliminary test was performed by finding roots using a Chebyshev interpolation approximation function proposed by @Michael E2 (Roots of Whittaker W function), but still some roots were found to be missing by means of image comparison.

The following roots are solved using this method in the range 0 to 10:

{1.0532206155051356002759022212, 2.3823251868867552411190096851,
4.1175783163878905360582608336, 6.2547713021241303166777811106, 
8.7917386732691205358036514888}

We can see by the image that there is obviously another root between 3.9 and 4, and similar situation exists in other positions. Is there any good way to solve this problem? Or is there a way to output the information about the zero point through the image?

$\endgroup$
1
  • 1
    $\begingroup$ f[x_] = Hypergeometric1F1[ 1 + (-2 (2 - 2 Sqrt[2 x]) - 4 Sqrt[2 x])/(4 Sqrt[2 (-x)]), 2, 10 Sqrt[2 (-x)]]; Plot[Re[f[x]], {x, 0, 10}, Mesh -> {{0}}, MeshFunctions -> {#2 &}, MeshStyle -> Red, Method -> {"AxesInFront" -> False}] $\endgroup$
    – cvgmt
    Commented Apr 12, 2022 at 9:01

2 Answers 2

7
$\begingroup$
f[x_] = Hypergeometric1F1[    1 + (-2 (2 - 2 Sqrt[2 x]) - 4 Sqrt[2 x])/(4 Sqrt[2 (-x)]), 2,     10 Sqrt[2 (-x)]];
plot=Plot[Re[f[x]], {x, 0, 10}, Mesh -> {{0}}, MeshFunctions -> {#2 &},   MeshStyle -> Red, Method -> {"AxesInFront" -> False}];
list = Cases[plot, Point[a_] :> a, Infinity][[1]];
pts = Cases[plot, GraphicsComplex[p__] :> p, Infinity][[1]][[list]];
roots=Sort@pts[[;; , 1]]

enter image description here enter image description here

$\endgroup$
4
  • $\begingroup$ Just now, I used Re to process the result is not accurate enough, if I use Abs to process the plot to find the zero point, does the program need to be improved? For example, f[x_] = Abs[ Hypergeometric1F1[ 1 + (-2 (2 - 2 Sqrt[2 x]) - 4 Sqrt[2 x])/(4 Sqrt[2 (-x)]), 2, 10 Sqrt[2 (-x)]]]; $\endgroup$
    – Vancheers
    Commented Apr 12, 2022 at 11:33
  • 1
    $\begingroup$ @lucky Yes,this method can not work if the curves does not crossing the x-axis. I think we can use both Im and Re or ReIm instead of Abs will make this ease to handle. $\endgroup$
    – cvgmt
    Commented Apr 12, 2022 at 12:32
  • $\begingroup$ After testing there is one more question I would like to ask you, I use different ranges to observe the roots, if I use a small range of 0-10, the data is accurate, but if I extend the range to 0-2000, some data will be missing. Consider that we are using plotting. But the reasons for this situation and its solution are not considered clearly. $\endgroup$
    – Vancheers
    Commented Apr 14, 2022 at 9:25
  • 1
    $\begingroup$ @lucky We can add PlotPoints->100,MaxRecursion->4 etc. $\endgroup$
    – cvgmt
    Commented Apr 14, 2022 at 9:33
5
$\begingroup$

You might analyse the plot using Graphics`Mesh`FindIntersections

pic = Plot[{Re[f[x]], 0}, {x, 0, 10}]    
np = Graphics`Mesh`FindIntersections[pic[[All, 1]]]; 

(*{{0.0493613, 8.13152*10^-20}, {0.141112, 0.}, {0.444084,4.33681*10^-19}, 
{1.05335,0.}, {1.23352, -3.48029*10^-17}, {2.38238, 0.}, 
{2.41799,2.98407*10^-15},{3.99724,0.}, {4.11752, -5.96311*10^-17}, {5.97122,0.}, 
{6.25477,2.32556*10^-15}, {8.34004, 0.}, {8.79169, -6.58382*10^-17}}*)

Show[{pic, Graphics[{Red, Point[np]}]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.