kl800.com省心范文网

# 一元三次方程求根公式及其Fortran代码

f (x)=

x3 +

3b 2 x 3a

+

6c x 6a

+

2d = 2a

x3 + 3b′ x2 + 6c′ x + 2d ′ =0 形式，为简便我们仍记 α2 ? β 3 , R1 = ? ? ? ? ? ? ? 3 ? √ α + √Δ , R2 = ? ? ? ? ? ? ? 3 ? √ α ? √Δ

x3 + 3bx2 + 6cx + 2d = 0 ，令 b2 ? 2c, Δ =

α = ?b3 + 3bc ? d, β=

，则方程的三个根可写作：

x1 = ?b + R1 + R2 x2 = ?b ? x3 = ?b ?
(R1 +R2 ) 2 (R1 +R2 ) 2

+ ?

√3(R1 ?R2 ) i 2 √3(R1 ?R2 ) i 2

? ?

3 当 Δ = 0 时，有 R1 = R2 = √ α =R ，

? ?

?

x2 = x3 = ?b ? R
?

α ) β 3/2

?

，则

x1 = ?b + 2√β cos( θ ) 3
π x2 = ?b + 2√β cos( θ+2 ) 3 π x3 = ?b + 2√β cos( θ?2 ) 3

3 ?= ? 当 Δ < 0 时，记 z = α + √|Δ| i, z α ? √|Δ|i, R1 = √ z, R2 = √z 3 3 ? ? ? ? ，则 R = R 3 ?1 ，记 R1 = R, R2 = ?= ?=? ,ω 为 √z z R √ 2

?? ?

?? ?

?1+√3i ? = ,ω 2

?1?√3i 2

? x1 = ?b + R1 + R2 = ?b + R + R x2 = ?b ? x3 = ?b ?

(R1 +R2 ) 2 (R1 +R2 ) 2

+ ?

√3(R1 ?R2 ) i 2 √3(R1 ?R2 ) i 2

? ?R = ?b + ωR + ω ? ? R + ωR = ?b + ω

? kπ 3 ? 3 R(R) =R = z √ |z| cos( θ+2 ), k = 0, 1, ?1 √ 3 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? = |z| √ = α2 + |Δ| √α2 ? = α2 + β 3 β 3/2 θ = arccos( |α ) = arccos( z|
π 旋转 23 的复数，所以 x 2 , x 3 并不能给出新的根。

x1 = ?b + 2R(R)

α ) β 3/2

==============================J*e*r*k*w*i*n*@*g*m*a*i*l*.*c*o*m============================= 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| if(Delt>0.D0) then tht = Alph+sqrt(Delt); R1 = sign(abs(tht)**(1.D0/3.D0), tht) tht = Alph-sqrt(Delt); R2 = sign(abs(tht)**(1.D0/3.D0), tht) X(1) = -b+R1+R2 else if(Delt==0.D0) then R1 = sign(abs(Alph)**(1.D0/3.D0), Alph) if(R1==0.D0) then X(1) = -b else X(1) = -b+2.D0*R1 X(2) = -b-R1 end if else if(Delt<0.D0) then tht = acos(Alph/(sqrt(Beta)*Beta)) X(1) = -b+2.D0*sqrt(Beta)*cos(tht/3.D0) X(2) = -b+2.D0*sqrt(Beta)*cos((tht+TwoPi)/3.D0) X(3) = -b+2.D0*sqrt(Beta)*cos((tht-TwoPi)/3.D0) end if End Subroutine getCubicRoot Alph = -b*b*b + 3.D0*b*c -d Beta = b*b -2.D0*c X = 0.D0 a = P(1) b = P(2)/(3.D0*a) c = P(3)/(6.D0*a) d = P(4)/(2.D0*a) Subroutine getCubicRoot(P, X) real*8, parameter:: TwoPi = 8.D0*atan(1.D0) real*8 P(*), a, b, c, d, Alph, Beta, Delt, R1, R2, tht, X(3)

Delt = Alph*Alph-Beta*Beta*Beta

============================================================================================

### 一元三次方程与一元四次方程的根.doc

3.6 一元三次方程与一元四次方程的根 3.6.1 一元三次方程的根 一元二次方程的求根公式是众所周知的, 下面我们给出一元三次与一元四次方程的求根 公式. ...