25. POLYSOLV Command
The POLYSOLV command will solve for the roots on an equation with
either real or complex coefficients. If desired an estimate of the error
in the root can be calculated. The POLYDIVIDE sentence can be used for
polynomial division. If the POLYDIVIDE sentence is present, only
polynomial division is performed and NO options or parameters are
passed on the POLYSOLV sentence. The POLYDIVIDE sentence lists the roots
of the polynomial. It is useful in testing models for stationarity.
Form of command.
B34SEXEC POLYSOLV options parameters$
POLYDIVIDE parameters$
PGMCARDS$
coefficients here free format
B34SRETURN$
B34SEEND$
Solving polynomials.
Options for POLYSOLV sentence.
REAL - Coefficients will be real. This is default.
COMPLEX - Coefficients will be complex.
Parameters for POLYSOLV sentence.
IORDER = n1 Sets maximum order of the polynomial. Required.
IN = n2 Sets number of coefficients supplied.
Default = IORDER + 1. IN is only needed if INPU
set NE 0. If IN = 0, program counts cards after
PGMCARDS$ and before B34SRETURN$
IFMT = n3 =0 Coefficients read in free format (see below).
=1 Coefficients read in DP unformatted from unit
INPU.
=2 Coefficients read from unit INPU following
format (I5,3E16.8).
INPU = n4 Sets coefficient input unit. Defaults to 5 where
coefficients are read after PGMCARDS$ and before
B34SRETURN$. If INPU NE 5, then PGMCARDS$ and
B34SRETURN$ sentences not used.
Method to input coefficients.
Coefficients are inputted with PGMCARDS$ and B34SRETURN$ sentences
in free format. For real case on each line put:
COEF order, Real part of coef
For the complex case, put the imaginary part of the coeffient after the
real part.
Sample problem.
Solve the equation 0 = 1 -3X + 4X**2 - 2X**3
b34sexec polysolv real iorder=3$
pgmcards$
0 1.0
1 -3.
2 4.
3 -2.
b34sreturn$
b34seend$
Dividing Polynomials.
Parameters for POLYDIVIDE sentence.
TOP(r1,r2,..) Specify terms for numerator.
BOT(rk,rj,..) Specify terms for denominator.
NTERMS=n1 Sets number of terms for answer. Default = 12.
Sample problem.
Solve the problem (1.0 - .4B -.3B**3)/(1.0 - .5B) for 40 terms.
b34sexec polysolv$
polydivide top(1.0, -.4 0.0 -.3) bot(1.0, -.5) nterms=40$
b34seend$
Example that shows that sum will converge
if sqrt(real*2 + imag*2) > 1
b34sexec polysolv$ polydivide top(1.0) bot(1.0 -.5) $ b34seend$
b34sexec polysolv$ polydivide top(1.0) bot(1.0 -1.01)
nterms=60 $ b34seend$
b34sexec polysolv$ polydivide top(1.0 -.4 0.0, -.3)
bot(1.0 -.5) nterms=40$ b34srun;