Simplification of an equation using MATLAB

1 view (last 30 days)
Bhagat
Bhagat on 1 Mar 2011
y=((2/9)*(1-(x.*y)).*(2-(1-x.*y).^3).*(1+(2./(1-x.*y).^3)))./((3-2.*(1-x.*y).^3).*(1-x)) ----eqn1
x=2./(1+w) ----eqn2
x & y are matrices which vary with w.
I want to simplify the equation 1 to get y in terms of x or in terms w by using equation 2 also. How to proceed in MATLAB ?

Answers (1)

Walter Roberson
Walter Roberson on 1 Mar 2011
syms x y w
eqn1 = ((2/9)*(1-(x.*y)).*(2-(1-x.*y).^3).*(1+(2./(1-x.*y).^3)))./((3-2.*(1-x.*y).^3).*(1-x)) - y;
eqn2 = 2./(1+w) - x;
s1 = solve(eqn1,y);
s2 = solve(eqn2,x);
ysoln = subs(s1,x,s2);
However, equation #1 is a 6th order polynomial that does not factor, and so the only general algebraic information available for the combined equations is that they are singular if w=-1 .
There happens to be algebraic solutions for y when w=1, but not when w=0 or w=2. There are no real solutions at all for w=0, but there are 2 real solutions for w=2.
  2 Comments
Bhagat
Bhagat on 1 Mar 2011
Getting the following errors:
??? Error using ==> solve at 162
Unable to find closed form solution.
Error in ==> sym.solve at 49
[varargout{1:max(1,nargout)}] = solve(S{:});
Error in ==> nwc at 4
s1 = solve(eqn1,y);
??? Error using ==> solve at 162
Unable to find closed form solution.
Error in ==> sym.solve at 49
[varargout{1:max(1,nargout)}] = solve(S{:});
Error in ==> nwc at 4
s1 = solve(eqn1,y);
Walter Roberson
Walter Roberson on 1 Mar 2011
Then you are not able to do it algebraically in your version of Matlab.
For numeric solutions, you can give w *one* specific value (not a vector!) and use
ysoln = (w+1) * roots([576*w-448, -1440*w + 1056, 1440*w - 960, -612*w + 292, 72*w + 48, 9*w - 33, 6])

Sign in to comment.

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!