solve non linear equations symbolically

I have 4 variables & 3 non linear equations. Objective is to get 4th non linear equations expressed in 2 variables.
Variables are
a b M phi
Equations are
x/sqrt(x^2+y^2) = -1 + 1/M * cos(phi)
y/sqrt(x^2+y^2) = 1/M * sin(phi)
arg(diff((x- jy)/sqrt(x^2+y^2)),a) = pi/2 - phi
where,
x = cos(a) - a*b*sin(a) - 1
y = a*b*cos(a) + sin(a)
Objective: Express variable 'b' in terms of 'M'

5 Comments

Please check the below.
syms a b M phi x(a) y(a)
x(a) = cos(a) - a*b*sin(a) - 1;
y(a) = a*b*cos(a) + sin(a);
temp = diff((x(a)- j*y(a))/sqrt(x(a)^2+y(a)^2), a);
eqn = [x(a)/sqrt(x(a)^2+y(a)^2) == -1 + 1/M * cos(phi), y(a)/sqrt(x(a)^2+y(a)^2) == 1/M * sin(phi), angle(temp) == pi/2 - phi];
Your notation was ambiguous about whether you meant to take the derivative with respect to a, and take the two-quadrant arg() of that, compared to whether you meant to take the derivative without specifying the variable to take the derivative with respect to, and then to take the four-quadrant arg() with a being the second component.
If you meant to take the four-quadrant arg() then please confirm which of the two expressions is intended to be the "x" and which is intended to be the "y"; the MuPAD order https://www.mathworks.com/help/symbolic/mupad_ref/arg.html is the reverse of the MATLAB order https://www.mathworks.com/help/matlab/ref/atan2.html
Please also confirm whether your x and y are functions of only a, or if they are functions of a and phi
Thank you, Walter.
I meant to take derivative with respect to 'a' & two quadrant arg() of that. Also x and y are functions of a only.
Fortunately the above happens to already fit that intention.
You can
solve(eqn,a,b,phi)
as you have three equations in four unknowns this would force a, b, and phi to be expressed in terms of M. Unfortunately it will report that no explicit solution can be found.
Can we constrain a, b, phi, M to real-valued? If though you use imaginary components in the expression?
Yes a, b, phi, M are real valued.

Sign in to comment.

 Accepted Answer

My investigations indicate that if there are symbolic solutions at all, then they are impractical to reach.
It is practical to solve the first two equations to get b and phi, leaving the third equation in terms of a and M . However, solving the resulting third equation (after substitution) for a is not practical (if it is possible at all.)
I have had a symbolic session running for the last hour just trying to evaluate that third equation at a = -Pi/5
My investigations show that there are an infinite number of matching real-valued a values for any M value for which there is a real-valued solution at all -- the arg() makes the solution either periodic or quasi-periodic (that is, same shape but possibly the distance changes.)
There do not happen to be any real-valued solutions for positive a . If you rewrite the equation from the form arg(X)=Y to be the expression arg(X)-Y and look for the zeros, then for a number of positive a values, there are both positive and negative values (depending on M), but there are no 0s because the positive values are discontinuous from the negative values.
There are solutions for some negative a values. There is an area near 0 in negative a where the above-mentioned expression has both positive and negative values but is discontinuous. By a = -Pi/4 there are real-valued solutions in M. My attempt to evaluate at a = -Pi/5 was probing to see where the discontinuity boundary is, more precisely. Guess I should have used floating point...
If you consider M values instead of a values, then there is a range of M values on both sides of 0 for which there are no real-valued solutions. I have not yet characterized how far that range extends.

4 Comments

The lower boundary on positive M is between 0.73971 and 0.73972 at which point the upper boundary on a has crept as high as slightly less negative than -Pi/32 . As M increases, the greatest a moves more negative.
If symbolic solutions are impractical, then I might not have stated this problem properly. It's because this problem has already been solved, I was just redoing it. Take a look at problem & it's solution https://www.dropbox.com/s/3sv4hs5z5jn3mfr/xyz.pdf?dl=0
Notice:
"Non-linear Eq. (40) can be solved easily by Newton iterative method when Ms is given between 1.2 and 2.0 with step value of 0.05 respectively."
Newton iterative method is a numeric method, not a symbolic method.
I tried to solve the problem using Newton iterative method, but inverse of Jacobian matrix fails. I wrote the following code
clc
clear all
syms a b phi
syms x(a) y(a)
x(a) = cos(a) - a*b*sin(a) - 1;
y(a) = a*b*cos(a) + sin(a);
temp = diff((x(a)- j*y(a))/sqrt(x(a)^2+y(a)^2), a);
f1 = x(a)/sqrt(x(a)^2+y(a)^2) + 1 - 1/1.2 * cos(phi);
f2 = y(a)/sqrt(x(a)^2+y(a)^2) - 1/1.2 * sin(phi);
f3 = angle(temp) - pi/2 + phi;
F = [f1; f2; f3]
J = jacobian(F)
% assume initial value a = 1, b = 3, phi = pi/4
Ja = subs(J,a,1);
Jb = subs(Ja,b,3);
Jc = subs(Jb,phi,pi/4);
invJ = inv(Jc)
Inverse of Jacobian Matrix failed here.

