Ask Your Question

# Unexpected solve() result

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)*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 close merge delete

## 1 Answer

Sort by » oldest newest most voted

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.

more

## Your Answer

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

Add Answer

## Stats

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

Seen: 209 times

Last updated: Feb 21 '11