views:

792

answers:

2

I have quadratic equation 1/x = 1/(a-x) + 1/(3*a -x)

I want to solve it in matlab:

solve('1/x=1/(a-x)+1/(3*a-x)', 'x')
ans =
 (4/3+1/3*7^(1/2))*a
 (4/3-1/3*7^(1/2))*a

Is there any way to solve equation with float coefficient? Like

ans = 
  2.215250437021530*a
  0.451416229645136*a
A: 

Apparently, double(ans) should convert it for you.

lc
But I get only error message:>> double(ans)??? Error using ==> sym.double at 25DOUBLE cannot convert the input expression into a double array.If the input expression contains a symbolic variable, use the VPA function instead.
iyo
What happens if you use the function VPA(ans)?
Ian Hopkinson
vpa(ans) is what I need. Thanks a lot for your answer
iyo
A: 

I used eval() to get a double result from a symbolic expression

digital illusion

related questions