SpectraRust/tlusty/extracted/quartc.f
2026-03-19 14:05:33 +08:00

36 lines
745 B
Fortran

subroutine quartc(a,b,c,x)
C ==========================
c
c solver for the algebraic equation of the fourth order
c a*x**4 + b*x =c
c
c solution done by the Newton-Raphson method
c
c Initial estimate
c
INCLUDE 'IMPLIC.FOR'
c
if(a.gt.b) then
x=(c/a)**0.25
else
x=c/b
end if
c
it=0
10 continue
it=it+1
ax=a*x**3
v=c-b*x-x*ax
d=4.*ax+b
if(d.ne.0.) dx=v/d
x=x+dx
if(abs(dx/x).gt.1.e-3) then
if(it.lt.20) go to 10
else
if(it.ge.20) write(6,601) a,b,c,dx,x
end if
601 format(' slow convergence of quartic solver'/
* ' a,b,c,dx,x = ',1p5e13.4)
return
end