How to solve a system of two non-linear equations symbolically

8 views (last 30 days)
I have the following equations:
where is a constant. I want to find both and as a function of A. I tried solving it symbolically, which does give a result, but I do not know how to interpret or simplify it.
syms L0
syms L1
syms A
a=2/3;
[L0 L1]= solve(L0 -1 +a*L1^(a-1) -a*A*L0^(a-1)==0, L1 -1 -a*L1^(a-1) +a*A*L0^(a-1)==0)
Plotting the Solution numerically worked with the following code, and led to the result I expected, but do you have an idea how I could get a symbolical solution (or approximation if necessary), for the variables and as a function of A? I'd need it to do further calculations (by hand).
Thanks a lot, your help is appreciated!

Accepted Answer

Walter Roberson
Walter Roberson on 18 Jun 2019
Edited: Walter Roberson on 20 Jun 2019
sol = solve(L0 -1 +a*L1^(a-1) -a*A*L0^(a-1)==0, L1 -1 -a*L1^(a-1) +a*A*L0^(a-1)==0,'returnconditions',true);
sol =
struct with fields:
L0: [28×1 sym]
L1: [28×1 sym]
parameters: [1×1 sym]
conditions: [28×1 sym]
>> sol.conditions
ans =
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A == 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
A ~= 0
So what you have is two sets of solutions. The first 13 solutions are relevant when A == 0. The first is 0, and the next 12 solutions are the cube of the 12 roots of the polynomial z^12 - 5*z^9 + 9*z^6 - 7*z^3 + 46/27 . The 15 solutions after that are the cubes of the 15 roots of the polynomial z^15 - 5*z^12 - 2*A*z^11 + 9*z^9 + 8*A*z^8 + (4*A^2*z^7)/3 - 7*z^6 - 10*A*z^5 - 4*A^2*z^4 - (z^3*(8*A^3 - 46))/27 + 4*A*z^2 + (8*A^2*z)/3 + (16*A^3)/27 .
If your is intended to indicate the open set, then A cannot be 0, and you can
syms L0 L1 A
assume(A>0 & A<1)
sol = solve(L0 -1 +a*L1^(a-1) -a*A*L0^(a-1)==0, L1 -1 -a*L1^(a-1) +a*A*L0^(a-1)==0)
to get just the 15 solutions
You can convert that polynomial into a roots() call:
roots([1, 0, 0, -5, -2*A, 0, 9, 8*A, (4*A^2)/3, -7, + -10*A, -4*A^2, 46/27 - (8*A^3)/27, 4*A, (8*A^2)/3, (16*A^3)/27])
It appears to me that the 3rd and 6th and 15th root are real-valued. I am not sure at the moment if there are any particular real points for specific A values; I am seeing artifacts due to the way that roots are numbered.
  4 Comments
Walter Roberson
Walter Roberson on 20 Jun 2019
"With the roots() call I get the same 15 solutions... How did that help? "
With the roots call you get 15 numeric solutions.
>> A=1/3;roots([1, 0, 0, -5, -2*A, 0, 9, 8*A, (4*A^2)/3, -7, + -10*A, -4*A^2, 46/27 - (8*A^3)/27, 4*A, (8*A^2)/3, (16*A^3)/27])
ans =
1.3086285136187 + 0i
1.13534173484129 + 0.166598557544465i
1.13534173484129 - 0.166598557544465i
0.86739394608367 + 0i
-0.638326898150363 + 1.12185507902337i
-0.638326898150363 - 1.12185507902337i
-0.345631679731567 + 1.05445786581201i
-0.345631679731567 - 1.05445786581201i
-0.646415333735405 + 0.843949170383418i
-0.646415333735405 - 0.843949170383418i
-0.233517483108016 + 0.717352144678334i
-0.233517483108016 - 0.717352144678334i
-0.408011319404886 + 0i
-0.155455910264676 + 0.0557721334189132i
-0.155455910264676 - 0.0557721334189132i
This does not require the symbolic toolbox.
There are no closed form solutions for degree 15 polynomials.
Perhaps you would be willing to live with the approximation that
L0_3 = 0.4292*A.^3 - 0.8521*A.^2 + 0.02415*A + 0.002639 %values < 0 decreasing
L0_6 = 0.002639*A.^3 - 0.2629*A.^2 + 0.7519*A + 0.4282 %values > 0.4
L0_15 = -0.00775*A.^3 + 0.06886*A.^2 + 0.1602*A + 2.18 %values > 2
In each case, the corresponding L1 value is 2 minus the L0 value. If you were expecting both L0 and L1 to be positive, then the 6th root is the only solution.
Franziska
Franziska on 20 Jun 2019
Adding assumptions actually helped, but I still struggle interpreting. The Assumptions that must be true for the variables are:
I solved the equation for using the assumptions and got a unique solution:
a=2/3;
syms A
syms L0
syms L1
assume(A>0 & 0<L0 & L0<2)
Sol= solve(L0 - 1 +a*(2-L0)^(a-1) -a*A*L0^(a-1)==0, L0, 'ReturnConditions', true)
Sol.L0
Sol.conditions
Sol.parameters
This gave me the solution for .
I do not understand where this comes from and how to interpret it. (I am new to matlab)
Anyway thank you so much for your help!

Sign in to comment.

More Answers (1)

darova
darova on 18 Jun 2019
Use matlabFunction() to make function handle from symboliv expression
L0 = matlabFunction(L0);
L1 = matlabFunction(L1);
A = 0.5:0.01:2;
plot(A,L0(A),A,L1(A))

Community Treasure Hunt

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

Start Hunting!