Unusual solution []

For a project that included calculating bond lengths from spectroscopic data, I used Solve[]to solve a fairly simple equation for the unknown. When I changed the input, I began to notice "unusual" behavior. In particular, when I changed the number and Solve'd, the result is the answer earlier. However, executing the code again gives the correct answer; this is like a delay in one execution. Here is an example:

B = (11.09 + del)*2.998*10^10;

c = h*1000*n*10^20/(8 \[Pi]^2);

h = 6.62618*10^-34;

n = 6.02204*10^23;

del = 0;

Solve[c/B == 0.97959253 R^2, R]

Execution gives

{{R -> -1.24567}, {R -> 1.24567}}

However, when I change del = 0to del = 10in the above block, I get the same answer when I execute! When I execute the block a second time, I get the correct answer:

{{R -> -0.903299}, {R -> 0.903299}}

Then, changing del = 10to del = 0, and execution gives:

{{R -> -0.903299}, {R -> 0.903299}}

, ,

{{R -> -1.24567}, {R -> 1.24567}}

0 10, 2 . Solve[] ...

, (MacBook Intel) - Solve. , , , , , , , ? ( Mathematica , ).

+3
2

, del , del. del . 2 : del :

del = 0;
B = (11.09 + del)*2.998*10^10;
c = h*1000*n*10^20/(8 Pi^2);
h = 6.62618*10^-34;
n = 6.02204*10^23;
Solve[c/B == 0.97959253 R^2, R]

SetDelayed (:=) :

B := (11.09 + del)*2.998*10^10;
c := h*1000*n*10^20/(8 Pi^2);
h = 6.62618*10^-34;
n = 6.02204*10^23;
del = 0;
Solve[c/B == 0.97959253 R^2, R]
+7

, PJR

Clear["Global`*"]  

. del B. ^ _ ^

+1

All Articles