The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Generating a Polynomial Given Its Roots
12-17-2018, 02:50 AM
Post: #1
Generating a Polynomial Given Its Roots
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
Code:

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

Blog post: https://edspi31415.blogspot.com/2018/12/...omial.html
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Generating a Polynomial Given Its Roots - Eddie W. Shore - 12-17-2018 02:50 AM



User(s) browsing this thread: 2 Guest(s)