convert/mathorner
convert a polynomial to Matrix Horner form
Calling Sequence
Parameters
Description
Examples
convert( poly, mathorner )
convert( poly, mathorner, var )
poly
-
polynomial
var
(optional) variable
convert/mathorner writes the polynomial poly in the name var in horner or ``nested'' form.
If there is only one indeterminate in poly then it is not necessary to specify the third argument var.
Horner form allows you to evaluate polynomials of Matrices in the most efficient manner. For a polynomial of degree n there will be n adds and n multiplications needed to evaluate the Horner form.
p≔−56−7⁢x5+22⁢x4−55⁢x3−94⁢x2+87⁢x
p≔−7⁢x5+22⁢x4−55⁢x3−94⁢x2+87⁢x−56
A≔Matrix⁡1,−3,4,7
A≔1−347
convert⁡p,mathorner
−56+87+−94+−55+22−7⁢x&*x&*x&*x&*x
subs⁡x=A,
−56+87+−94+−55+22−7⁢1−347&*1−347&*1−347&*1−347&*1−347
eval⁡,`&*`=`.`
1471712681−16908−10645
eval⁡,x=A,`&*`=`.`
P≔eval⁡p,x=%A
P≔−7⁢A5+22⁢A4−55⁢A3−94⁢A2+87⁢A−56
eval⁡convert⁡P,mathorner,%A,`&*`=`.`
−56+87+−94+−55+22−7⁢A·A·A·A·A
value⁡
See Also
convert
convert[horner]
Download Help Document