3次方程式()の3つの解(複素数)を並べた配列を関数内で作成し、
その先頭アドレスを返す。
The first address of an array created in this function
which consists of the three solutions (complex numbers)
of eq. ().
◆使用例(Example)
struct im ∗solution=eqsol3(1.2,3.4,5.6,7.8);
◆計算式とアルゴリズム
(Formula and algorithm)
1. の判定と処理
(Judgement and processings for )
のときは2次方程式として解くことも可能であるが、
気づかず意図しない結果を生じるのを防ぐために
の場合はエラー終了する仕様にしている。
Although it is possible to solve a quadratic equation
in case of ,
this function treats as an error
to avoid obtaining unexpected results without awaring it.
であるか否かの判定には関数doublecmpを使用し、
との比較によって判定している。
Function doublecmp is used for the judgement of ,
where is compared with .
2. のときの解
(Solution in case of )
3次方程式()の解, , は
以下のように与えられる。
ここで, , , は
以下の式によって定義される。
The three solutions , , and for
the cubic equation of ()
are given by eq. (),
where , , , and are defined by
eqs ()-().
解の導出
(Derivation of the solutions)
解()の導出過程は以下の通り。
The solution () is obtained as follows.
方程式()の両辺をで割って
この式の左辺は
と変形できるので、定数, を()()のようにおき、
と変数変換すれば
を得る。これを解くために更に
と変数変換すると
であるので、これらを()式に代入して整理すれば
が得られる。
Dividing the both sides of eq. () by results in
eq. (),
and the left hand side of this equation
is arranged as ().
Defining constants and as eqs ()()
and converting the variable from to as ()
yield ().
A further conversion of the variable from to as ()
gives eq. ().
Inserting eq. () into (),
one finally obtains ().
()式はについての2次方程式になっており、その解は
と書ける。
とおき、このを
と極座標表示すれば()は
と書き直せる。に関するこれら2つの解を
とおき、これらを
と極座標表示すると、に関する解として
が得られる。これらに関する解を()に代入すると
についての解として
が得られる。
Eq. () is a quadratic equation for ,
the solution of which is given by eq. ().
We now define as ()
and represent it in a polar coordinate format as ().
Then eq. () reduces to ().
Let and be these two solutions,
defined by eqs () and (),
and represent them in polar coordinate formats as
eqs () and ().
Then the solution for is given by eq. (),
where and are given by
eqs () and (), respectively.
Inserting these solutions for into () gives
the solutions for represented by
eqs ()-().
ところで()-()より
が成り立つ。, の定義範囲より
である。これらの性質を用いると()()を
より見通しの良い形に変形でき、両者を比較することができる。
以下ではの符号に応じて場合分けしてこの比較を行う。
From ()-(),
one obtains eq. (),
and the definition ranges of and mean that
the range of is limited as ().
Using these relations, eqs () and ()
can be arranged to more comprehensive forms and can be easily compared.
These forms depend on the sign of .
まずのとき、
()よりとなり、
()の条件と合わせてを得る。
またこのとき()より
であるので、
これらの関係を用いて()()式は
と書き直せる。
これよりであり、
独立な解としてはのみを考えれば良いことが分かる。
In case of ,
() gives ,
from which one obtains
taking into account eq. ().
In this case eq. () reduces to
.
Using these relations, eqs () and ()
can be rewritten as () and (),
respectively.
Therefore holds, so that
only needs to be considered as the independent solutions.
次にのとき、()より
となり、
()の条件と合わせてを得る。
ところでのときは
()よりであるので
()において, となる。
したがって()()式から
, となり、
, , であることが分かる。
またこのとき()より
となるので
()()式は
と書き直せる。
これより, , となり、
独立な解としてはのみを考えれば良いことが分かる。
また、その解については()を対称性の良い形に変形すると
となるが、の定義を変えて
としても3つの解の順番が変わるだけで解自体は変わらない。
We next consider a case where .
In this case, eq. () gives ,
from which is obtained based on
eq. ().
Indeed, when ,
eq. () indicates ,
so that
and hold in eq. ().
Then eqs () and () indicate
and , respectively,
from which , ,
and thus are obtained.
Eq. () also indicates
,
so that eqs () and () are rewritten as
() and (), respectively.
These equations indicate
, , and ,
so that only are needed as the independent solutions.
Eq. () can further be arranged to more symmetric form
of (),
and shifting the definition of by 1,
which does not change the solutions but changes only the order of them,
gives a simpler form of eq. ().
の場合にであったこと、
の場合にはであったことを踏まえると、
()()はまとめて
と書ける。これがに関する解であり、()に代入すれば
に関する解として()が得られる。
Since and hold
in cases of and , respectively,
eqs () and ()
can be unified as ().
This is the solution for ,
and inserting it into () results in
the solution for , given by eq. ().