# Why doesn't Mathematica solve this equation? [closed]

I am trying to use Solve in Mathematica to get the $$x$$ and $$U$$ parameters here but the solution doesn't come out. The program continues running forever. Any ideas? Wolfram Alpha solves the problem easily.

Program: Variables first and then I use Solve.

P = 0.5;
theta = 74*Pi/180;
muL1 = -30;
muL2 = -200;
eps = -800;
time = 2.418884326505*^-17;
Hartree = 27211.4;
h = (1*^9)*2*time*Hartree*Pi;

NSolve[x*P*Cos[theta]*Log[(muL1 - eps - U)^2/(muL1 - eps)^2] == 2*Pi*h*(15.883 - 14.9265) &&
x*P*Cos[theta]*Log[(muL2 - eps - U)^2/(muL2 - eps)^2] == 2*Pi*h*(15.883 - 14.6216), {x, U}]

• Use NSolve[{eq1,eq2},{x,U},Reals] then it solves it. !Mathematica graphics Wolfram Alpha solves the problem easily Wolfram Alpha uses A.I. so may be it tried this on its own. Hard to know. Dec 5, 2023 at 5:38
• Thank you! I did not know Wolfram alpha uses A.I.... Dec 5, 2023 at 9:22
• @Nasser To be clear, W|A is built on GOFAI. Dec 5, 2023 at 13:53

One approach is by @Nasser in the comments. Another one is to use Rationalize

Coefficients

P = 0.5;
theta = 74*Pi/180;
muL1 = -30;
muL2 = -200;
eps = -800;
time = 2.418884326505*^-17;
Hartree = 27211.4;
h = (1*^9)*2*time*Hartree*Pi;


Equations

eq1 = x*P*Cos[theta]*Log[(muL1 - eps - U)^2/(muL1 - eps)^2] ==
2*Pi*h*(15.883 - 14.9265) // Rationalize[#, 0] &;
eq2 = x*P*Cos[theta]*Log[(muL2 - eps - U)^2/(muL2 - eps)^2] ==
2*Pi*h*(15.883 - 14.6216) // Rationalize[#, 0] &;


Solve instead of NSolve

Solve[{eq1, eq2}, {x, U}, Reals]


you get your solutions like that as well.

Note that using Reals is also pivotal here.

• Thank you so much! Dec 5, 2023 at 9:20