Mathematica Asked on April 3, 2021
Suppose we have the following equation to solve (with respect to $x$):
$$
frac{momega^2x^2}{2} + frac{malpha x^3}{3} = E,quadtext{where }m,omega,alpha,E>0text{ and } E < frac{momega^6}{6alpha^2}.
$$
Now, theoretically speaking, along with these constraints, we should have derived 3 real roots for this equation. But when I tried to actually solve it on Mathematica, whether I had added these constraints in the Assumptions
field, it kept giving me the complex roots. What am I supposed to do to let Mathematica derive the desired real roots? Any of your help will be greatly appreciated! 🙂
(An applied mathematician's take, too long for a comment.)
In problems like these it helps to do scaling (also called non-dimensionalisation) to reduce the number of parameters.
Dividing through by the maximum energy $m omega^6 / (6 alpha^2)$, we have $$ frac{3 alpha^2 x^2}{omega^4} + frac{2 alpha^3 x^3}{omega^6} = hat{E} tag{1} $$ where $$ hat{E} = left. E middle/ frac{m omega^6}{6 alpha^2} right. $$ is the dimensionsless energy. Inspecting $(1)$, we see that it is sensible to define the dimensionless position $$ hat{x} = frac{alpha x}{omega^2}, $$ so that the problem reduces to $$ 3 hat{x}^2 + 2 hat{x}^3 = hat{E}, qquad 0 < hat{E} < 1. $$
After this simplification, Mathematica is able to return a result with radicals, even without specifying any assumptions. Note that we have casus irreducibilis; all three roots are real, but a pair of them can only be expressed in terms of radicals using complex numbers.
Solve[3 xHat^2 + 2 xHat^3 == eHat, xHat]
$$ small left{left{hat{x}to frac{1}{2} left(sqrt[3]{2 sqrt{hat{E}^2-hat{E}}+2 hat{E}-1}+frac{1}{sqrt[3]{2 sqrt{hat{E}^2-hat{E}}+2 hat{E}-1}}-1right)right},left{hat{x}to -frac{1}{4} left(1-i sqrt{3}right) sqrt[3]{2 sqrt{hat{E}^2-hat{E}}+2 hat{E}-1}-frac{1+i sqrt{3}}{4 sqrt[3]{2 sqrt{hat{E}^2-hat{E}}+2 hat{E}-1}}-frac{1}{2}right},left{hat{x}to -frac{1}{4} left(1+i sqrt{3}right) sqrt[3]{2 sqrt{hat{E}^2-hat{E}}+2 hat{E}-1}-frac{1-i sqrt{3}}{4 sqrt[3]{2 sqrt{hat{E}^2-hat{E}}+2 hat{E}-1}}-frac{1}{2}right}right} $$
Also of note is that the three roots lie in the interval $-3/2 < hat{x} < 1/2$:
Manipulate[
Plot[{3 xHat^2 + 2 xHat^3, eHat}, {xHat, -3/2, 1/2}]
, {{eHat, 1/2}, 0, 1}
]
Correct answer by yawnoc on April 3, 2021
A cubic equation has exactly 3 roots. There are not 3 real and 3 complex roots! Could it be, that there is a misunderstanding in the interpretation of what MMA gives you? If you use Solve
and apply the restrictions of the solution, you will get real numbers (note that the may have multiplicity >1). Let's make an example:
sol = Solve[(m*ω^2*x^2)/2 + (m*α*x^3)/3 == e &&
m > 0 && ω > 0 && α > 0 && e > 0 &&
e < (m*ω^6)/(6 α^2), x, Reals]
This gives the following result:
{{x -> ConditionalExpression[
Root[-6 e + 3 m ω^2 #1^2 + 2 m α #1^3 &, 1],
e > 0 &&
m > (6 e α^2)/ω^6 && α > 0 && ω >
0]}, {x ->
ConditionalExpression[
Root[-6 e + 3 m ω^2 #1^2 + 2 m α #1^3 &, 2],
e > 0 &&
m > (6 e α^2)/ω^6 && α > 0 && ω >
0]}, {x ->
ConditionalExpression[
Root[-6 e + 3 m ω^2 #1^2 + 2 m α #1^3 &, 3],
e > 0 &&
m > (6 e α^2)/ω^6 && α > 0 && ω >
0]}}
Could it be that you are not happy with Root
objects and call them "complex"? Well, a root object simply means a root of the given polynomial. You may always evaluate roots to approximate machine numbers by using N
.
We now choose some numerical values, taking care of the conditions. E.g.:
sol /. {m -> 7, α -> 1, ω -> 1, e -> 1} // N
*{{x -> -1.2047}, {x -> -0.762103}, {x -> 0.466801}}*)
You see, we get 3 real solutions for x.
Answered by Daniel Huber on April 3, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP