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

3 views (last 30 days)
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. :)

Accepted Answer

Walter Roberson
Walter Roberson on 2 May 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 Comments
Walter Roberson
Walter Roberson on 3 May 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))

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!