Asking Questions
Asking Questions

Reputation: 667

Why can mathematica not solve my equation?

I can not get my head around why mathematica can not solve this equation:

In[22]:= Solve[1/x^12 - 2/x^6 + 1/2 (-2 + x)^2 HeavisideTheta[-2 + x] == 0]
During evaluation of In[22]:= Solve::nsmet: This system cannot be solved with the methods available to Solve. >>
Out[22]= Solve[1/x^12 - 2/x^6 + 1/2 (-2 + x)^2 HeavisideTheta[-2 + x] == 0]

using mathematica 9.0.1.0.

Edit:

In[24]:= Plot[1/x^12 - 2/x^6 + 1/2 (-2 + x)^2 HeavisideTheta[-2 + x], {x, 1, 3}]

plot

Upvotes: 1

Views: 464

Answers (2)

agentp
agentp

Reputation: 6999

If you want to look for analytic solutions ( which is what Solve does ), assume the step function has a value 0 or 1 , use Solve and check the step function assumption against the results:

 Select[ Solve[1/x^12 - 2/x^6 + 1/2 (-2 + x)^2  (0) == 0]  ,  
     HeavisideTheta[-2 + x /. #] == 0 & ]

{{x -> -(1/2^(1/6))}, {x -> 1/2^(1/6)}}

 Select[ Solve[1/x^12 - 2/x^6 + 1/2 (-2 + x)^2  (1) == 0]  ,  
     HeavisideTheta[-2 + x /. #] == 1 & ]

{{x -> Root[2 - 4 #1^6 + 4 #1^12 - 4 #1^13 + #1^14 &, 2]}}

Of the three solutions, the one I guess you want is the last one , the root of a 14th order polynomial, which you need to eval numerically anyway:

 N[Root[2 - 4 #1^6 + 4 #1^12 - 4 #1^13 + #1^14 &, 2] ]

2.18999

Upvotes: 2

Bill
Bill

Reputation: 3977

FindRoot is often more aggressive

FindRoot[1/x^12-2/x^6+1/2(-2+x)^2 HeavisideTheta[-2+x]==0, {x, 3}]

and that almost instantly returns the solution.

Upvotes: 2

Related Questions