0
$\begingroup$
ψn[n_, x_] := x SphericalBesselJ[n, x]
dψn[n_, x_] := ψn[n - 1, x] - n ψn[n, x]/x
Nn[n_, x_] := x SphericalBesselY[n, x]
dNn[n_, x_] := Nn[n - 1, x] - n Nn[n, x]/x
f[m_, n_, x_] := m ψn[n, m x] dNn[n, x] - Nn[n, x] dψn[n, m x]

enter image description here

There is a root of f[Sqrt[9.8], 24, x] between 9.61677463456185765 and 9.61677463456185768. The Plot function can't give the right picture with a correct x region. What's the problem? How can I find it and how to Plot f in this interval?

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Mar 19 '15 at 7:25
  • $\begingroup$ I think the tag 'findroot' should be removed since the question is solely about plotting. $\endgroup$ – Taiki Mar 19 '15 at 10:53
1
$\begingroup$

You would probably need to ask Mathematica to treat your numbers as arbitrary-precision numbers by tagging the number of digits you'd like Mathematica to keep track of at the end of your numbers like this:

9.61677463456185765`20

This produces a plot:

Plot[
  f[Sqrt[9.8], 24, x] 10^8,
  {x, 9.61677463456185765`20, 9.61677463456185768`20}
]

In drawing the figure, the two endpoints of the $x$-axis will be treated as the same number if your $MachinePrecision is not enough. (This is probably because Mathematica uses machine-precision numbers for the plot range.)

You may want to try ListPlot instead:

ListPlot[
  Table[
    f[Sqrt[9.8], 24, x] 10^8,
    {x, 9.61677463456185765`20, 9.61677463456185768`20, 0.000000000000000001`20}
  ],
  Joined -> True,
  PlotRange -> All
]

and modify the tick numbers with the option Ticks as appropriate (if DataRange doesn't work).

Note that 9.8 is a machine-precision number. You may want to think about whether that's what you want. Your f gives a different result when the number is inputted as 98/10—an exact number (i.e. Precision[98/10] is Infinity).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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