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

3 次查看(过去 30 天)
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. :)

采纳的回答

Walter Roberson
Walter Roberson 2020-5-2
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 个评论
Walter Roberson
Walter Roberson 2020-5-3
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))

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by