'Solve' 2 equations simultaneously symbolically; one is a 6th order polynomial, answer in the form of z
1 view (last 30 days)
Show older comments
Anika Tabassum Sarkar
on 2 Jun 2020
Commented: Walter Roberson
on 11 Aug 2020
Hello,
I am working on solving two equations simultaneously using the 'solve' command with the 'ReturnConditions'. One equation is a 6th order and another a 4th order polynomial. I am also using the 'MaxDegree' command but still the answer comes out in the form of z. Following are my code:
syms alpha1 alpha2 sigma1 sigma2 mu1 mu2 w1 w2 omega eps f2
syms a1 a2 positive
eqn1=(-3*a1*(sigma1+sigma2)).^2+(mu1.*a1).^2-(1/(8*w1)*alpha1*a2.^3).^2==0;
eqn2=(mu2.*a2).^2+(-a2.*sigma1).^2-(1/(2*w2)*f2).^2==0;
s1=(omega-w2)./eps;
s2=(w2-1/3*w1)./eps;
eq1=subs(eqn1,[sigma1, sigma2],[s1, s2]);
eq2=subs(eqn2,[sigma1, sigma2],[s1, s2]);
sol=solve([eq1,eq2],[a1,a2],'MaxDegree',3,'ReturnConditions',true);
a1_sol=sol.a1;
a2_sol=sol.a2;
For sol.a1, there's 9 symbolic solution, among them 3 are just 'x'. Could anyone be able to explain what this 'x' is ? One of the answers of a1_sol also yields the following z term,
-(alpha1*eps*z^3*(eps^2*mu1^2 + 9*omega^2 - 6*omega*w1 + w1^2)^(1/2))/(8*(eps^2*mu1^2*w1 + 9*omega^2*w1 - 6*omega*w1^2 + w1^3))
I was hoping if anyone can suggest an approach to resolve this issue. I really appreciate the help.
Anika
0 Comments
Accepted Answer
Surya Talluri
on 11 Aug 2020
I understand that you are getting solution of a1, a2 in terms of x, y, z.
If there are infinitely many solutions for an equation, the solve returns the solution in terms of parameters. You can find parameters by below command.
sol.parameters
ans =
[x, y, z]
You can refer to following documentation for further understanding on parametric equations - https://www.mathworks.com/help/symbolic/examples/solve-equations-in-returnconditions-mode.html
1 Comment
Walter Roberson
on 11 Aug 2020
At first this did not seem to me to be the correct response, but after some working with the equations, I realized that it is correct.
What is going on is that there are combinations of values for your variables such that both expressions become zero. In such cases, any values of a1 and a2 are acceptable as long as they satisfy the "positive" constraint you put in.
So 5 of the results you are getting are listing combinations of variables such that your equations become 0, leading to all positive a1 a2 becoming solutions.
The other four solutions are more meaningful solutions.
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox 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!