Sorted independent finance guides are full of helpful information on everyday money matters.

DM 41L and HP 41C: Generating a Polynomial Given Its Roots

DM 41L and HP 41C:  Generating a Polynomial Given Its Roots

Introduction

Generate the coefficients of a polynomial (up to the order 4) with the roots a_0, a_1, a_2, and a_3.   The resulting polynomial is:

p(x) = (x – a_0) * (x – a_1) * (x – a_2) * (x – a_3) * (x – a_4)

p(x) = r_4 * x^4 + r_5 * x^3 + r_6 * x^2 + r_7 * x + r_8

The default is a polynomial where the lead coefficient is positive.   If you want a polynomial where the lead coefficient is negative, multiply every coefficient by -1.

Instructions

Store the four roots in registers R00, R01, R02, and R03 respectively.  Run POLY4.  Coefficients are shown briefly as they are calculated.  They are can be recalled by the registers in decreasing order of x:  R04, R05, R06, R07, and R08.

DM 41L and HP 41C Program: POLY4

01  LBL^T POLY4
02 1
03 STO 04
04 PSE 
05 RCL 00
06 CHS
07 RCL 01
08 –
09 RCL 02
10 –
11 RCL 03
12 –
13 STO 05
14 PSE
15 RCL 01
16 RCL 02
17 +
18 RCL 03
19 +
20 RCL 00
21 * 
22 RCL 02
23 RCL 03
24 +
25 RCL 01
26 *
27 +
28 RCL 02
29 RCL 03
30 *
31 +
32 STO 06
33 PSE
34 RCL 01
35 RCL 02
36 *
37 RCL 01
38 RCL 03
39 *
40 +
41 RCL 02
42 RCL 03
43 *
44 +
45 RCL 00
46 *
47 CHS
48 RCL 01
49 RCL 02
50 *
51 RCL 03
52 *
53 –
54 STO 07
55 PSE
56 RCL 00
57 RCL 01
58 *
59 RCL 02
60 *
61 RCL 03
62 *
63 STO 08
64 RTN

Example

Roots x = -3, x = 3, x= 4, and x= 6

Coefficients: 
R04 = 1
R05 = -10
R06 = 15
R07 = 90
R08 = -216

Polynomial:  p(x) = x^4 – 10 * x^3 + 15 * x^2 + 90 * x – 216

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.