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

3 ビュー (過去 30 日間)
Abner Ojeda
Abner Ojeda 2020 年 5 月 2 日
コメント済み: Abner Ojeda 2020 年 5 月 3 日
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))
Abner Ojeda
Abner Ojeda 2020 年 5 月 3 日
Awesome, Walter. Thanks for the help, it was very useful. :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by