"Armen" wrote in message <iv2j00$oks$1@newscl01ah.mathworks.com>...
> Hey everybody:
>
> I'm relatively new to matlab, so I'm sure my question has a straightforward solution. I have a very complex quartic equation whose coefficients are defined by other functions and set equal to defined variables. I'm trying to use the solve function, but (understandably) when I cast this expression it does not reference the previouslydefined variables. I was wondering how I would get solve to recognize them  perhaps cast them using syms?
>
> Here's the code:
>
> S = solve('x^4*(u^2  d*n^2) + x^3*(2*u*v  e*n^2  2*d*m*n) + x^2*(v^2 + 2*u*w  f*n^2  d*m^2  2*e*m*n) + x*(2*v*w  2*f*m*n  e*m^2) + (w^2  f*m^2)');
>
> where:
>
> g = (Rac * (b/Rab)  cx)/cy;
> h = (c^2  Rac^2 + Rac * Rab * (1(b/Rab)^2))/(2*cy);
> d = (1  (b/Rab)^2 + g^2);
> e = b*(1  (b/Rab)^2)  2*g*h;
> f = (Rab^2/4) * (1  (b/Rab)^2)^2  h^2;
> u = (beta^2 + d*sz^2)/(4*a^2)  (1 + g^2 + d);
> v = (alpha*beta + e*sz^2)/(4*a^2)  (2*qx + 2*qy +e +2*g*h);
> w = (alpha^2 + 4*f*sz^2)/(16*a^2)  (Qm^2 + 2*h*qy + h^2 + f);
> m = sz*alpha/(4*a^2) + 2*qz;
> n = sz*beta/(2*a^2);
>
> and all other variables defined in the above expressions are user defined.
>
> Thanks for your help.
>
> am
           
You are apparently trying to obtain a solution as a single expression (or rather four expressions) in terms of your original variables, Ras, b, cx, cy, etc. I would strongly advise against that. It would be such a bewildering maze of complexity as to be totally useless in my opinion. Why not be content with just the code you have with g, h, d, e, etc., combined with the expressions for the five coefficients of the quartic and then simply use matlab's 'roots' function to get the quartic's four roots? You can consider that as an efficient recipe for finding these roots.
If your polynomial had one additional degree making it a quintic, such an undertaking would be impossible in terms of elementary algebraic functions, as has been proven. The quartic does have a known general solution but it is messy.
In any case I don't think you will be able to persuade the 'solve' function to provide the specific roots to your quartic even directly in terms of its five coefficients. If you can, it would outdo my own 'solve', which stubbornly refuses to divulge even the roots of a quadratic equation.
Roger Stafford
