Solving symbolic system of equations returns conditions that exactly match equations

11 views (last 30 days)
I am attempting to symbolically solve a system of 6 unique equations for 6 unknowns (ii, II, mi, ni, b, B). When I attempt to solve the equation, MATLAB returns a set of parameters and conditions that exactly match my system of specified equations and assumptions. It seems to have merely returned my system of equations to me without solving anything. For example, the first condition listed in the solution equals eq1, the second condition equals equation 6, and so on. The full set of conditions is reproduced below. What am I doing wrong? Any advice would be appreciated.
% Symbols and Assumptions
syms d M f s m t k N a b B ii II ni mi fe positive
assume(s>1 & k>s+1);
assume(t>1);
assume(m>1);
% Specifying Equations
eq1 = b * ii^(s-1) - f == 0;
eq2 = B * m^(1 - s) * (II)^(s - 1) - f - d == 0;
eq3 = b * (m * t)^(1 - s) * (ni)^(s - 1) - d == 0;
eq4 = B * (m * t)^(1 - s) * (mi)^(s - 1) - d == 0;
eq5 = a * (s-1) / (k - (s-1)) * (f * ii^(-k) + d * (N-1) * ni^(-k) + d * M * mi^(-k)) == fe;
eq6 = a * (s-1) / (k - (s-1)) * ((f + d) * II^(-k) + d * N * ni^(-k) + d * (M-1) * mi^(-k)) == fe;
% Solve Equation
eqns = [eq1, eq2, eq3, eq4, eq5, eq6];
unks = [ii, II, mi, ni, b, B];
sol = solve(eqns, unks, 'ReturnConditions', true)
sol = struct with fields:
ii: z II: z1 mi: z2 ni: z3 b: z4 B: z5 parameters: [z z1 z2 z3 z4 z5] conditions: z^(s - 1)*z4 - f == 0 & (a*(s - 1)*((d + f)/z1^k + (d*(M - 1))/z2^k + (N*d)/z3^k))/(k - s + 1) - fe == 0 & (a*(s - 1)*(f/z^k + (d*(N - 1))/z3^k + (M*d)/z2^k))/(k - s + 1) - fe ==…
Condition 1 matches eq1: z2*z3^(s - 1) - f == 0
Condition 2 matches eq6: (a*(s - 1)*((d + f)/z1^k + (d*(M - 1))/z4^k + (N*d)/z5^k))/(k - s + 1) - fe == 0
Condition 3 matches eq5: (a*(s - 1)*(f/z3^k + (d*(N - 1))/z5^k + (M*d)/z4^k))/(k - s + 1) - fe == 0
Condition 4 matches eq2: m^(1 - s)*z*z1^(s - 1) - f - d == 0
Condition 5 matches eq3: z*z4^(s - 1)*(m*t)^(1 - s) - d == 0
Condition 6 matches eq4: z2*z5^(s - 1)*(m*t)^(1 - s) - d == 0
Conditions 7-12 match positivity assumptions: 0 < z & 0 < z1 & 0 < z2 & 0 < z3 & 0 < z4 & 0 < z5
  5 Comments
James Harrison
James Harrison on 15 Aug 2023
The sol structure just contains the undefined z parameters.
sol.B = z
sol.II = z1
sol.b = z2
sol.ii = z3
sol.mi = z4
sol.ni = z5
James Harrison
James Harrison on 15 Aug 2023
The problem persists on a simplified system of equations.
To solve by hand, solve eq1 for ii and eq2 for ni (in terms of unknown b). Sub these into eq3 and solve for b. Plug the solution for b into eq1 and eq2 to solve for ii and ni.
syms d f s t k N b ii ni fe positive
assume(s>1 & k>(s-1));
assume(t>1);
eq1 = b * ii^(s-1) - f == 0;
eq2 = b * (t)^(1 - s) * (ni)^(s - 1) - d == 0;
eq3 = (f / ii^(k) + d * N / ni^(k)) == fe;
eqns = [eq1, eq2, eq3];
unks = [ii, ni, b]
unks = 
sol = solve(eqns, unks)
Warning: Solutions are parameterized by the symbols: [z, z1, z2], z1, z2. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
sol = struct with fields:
ii: z ni: z1 b: z2
sol = solve(eqns, unks, 'ReturnConditions', true)
sol = struct with fields:
ii: z ni: z1 b: z2 parameters: [z z1 z2] conditions: z^(s - 1)*z2 - f == 0 & t^(1 - s)*z1^(s - 1)*z2 - d == 0 & f/z^k - fe + (N*d)/z1^k == 0 & 0 < z & 0 < z1 & 0 < z2

Sign in to comment.

Answers (1)

Sai Teja G
Sai Teja G on 21 Aug 2023
Hi James,
I understand that you are solving the equations using ‘solve()’ function.
The conditions you mentioned are not an exact match to the equations; instead, they are substituted by variables within the 'solve()' function and simplified accordingly. For example -
Condition 2 - (a*(s - 1)*((d + f)/z1^k + (d*(M - 1))/z4^k + (N*d)/z5^k))/(k - s + 1) - fe == 0
eq6 - a * (s-1) / (k - (s-1)) * ((f + d) * II^(-k) + d * N * ni^(-k) + d * (M-1) * mi^(-k)) == fe;
If you attempt to substitute specific values for variables instead of symbols, you will obtain the corresponding values for your answer variables.
Hope it helps!

Community Treasure Hunt

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

Start Hunting!