Borrar filtros
Borrar filtros

How to solve system of 4th power 4 variables of Nonlinear equations?

1 visualización (últimos 30 días)
Hello, everyone. I'm trying to solve this system:
Is it posible? I've been trying with 2 functions: solve() and vpasolve (). But the software throws me like 54 values per variable and I need just 1 per variable. My code below:
var= input ('Enter the domain of the function: \n');
syms x [1 var];
func= input ('Enter the function, i.e [x1+x2+...+xn]: \n');
y=[];
for s=x(1:end)
dp= diff (func, [s]);
y=[y, dp];
end
pc=solve (y, [x]);
Indeed the system comes from the variable "y".
Thanks in advance for the help. :)

Respuesta aceptada

Walter Roberson
Walter Roberson el 2 de Mayo de 2020
I need just 1 per variable.
By inspection, we can see that the system is solved when x1 = x2 = x3 = x4 = 0.
Since you only need one value per variable, there is no need to do any calculation.
  4 comentarios
Walter Roberson
Walter Roberson el 3 de Mayo de 2020
eqn = [
2*x(1)^2 - 2*x(3)^2 - 2*x(1)*x(4) + 2*x(1)^2;
-4*x(2)*x(3) + 4*x(2)^3;
-4*x(1)*x(3) + 4*x(3)^3 - 2*x(4) - 2*x(2);
-4*x(4)*x(3) + 4*x(4)^3 - 2*x(1)^2
];
sol = solve(eqn);
mask_sym = imag(sol.x1) == 0 & imag(sol.x2) == 0 & imag(sol.x3) == 0 & imag(sol.x4) == 0;
mask = isAlways(mask_sym, 'unknown', 'false');
real_sol = [sol.x1(mask), sol.x2(mask), sol.x3(mask), sol.x4(mask)];
disp(double(real_sol))
Abner Ojeda
Abner Ojeda el 3 de Mayo de 2020
Awesome, Walter. Thanks for the help, it was very useful. :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by