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. :)
0 个评论
采纳的回答
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
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 Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!