From: Mario Fatafehi on
how can i solve the 5*x^3 +10*x^2-7*x+1=0.I can't find any example similar to this problem. Any help?
From: us on
"Mario Fatafehi" <coruba9(a)hotmail.com> wrote in message <hop790$nm$1(a)fred.mathworks.com>...
> how can i solve the 5*x^3 +10*x^2-7*x+1=0.I can't find any example similar to this problem. Any help?

a hint:

help sym;
help solve;

us
From: Mario Fatafehi on
"us " <us(a)neurol.unizh.ch> wrote in message <hopclf$lo7$1(a)fred.mathworks.com>...
> "Mario Fatafehi" <coruba9(a)hotmail.com> wrote in message <hop790$nm$1(a)fred.mathworks.com>...
> > how can i solve the 5*x^3 +10*x^2-7*x+1=0.I can't find any example similar to this problem. Any help?
>
> a hint:
>
> help sym;
> help solve;
>
> us

[x]=solve('5*x^3 +10*x^2-7*x+1=0') gives me very strange result. help?

x =

1/30*(-23300+60*i*2355^(1/2))^(1/3)+82/3/(-23300+60*i*2355^(1/2))^(1/3)-2/3
-1/60*(-23300+60*i*2355^(1/2))^(1/3)-41/3/(-23300+60*i*2355^(1/2))^(1/3)-2/3+1/2*i*3^(1/2)*(1/30*(-23300+60*i*2355^(1/2))^(1/3)-82/3/(-23300+60*i*2355^(1/2))^(1/3))
-1/60*(-23300+60*i*2355^(1/2))^(1/3)-41/3/(-23300+60*i*2355^(1/2))^(1/3)-2/3-1/2*i*3^(1/2)*(1/30*(-23300+60*i*2355^(1/2))^(1/3)-82/3/(-23300+60*i*2355^(1/2))^(1/3))
From: us on
"Mario Fatafehi" <coruba9(a)hotmail.com> wrote in message <hophkt$497$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message <hopclf$lo7$1(a)fred.mathworks.com>...
> > "Mario Fatafehi" <coruba9(a)hotmail.com> wrote in message <hop790$nm$1(a)fred.mathworks.com>...
> > > how can i solve the 5*x^3 +10*x^2-7*x+1=0.I can't find any example similar to this problem. Any help?
> >
> > a hint:
> >
> > help sym;
> > help solve;
> >
> > us
>
> [x]=solve('5*x^3 +10*x^2-7*x+1=0') gives me very strange result. help?
>
> x =
>
> 1/30*(-23300+60*i*2355^(1/2))^(1/3)+82/3/(-23300+60*i*2355^(1/2))^(1/3)-2/3
> -1/60*(-23300+60*i*2355^(1/2))^(1/3)-41/3/(-23300+60*i*2355^(1/2))^(1/3)-2/3+1/2*i*3^(1/2)*(1/30*(-23300+60*i*2355^(1/2))^(1/3)-82/3/(-23300+60*i*2355^(1/2))^(1/3))
> -1/60*(-23300+60*i*2355^(1/2))^(1/3)-41/3/(-23300+60*i*2355^(1/2))^(1/3)-2/3-1/2*i*3^(1/2)*(1/30*(-23300+60*i*2355^(1/2))^(1/3)-82/3/(-23300+60*i*2355^(1/2))^(1/3))

well... the beauty of sym math...

one of the solutions

r=solve('5*x^3 +10*x^2-7*x+1=0');
r=double(r)
%{
% r =

0.35553 +1.4013e-045i
-2.5741 -7.0065e-046i
0.21854 -7.0065e-046i
%}

us
From: Steven Lord on

"Mario Fatafehi" <coruba9(a)hotmail.com> wrote in message
news:hop790$nm$1(a)fred.mathworks.com...
> how can i solve the 5*x^3 +10*x^2-7*x+1=0.I can't find any example similar
> to this problem. Any help?
>

For this particular example, there's no need to use symbolic computations.
Just use ROOTS.

P = [5 10 -7 1];
x = roots(P)
polyval(P, x)

If your expression were more complicated, but still a function of one
variable, and numerically solving it was acceptable you could use FZERO. If
you need a symbolic solution, use SOLVE as us has stated.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