MATLAB Answers


Algebraic simultaneous equations using symbolic toolbox

Asked by b
on 10 Nov 2015
Latest activity Commented on by b
on 10 Nov 2015
I am trying to use the symbolic toolbox of MATLAB to solve the following systems of equations. Given the following 3 equations w+x+y+z=k1; (w^2)+(x^2)+(y^2)+(z^2)=k2; w*x*y*z=k3; where (k1,k2,k3) are constants and (w,x,y,z) are variables. The objective is to obtan p and q in terms of each other only where p=w+z; q=(w*z)-(x*y); That is, all the w,x,y,z should get eliminated in the (p,q) equations to get a single function f(p,q,k1,k2,k3). I am using the code in the following manner:
syms w x y z p q
eqn1 = w+x+y+z==k1;
eqn2 = w*x*y*z==k2;
eqn3 = (w^2)+(x^2)+(y^2)+(z^2)==k3;
eqn4 = w+z-p==0;
eqn5 = (w*z)-(x*y)-q==0;
But the output is for w,x etc instead of one equation in terms of variables (p,q) and the constants (k1,k2,k3). How to achieve this single function equation?

  1 Comment

sorry, the last line of code is solve(eqn1,eqn2,eqn3,eqn4,eqn5)

Sign in to comment.

0 Answers