メインコンテンツ

非線形多項方程式の解法、問題ベース

x が 2 行 2 列の行列である場合、方程式

x3=[1234]

は連立多項方程式です。ここで、x3 は、行列乗算を使用した x*x*x を意味します。問題ベースのアプローチを使用して、この方程式を容易に定式化し、解くことができます。

まず、変数 x を 2 行 2 列の行列変数として定義します。

x = optimvar('x',2,2);

x について解く方程式を定義します。

eqn = x^3 == [1 2;3 4];

この方程式を使用して、方程式問題を作成します。

prob = eqnproblem('Equations',eqn);

[1 1;1 1] から始めて問題を解きます。

x0.x = ones(2);
sol = solve(prob,x0)
Solving problem using fsolve.

Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the value of the function tolerance, and
the problem appears regular as measured by the gradient.

<stopping criteria details>
sol = struct with fields:
    x: [2×2 double]

解を検証します。

disp(sol.x)
   -0.1291    0.8602
    1.2903    1.1612

解の 3 乗を表示します。

sol.x^3
ans = 2×2

    1.0000    2.0000
    3.0000    4.0000

参考

トピック