How can I increase precision up to 15 digits for the results (EC, and that of FindRoot) computed below?

n = 0; a = 1; L = 3; m = 1/2; b = 1; g = (2 m a r)/(n + L + 1);

f[r_] = AiryAi[(2 m b)^(1/3) (r)];

Fi[r_] = (r)^(L + 1) Exp[-((  m a)/(n + L + 1)) r] LaguerreL[n, 2 L + 1, g] ;

ψ[r_] = Fi[r] f[r];

r0 = 2.64768253582 ;

EC = -((m a^2)/(2 (n + L + 1)^2)) + (a/(L + 1) - (L + 1)/(m r0)) f'[r0]/f[r0]
(* -> 4.72675 *)

Hψ = -ψ''[r]/(2 m) + (-(a/r) + b r + (L (L + 1))/(2 m r^2)) ψ[r];

FindRoot[(EC) ψ[r] == Hψ, {r, 2}]
(* -> {r -> 2.64768} *)

I urge you not to use the answer you have been given, because it adds spurious precision (hence incorrect digits) to the result, which will be more obvious if you attempt to use a higher precision.

The result you have is already precise (albeit not necessarily accurate) up to 15 digits; it's just that the front end won't display all of the digits by default, for the sake of brevity.

To see all of the digits in the front end, you can use:

SetOptions[$FrontEndSession, PrintPrecision -> Ceiling[$MachinePrecision]]

(this can also be set in the front end preferences dialog).

Ceiling[$MachinePrecision] is 16, which reflects the fact that the true precision is closer to 16 than to 15 (decimal) digits. ($MachinePrecision is 15.954589770191.) Of course, this means that you cannot completely rely on the 16th digit, as it is only "mostly" correct. If you only want to see the fully precise digits rather than all of them, you can use Floor[$MachinePrecision] instead.

On the other hand, to calculate a genuinely higher-precision result, rather than to see the whole solution at machine precision, you need to do the following.


r0 = 2.64768253582;


r0 = 2.64768253582`100;

(where e.g. 100 is the precision sought), and change

FindRoot[(EC) \[Psi][r] == H\[Psi], {r, 2}]


FindRoot[(EC) \[Psi][r] == H\[Psi], {r, 2}, WorkingPrecision -> 100]

Changing the precision of r0 is required because the precision of the output cannot be greater than that of the lowest-precision input. (All of your other inputs are exact.) You will get a result with 100 digits. Because of Mathematica's precision tracking, you can also inquire as to how many of these digits are correct:

Precision[EC] (* -> 99.86508894274837 *)
Precision[r /. <result of FindRoot>] (* -> 100. *)

As you can see, almost all of them for EC, and exactly all for r.


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.