how to solve equations ?

1 回表示 (過去 30 日間)
AYAH
AYAH 2012 年 12 月 25 日
hello everybody,
I have two equations with (d1,d2,L,x) variables and I want to find x in terms of (d1,d2,L) variables .I used "solve" function to do this but it gave me x in term of (d1,d2,L,z) where I have not used "z" variable in my equations, and I can't understand what is this.
This is what I did:
syms x d1 d2 l;
y1=((d2 + x)^2 - 2*l^2 + (d1 - x)^2)/(2*l*(d1 + x)^2*(d2 + x)) + ((d1^2 + 2*x*d1 + l^2)^2*(d2^2 + 2*x*d2 + l^2)^2)/(16*l^4*(d1 + x)^2*(d2 + x)^2);%y1=0
y2=((d1^2 + 2*x*d1 + l^2)^2/(4*l^2*(d1 + x)^2) - 1)*((d2^2 + 2*x*d2 + l^2)^2/(4*l^2*(d2 + x)^2) - 1); %y2=0
final_equation=y1-y2;
x=solve(final_equation,x)
any help in this regard will be appreciated
  2 件のコメント
Walter Roberson
Walter Roberson 2012 年 12 月 25 日
Please read the guide to tags and retag this question. see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
AYAH
AYAH 2012 年 12 月 25 日
yes it appear within a RootOf()

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 12 月 25 日
The solution for that is a quartic. There are analytic solutions, but they are very long to write out. MATLAB shows the short form of them by returning a RootOf() placeholder. RootOf(f(z),z) means "the values of z such that f(z) returns 0".
You can tell solve() to give you the complete analytic solution using the maximum degree option, but beware that it runs to numerous pages and is basically incomprehensible.
  2 件のコメント
AYAH
AYAH 2012 年 12 月 26 日
編集済み: Walter Roberson 2012 年 12 月 26 日
I have tried maximum degree option but I got an error:
??? Error using ==> solve>getEqns at 202
' 4 ' is not a valid expression or equation.
this was my code:
syms x d1 d2 l;
y1=((d2 + x)^2 - 2*l^2 + (d1 - x)^2)/(2*l*(d1 + x)^2*(d2 + x)) + ((d1^2 + 2*x*d1 + l^2)^2*(d2^2 + 2*x*d2 + l^2)^2)/(16*l^4*(d1 + x)^2*(d2 + x)^2);%y1=0
y2=((d1^2 + 2*x*d1 + l^2)^2/(4*l^2*(d1 + x)^2) - 1)*((d2^2 + 2*x*d2 + l^2)^2/(4*l^2*(d2 + x)^2) - 1); %y2=0
final_equation=y1-y2;
S=solve(final_equation,x,'MaxDegree',4);
pretty(S)
Walter Roberson
Walter Roberson 2012 年 12 月 26 日
Odd. Which MATLAB version are you using?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFunctional Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by