Ask Your Question
2

Unexpected solve() result

asked 2011-02-20 09:35:47 +0100

trk gravatar image

updated 2011-02-20 09:36:48 +0100

Hi,

Let

$\hspace{1in} f(x) = -\frac{1}{2} x + \sqrt{x^{2} + 25} + 4 $

I would like to find the first derivative of f(x) and then the value of x when $f'(x)=0 $.

This is what I did:

f(x)=(x^2+25)^(1/2)+(1/2)*(8-x)
ans=f(x).diff(x)==0
print ans.solve(x)

But that gives the answer:

$\hspace{1in} x = \frac{1}{2} \sqrt{x^{2} + 25} $

I had to change the last line to:

print ((ans.solve(x)[0]*2)^2).solve(x)

To give the correct answer:

$ \hspace{1in} x = -\frac{5}{3}\sqrt{3}, x = \frac{5}{3}\sqrt{3} $

Why do I have to do that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2011-02-21 11:24:45 +0100

kcrisman gravatar image

Try

sage: ans.solve(x,to_poly_solve=True)
[x == 5/3*sqrt(3)]

Another reminder to make sure that the global solve? has the same information about this option as the local x.solve?. Though in this case,

sage: ans.solve?

would give you information about this option.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-02-20 09:35:47 +0100

Seen: 451 times

Last updated: Feb 21 '11