0
$\begingroup$

What value Px2[16, 4] or N[Px22[16, 4]] is correct?

ClearAll["Global`*"]
y = 5;
Psi[r_, n_] = (2 E^(-(r/n)) Sqrt[n!/(-1 + n)!] Hypergeometric1F1[
      1 - n, 2, (2 r)/n])/n^2;

VB2[r_] := Exp[-r*N[(154419325000 Sqrt[25034/57057])/68663001981]];
VB22[r_] := Exp[-r*(154419325000 Sqrt[25034/57057])/68663001981];

Px2[n1_, n2_] := 
  Integrate[Psi[r, n2]*VB2[r]*Psi[r, n1]*r^2, {r, 0, \[Infinity]}];
Px22[n1_, n2_] := 
  Integrate[Psi[r, n2]*VB22[r]*Psi[r, n1]*r^2, {r, 0, \[Infinity]}];

In[742]:= Px2[16, 4]

Out[742]= 0.000266864

In[743]:= N[Px22[16, 4]]

During evaluation of In[743]:= General::munfl: 1/2.25932*10^16^21 is too small to represent as a normalized machine number; precision may be lost.

Out[743]= 0.

$\endgroup$
2
  • $\begingroup$ Try: VB2[r_] := Exp[-r*N[(154419325000 Sqrt[25034/57057])/68663001981, 20]]; and N[Px22[16, 4], 20] ? $\endgroup$ Jan 29, 2023 at 12:49
  • $\begingroup$ Read "Machine-Precision Numbers" from tutorial/Numbers#31699 in the help. Calculations with Machine numbers are fast but not exact. $\endgroup$ Jan 29, 2023 at 13:26

1 Answer 1

3
$\begingroup$

The results are the same and you can prove it.

With

y = 5;
Psi[r_, n_] = (2 E^(-(r/n)) Sqrt[n!/(-1 + n)!] Hypergeometric1F1[
      1 - n, 2, (2 r)/n])/n^2;
VB2[r_] := Exp[-r*N[(154419325000 Sqrt[25034/57057])/68663001981]];
VB22[r_] := Exp[-r*(154419325000 Sqrt[25034/57057])/68663001981];

Then, we consider the two integrals. Note the use of Rationalize

Px2[n1_, n2_] := 
  Integrate[
   Rationalize[Psi[r, n2]*VB2[r]*Psi[r, n1]*r^2, 0], {r, 0, Infinity}];
Px22[n1_, n2_] := 
  Integrate[
   Rationalize[Psi[r, n2]*VB22[r]*Psi[r, n1]*r^2, 0], {r, 0, 
    Infinity}];

Now, you can check their ratio

Px2[16, 4]/Px22[16, 4] // N

1.

If you want to be more precise about the statement

Px2[16, 4]/Px22[16, 4] // N[#, 100] &

0.99999999999999997884679787110503763789829242808078911831345030580990\ 159960929487143929995821867831721

$\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.