![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225315/image.png)
How to solve a system of two non-linear equations symbolically
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Franziska
el 18 de Jun. de 2019
Comentada: Franziska
el 20 de Jun. de 2019
I have the following equations:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225158/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225159/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225160/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225161/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225162/image.png)
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).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225161/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225162/image.png)
Thanks a lot, your help is appreciated!
0 comentarios
Respuesta aceptada
Walter Roberson
el 18 de Jun. de 2019
Editada: Walter Roberson
el 20 de Jun. de 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/225315/image.png)
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 comentarios
Walter Roberson
el 20 de Jun. de 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.
Más respuestas (1)
darova
el 18 de Jun. de 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))
0 comentarios
Ver también
Categorías
Más información sobre Equation Solving en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!