┌──────────────┐
│ ┌──────────┐ │
│ │ NEOPOLYS │ │
│ │ (v3.5) │ │
│ └──────────┘ │
└────(c)APO────┘
( The definitive polynomial lib for de HP48-G, GX )
First of all:
English is not my native language so I'd like to apologize for
the errors in this doc.
!! WARNING FOR S,SX USERS !!
Altough I've not tried this lib in any of those models, I think
it could work fine. Nevertheless I recommend you to backup your
HP before trying this library.
┌───────────┐
│ THE FILES │
└───────────┘
NEOPV3X1.LIB The polynomial lib.
NEOPV3X1.LAP The polynomial lib and Laplace transforms.
NEOPV3X1.ESP Spanish manual.
NEOPV3X1.ENG English manual.
┌──────────────┐
│ INTRODUCTION │
└──────────────┘
1. The polynomials can be represented:
a) by their coefs:
reals : { 2 0 4 -500 } = '2·x^3+x-500'
complexes : { (1,0) (3,-6) 2 }
symbolics : { '1/3' 6 '2*(A,B)' '4/(B+C)' A }
b) by their roots:
reals : { { 1 2 3 4 } }
complexes : { { (1,2) (3,4) 5 (6,0) } }
symbolics : { { A B (0,-2) 'COS(E)' '2*INV(F)' 4 } }
2. These forms can be used with all of the commands except "Roots" which
only works with numbers or symbolic expresions that gives numeric
results.
3. The polinomial '0' is { } although the forms like { 0 } or { (0,0) }
or { (0,0) 0 0 '2*A-A-A' } can be used as well.
4. The polinomial "{{ }}" is considered as the null one "{ }".
┌──────────────┐
│ THE COMMANDS │
└──────────────┘
( I think it's eough obvious what each command does; nevertheless if
there is any slow brain guy, I explain each of them ).
* P+ : Adds polynomials:
2: { 0 1 '3/4' } P+
1: { '-3/4' } ->->->->->->->-> 1: { 1 0 }
2: { { '3/A' (1,1) 0 } P+,->Q 1: { 1 '(0,-1)-3/A' '2
} ->->->->->->->-> /3'+(3,3)/A' 4 }
1: { 1 '2/3' (4,0) }
* P- : Substracts polynomials:
2: { 1 2 3 4 } P- 1: { 0 '2+A+B+C' '3+(-
1: { { A B C } } ->->->->->->->-> B-C)*A-B*C' '4+A*B*C' }
* P* : Multiplies polynomials:
2: { { 1 2 } } P* 1: { 1 -9 31 -51 40
1: { 1 -6 11 -6 } ->->->->->->->-> -12 }
* P/ : Divides polynomials:
2: { { A B 'C/3' } } P/ 2: {
}(remainder)
1: { { B 'C/3 } } ->->->->->->->-> 1: { 1 '-A' }
* P^ : Polynomial to integer number:
2: { 1 '-A' } P^ 1: { 1 '-(2*A)' 'A^2'
1: '(5*C-C)/(2*C)' ->->->->->->->-> }
2: { 1 } (num)
2: { { 1 2 3 } } P^ 1: { 1 -12 58 -144 193
(denom)
1: -2 ->->->->->->->-> -132 36 }
* Pval : Evaluates polynomials using the Horner's method.
2: { (0,0) '1/3' A B } Pval 1: '(1/3*(0,-1)+A)*
1: (0,-1) ->->->->->->->-> (0,-1)+B '
2: { { A B 1 } } Pval,->Q 1: '1/3*(1-A+1/3*C)*(1
1: '1+C/3' ->->->->->->->-> -B+1/3*C)*C'
The results of the next commands depends on the state of the user flag 2
( see the "flg2" command ).
* F+ : Adds polynomial fractions.
* F- : Substracts polynomial fractions.
* F* : Multiplies polynomial fractions.
* F/ : Divides polynomial fractions.
* F^ : Polynomial fractions to integer number.
* Fval : Evaluates polynomial fractions at a point.
* A->P : Algebraic -> Polynomial:
2: 'A*s^2+B/s' A->P 2: { A 0 0 B }
1: 's' ->->->->->->->-> 1: { 1 0 }
* P->A : Polynomial -> Algebraic:
2: { A '1/3' (1,1) } P->A
1: 'z' ->->->->->->->-> 1: '(1,1)+1/3*z+A*z^2'
* F->A : Polynomial fraction -> Algebraic.
Flag 2 activated => Automatic simplification before the con-
version.
3: { { A B } } F->A
2: { 1 2 3 } ->->->->->->->-> 1: '(A*B+(-A-B)*X+X^2)
1: 'X' /(3+2*X+X^2)'
3: { { A B } } F->A
2: { { A B } } ->->->->->->->-> 1: 1
1: 'X'
* Pδ : Derivative of a polynomial:
Pδ
1: { { 1 1 '2/(A+B)' } ->->->->->->->-> 1: { 3 '2*(-2-2/(A+B))
} ' '1+4/(A+B)' }
* PS : Gives the primitive of a polynomial:
* Fδ : Derivative of a polynomial fraction (result depends on flag 2) .
* Pcoef : Given the roots returns the coefs:
1: { { 'A+B' 2 '1/3' } Pcoef,->Q 1: { 1 '-(7/3)-A-B' '2
} ->->->->->->->-> /3-7/3*(-A-B)' '2/3
*(-A-B)' }
* Psimp : Simplifies polynomial fractions:
2: { { 1 2 } } Psimp 2: { 1 }
1: { 1 -6 11 -6 } ->->->->->->->-> 1: { 1 -3 }
2: { { A B } } Psimp
1: { { A B } } ->->->->->->->-> 1: { 1 }
* GCD : Greatest common denominator of two polynomials:
2: { 0 (1,0) A } GCD
1: { { '-A' } } ->->->->->->->-> 1: { 1 A }
2: { 1 2 3 4 5 } GCD
1: { 1 2 3 4 } ->->->->->->->-> 1: { 5 }(no
hay GCD)
* Roots : Gives the numerical roots of a polynomial:
─────────
Roots
1: { 1 -15 85 -225 274 ->->->->->->->-> 1: { { 5 4 3 2 1 } }
-120 }
* pf : Partial fraction decomposition:
The result on level 2 represents the coefs for each of the roots
on level 1:
2: { 1 } pf 2: { '1/(A-B)' '1/(-A...
1: { { A B } } ->->->->->->->-> 1: { { B A } }
2: { { 1 2 } } pf 2: { 0 1 -1 0 }
1: { { 1 1 1 1 } } ->->->->->->->-> 1: { { 1 1 1 1 } }
meaning:
(x-1)·(x-2) 0 1 -1 0
─────────── = ───────── + ───────── + ───────── + ─────────
(x-1)^4 (x-1) (x-1)^2 (x-1)^3 (x-1)^4
* flg2 : Turns user flag 2 on off. When activated, the rational results
will be automaticly simplified.
* ->L : Gives simple Laplace Transforms of the expressions on level 1
which must be combinations of terms of the form t^n, exponentials,
sines, cosines and symbolic or numerical constants.
NOTE: In this version, terms with sines or cosines can have arguments
of the form (a·t+b) or any which results in terms of that form.
2: ->L 2: { 5 2 }
1: '8*t*e^-(2*t)+3*e^- ->->->->->->->-> 1: { 1 5 8 4 }
(2*t)-3*e^-t (flag 2 on)
2: ->L 2: { 1 1 }
1: 'e^-t*COS(2*t)' ->->->->->->->-> 1: { 1 2 5 }
(flag 2 not act.)
NOTE: Like always, flag 2 activated => automatic simplification.
* L-> : Gives the reverse Laplace Transform of the polynomial fraction
on levels 1 and 2 ( with degree of numerator supposedly less than
degree of denominator ).
2: { 3 } L-> 1: 'e^-t*-(1.5*-SIN(2*
1: { 1 2 5 } ->->->->->->->-> t))'
2: { { a b } } L->
1: { { c c '1/3'} } ->->->->->->->-> 1: ... etc ...
┌────────────┐
│ THE AUTHOR │
└────────────┘
You can distribute this library freely. Nevertheless, I'd like to know
if you found it useful. Please, let me know that. E-mail me to
apolo@sorolla.eis.uva.es
┌─────────┐
│ CHANGES │
└─────────┘
Changes from v3.3:
The "Roots" command didn't work fine with some polynomials.
There was made a small code optimization was made.
Changes from v3.1:
The "pf" didn't work fine with some decompositions because of a
very small error (thanx, Gonzalo).
I've made a little code optimization of the "A->P" command.
Changes from v3.0:
There was an error in the P->A command (thanx to Peter Horn)
when trying to convert a polynomial with just one coefficient
to an algebraic expression.
Also the "bad argument type" error in the A->P command when
trying to convert a number or a constant to a polynomial was
corrected.
Changes from v2.3:
Great code optimization and error checking which raises slight-
ly the speed for the calculations and decreases the size of
the library.
You may choose the lib with simple Laplace and reverse Laplace
transforms or just the polynomial commands.
More different cases are considered when calculating Laplace
transforms.
!! WARNING (FOR PREVIOUS USERS) !!
The results returned by the "pf" command are now expresed in
a different form (see "pf" command below).
Changes from v2.2:
The command "Roots" didn't converge for some polynomials. a
little change was made to ensure the convergence for any
polynomial
Changes from v2.1:
An error was detected in the "pf" command when the first
polynomial coefficient of the denominator was not 1.