I am a noob in Mathematica. I am trying to solve a Quantum Mechanical problem of particle in a one-dimensional box. The program was written for Mathematica 6. But, I ran it in Mathematica 14. The expected output in second to fifth output was like below:
Out[45]= 14.0353
Out[46]= 55.7956
Out[47]= 124.253
Out[48]= 217.721
Out[49]= 333.898
But instead, it shows this:
Out[45]= -4621.58
Out[46]= -1231.51
Out[47]= -869.209
Out[48]= -504.838
Out[49]= -385.284
See below.
What could be causing this? And how to solve the issue?
I would do as much of the calculation in exact arithmetic as possible:
a = 20*10^-9;
h = a/20;
m = Rationalize[0.067*9.1]*10^-31;
hcutsq = ((Rationalize[6.626]*10^-34)/(2*Pi))^2;
This way the numbers turn out quite different. I have no idea if they are still weird.
Sorry, there was a mistake in the question. The expected output in second to fifth output is below:
Out[45]= 14.0353
Out[46]= 55.7956
Out[47]= 124.253
Out[48]= 217.721
Out[49]= 333.898
But instead, it shows this:
Out[45]= -4621.58
Out[46]= -1231.51
Out[47]= -869.209
Out[48]= -504.838
Out[49]= -385.284
Here is a way:
{E1, E2, E3, E4, E5} = X/(16/10*10^-22) /. B[[1 ;; 5]];
TableForm[{{E1, E2, E3, E4, E5},
{E1, E2, E3, E4, E5} // N,
{E1exact, E2exact, E3exact, E4exact, E5exact}} //
Transpose,
TableHeadings -> {None,
{"E symbolic", "E numeric", "Exact"}}]
Turns out the issue is a version issue. The program shows a different output in Mathematica 14 than in Mathematica 6. How to solve this?
How to run programs written for Mathematica 6 in Mathematica 14? Some programs show a different output than expected in Mathematica 14. For example, look at the attached notebook
The program gives this output below the matrix in Mathematica 6:
14.0353
55.7956
124.253
217.721
333.898
14.0642
56.2568
126.578
225.027
351.605
But in Mathematica 14, the ouput below the matrix is:
-4621.58
-1231.51
-869.209
-504.838
-385.284
14.0642
56.2568
126.578
225.027
351.605
How can I get the same output as Mathematica 6 in Mathematica 14? What settings should I change? Is there any compatibility setting available?
2024-02-21T00_32_45Particle in a Box.nb (15 KB)
The equation Det[A] == 0 is of degree 19 with inexact coefficients. Maybe it is a numerical instability issue. If I try
HornerForm[Det[A]] /. Solve[Det[A] == 0]
in version 14 I get numbers as high as -473. What happens in version 6?