Solve non-linear equations system parametrically, Why are the answers empty?

5 views (last 30 days)
Arash Pourkazemi on 26 Feb 2021
Commented: Walter Roberson on 28 Feb 2021
clear all;
clc;
syms X1 X2 X3 X4 X5 X6 X7 X8 X9 h k1 Lz1 k21 Lz2 k32 Lz3 a1 a2 a3 b1 b2 b3 w1 w2 w3 r1 r2 r3;
e0 = X1-1 == 0;
e1 = h*X1-k1*X7*X4==0;
e2 = X1*cos(X7*Lz1)+X4*sin(X7*Lz1)-X2==0;
e3 = -X1*X6*sin(X7*Lz1)+X4*X6*cos(X7*Lz1)-X8*X5*k21==0;
e4 = X2*cos(X8*Lz2)+X5*sin(X8*Lz2)-X3==0;
e5 = -X2*X8*sin(X8*Lz2)+X5*X8*cos(X8*Lz2)-X9*X6*k32==0;
e6 = X3*cos(X9*Lz3)+X6*sin(X9*Lz3)==0;
e7 = (a1/a2)*(b1^2+r1^2+X7^2+w1^2)-b2^2-r2^2-w2^2-X8^2 ==0;
e8 = (a1/a3)*(b1^2+r1^2+X7^2+w1^2)-b3^2-r3^2-w3^2-X9^2 ==0;
sol = solve([e0,e1,e2,e3,e4,e5,e6,e7,e8],[X1 X2 X3 X4 X5 X6 X7 X8 X9]);
X1: [0×1 sym]
X2: [0×1 sym]
X3: [0×1 sym]
X4: [0×1 sym]
X5: [0×1 sym]
X6: [0×1 sym]
X7: [0×1 sym]
X8: [0×1 sym]
X9: [0×1 sym]
Arash Pourkazemi on 27 Feb 2021
No, there are no conditions or restrictions
Only X1 = 1 is assumed

darova on 26 Feb 2021
You didn't assign values to these variables
% h k1 Lz1 k21 Lz2 k32 Lz3 a1 a2 a3 b1 b2 b3 w1 w2 w3 r1 r2 r3;
Arash Pourkazemi on 28 Feb 2021
Dear @darova
thank you so much

Walter Roberson on 27 Feb 2021
There are four solution sets, that look something like
[X1 == 1,
X2 == (cos(Lz1*h*sin(RootOf(Lz1^2*cos(Z)^2*h^2+cos(Z)^2*Z^2*k1^2-Lz1^2*h^2))/cos(RootOf(Lz1^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3*h^2*k1^2*w3^2-RootOf(Lz1^2*cos(Z)^2*h^2+cos(Z)^2*Z^2*k1^2-Lz1^2*h^2)^2*a1*h^2*k1^2)/cos(RootOf(Lz1^2*cos(Z)^2*h^2+cos(Z)^2*Z^2*k1^2-Lz1^2*h^2))/k1]
Here, RootOf() an expression in Z indicates the set of values for Z such that the expression becomes 0 -- the roots of the equation.
However, the RootOf are nested here and it gets confusing as to which Z refers to which level.
These RootOf are of nonlinear equations, such as RootOf(Lz1^2*cos(Z)^2*h^2 + cos(Z)^2*Z^2*k1^2 - Lz1^2*h^2), which contains a constant*Z^2*cos(Z) sub-expression. You are not likely to find closed-form expressions for them.
In my tests in Maple, the first seven expressions could be solved for the first 7 variables, giving a family of four solutions. You could then do substitutions of family members one at a time into the remaining two equations, solve, and back-substitute to complete the family member. You probably cannot do the same thing in MATLAB, as MATLAB tends to just give up if it discovers it needs to take the root of a nonlinear expression.

Mahsa Babaee on 28 Feb 2021
Edited: Mahsa Babaee on 28 Feb 2021
I am trying to solve exactly the same problem and I faced similar difficulties. I galad to have your contanct info for more exchanges.
Walter Roberson on 28 Feb 2021
syms X1 X2 X3 X4 X5 X6 X7 X8 X9 a1 a2 a3 b1 b2 b3 h k1 k21 k32 Lz1 Lz2 Lz3 w1 w2 w3 r1 r2 r3;
e0 = X1-1 == 0;
e1 = h*X1-k1*X7*X4==0;
e2 = X1*cos(X7*Lz1)+X4*sin(X7*Lz1)-X2==0;
e3 = -X1*X6*sin(X7*Lz1)+X4*X6*cos(X7*Lz1)-X8*X5*k21==0;
e4 = X2*cos(X8*Lz2)+X5*sin(X8*Lz2)-X3==0;
e5 = -X2*X8*sin(X8*Lz2)+X5*X8*cos(X8*Lz2)-X9*X6*k32==0;
e6 = X3*cos(X9*Lz3)+X6*sin(X9*Lz3)==0;
e7 = (a1/a2)*(b1^2+r1^2+X7^2+w1^2)-b2^2-r2^2-w2^2-X8^2 ==0;
e8 = (a1/a3)*(b1^2+r1^2+X7^2+w1^2)-b3^2-r3^2-w3^2-X9^2 ==0;
sol027 = solve([e0, e2, e7], [X1, X7, X8])
sol027 = struct with fields:
X1: [4×1 sym] X7: [4×1 sym] X8: [4×1 sym]
sol027.X1
ans =
sol027.X7
ans =
sol027.X8
ans =
eqn2a = (subs([e1; e3; e4; e5; e6; e8], [X1, X7, X8], [sol027.X1(1), sol027.X7(1), sol027.X8(1)]))
eqn2a =
sol027a1 = solve(eqn2a(1:4),[X2,X3,X5,X9],'returnconditions', true)
sol027a1 = struct with fields:
X2: [1×1 sym] X3: [1×1 sym] X5: [1×1 sym] X9: [1×1 sym] parameters: [1×0 sym] conditions: [1×1 sym]
sol027a1.X2
ans =
sol027a1.X5
ans =
sol027a1.X9
ans =
simplify(sol027a1.conditions)
ans =
eqn3a = subs(eqn2a(5:end), [X2, X5, X9], [sol027a1.X2, sol027a1.X5, sol027a1.X9])
eqn3a =
sol3a_4 = solve(eqn3a(1), X4)
Warning: Unable to find explicit solution. For options, see help.
sol3a_4 = Empty sym: 0-by-1
sol3a_6 = solve(eqn3a(1), X6)
Warning: Unable to find explicit solution. For options, see help.
sol3a_6 = Empty sym: 0-by-1
You can play around with the order to see if you can get one more variable solved for, but you are unlikely to get all variables solved for.
Also, in the step forming eqn2a you could choose 2nd, 3rd, or 4th solutions to the previous equations, as that could certainly make a difference in whether you can solve.