Sign in to comment.

More Answers (1)

Juan Ponce
Juan Ponce on 25 Aug 2017
Edited: Walter Roberson on 25 Aug 2017
Hi Dhiraj R,
I obtain the following solutions, only with b and phi as variables.
% Variables Modelo
syms a b phi real
% a:Variable asociada a w*l ()
% b:Variable asociada a n2/l ()
% phi:Posicion angular (rad)
% n2:Constante de tiempo del filtro (s)
% Parametros Simbolicos
syms M real
% M:Sensitividad maxima Ms ()
% Ecuaciones auxiliares
x=cos(a)-a*b*sin(a)-1;
y=a*b*cos(a)+sin(a);
L=(x-j*y)/(x^2+y^2)^(1/2);
% Calculo Derivada Parcial
dL=diff(L,a);
% Calculo Argumento o Angulo
arg=atan(dL);
% Construccion Ecuaciones
% Nodos o Mallas, Fuerzas, Torques, Conservacion Energias
eq1=x/(x^2+y^2)^(1/2)-(-1+1/M*cos(phi)); % x/(x^2+y^2)^(1/2)=-1+1/M*cos(phi)
eq2=y/(x^2+y^2)^(1/2)-(1/M*sin(phi)); %y/(x^2+y^2)^(1/2)=1/M*sin(phi)
eq3=arg-(pi/2-phi); %arg=pi/2-phi
%%%%%%%%%%%%%%%%
F =
1 - (a*b*sin(a) - cos(a) + 1)/((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(1/2) - cos(phi)/M
(sin(a) + a*b*cos(a))/((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(1/2) - sin(phi)/M
phi - pi/2 - atan((sin(a) + i*cos(a) + b*sin(a) + a*b*cos(a) + b*i*cos(a) - a*b*i*sin(a))/((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(1/2) - ((2*(sin(a) + a*b*cos(a))*(cos(a) + b*cos(a) - a*b*sin(a)) + 2*(a*b*sin(a) - cos(a) + 1)*(sin(a) + b*sin(a) + a*b*cos(a)))*(i*sin(a) - cos(a) + a*b*sin(a) + a*b*i*cos(a) + 1))/(2*((sin(a) + a*b*cos(a))^2 + (a*b*sin(a) - cos(a) + 1)^2)^(3/2)))
X =
b
phi
mxd_nuevo =
[ -(2*sin(a - 4*pi*k) + 2*sin(a + 4*pi*k) + 4*sin(a) + 8*cos(2*pi*k)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 4*cos(2*pi*k - a)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) + 2*cos(2*pi*k - 2*a)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 2*cos(2*a - 2*pi*k)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) + cos(a)*(8*M*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) + 8*M^2*sin(a)) - 4*cos(a + 2*pi*k)*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 8*M*(2*M*cos(2*pi*k) - cos(2*k*pi)^2)^(1/2) - 8*M*sin(a - 2*pi*k) - 8*M*sin(a + 2*pi*k))/(a*cos(4*pi*k - 2*a) - a*cos(2*a - 4*pi*k) + 8*a*cos(2*pi*k)^2 - 16*M*a*cos(2*pi*k) + 8*M^2*a*cos(a)^2 - 4*M*a*cos(2*pi*k - 2*a) + 4*M*a*cos(2*a - 2*pi*k)), pi - acos(M*(sin(a) - 1))]
[ (sin(a - 4*pi*k) + sin(a + 4*pi*k) - sin(2*pi*k)*(4*(2*sin(a/2)^2 - 1)*(M^2 - sin(2*k*pi)^2)^(1/2) + 4*(M^2 - sin(2*k*pi)^2)^(1/2)) - sin(a)*(4*M^2*(2*sin(a/2)^2 - 1) + 2))/(4*a*(sin(a)^2 - 1)*M^2 + 4*a + 4*a*(sin(2*pi*k)^2 - 1)), pi - acos(M*(sin(a) - 1))]
Note: Each row of mxd_nuevo representa a solution bi,phi (i=1,2)
I dont know if this is right.
Good luck!!
Juan Ponce

Community Treasure Hunt

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

Start Hunting!