# Revision history [back]

### How solve() works?

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)


$\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)


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

Why do I have to do that?

### How Unexpected solve() works?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)


$\hspace{1in} x = \frac{1}{2} \sqrt{x^{2} + 25}$
print ((ans.solve(x)[0]*2)^2).solve(x)

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