30 - POLI1 - Root Finder - Nullstellenberechnung

Post Reply
Peet
Posts: 93
Joined: Tue Sep 29, 2020 12:01 am
Location: Germany

30 - POLI1 - Root Finder - Nullstellenberechnung

Post by Peet »

Code: Select all

LBL "POLY1"
"A=?"
CLX
PROMPT
STO 08
"B=?"
CLX 
PROMPT
STO 09
"C=?" 
CLX
PROMPT
STO 10
"D=?"
CLX
PROMPT 
STO 11
LBL 03
"GUESS1=?"
PROMPT
STO 01
"GUESS2=?"
PROMPT
STO 02
RCL 01
STO 04
XEQ 04
STO 05
RCL 02
STO 04
XEQ 04
STO 06
RCL 05
*
X>0?
GTO 05
LBL 00
RCL 02
RCL 02
RCL 01
-
RCL 06
RCL 05
-
/
RCL 06
*
-
STO 04
XEQ 04
STO 07
X=0?
GTO 06
ABS
1 E-8	; Tolerance value  (StdPrg Edition 1980: 1E-10, 1981: 1E-8)
X>Y?
GTO 06
RCL 07
RCL 06
*
X>0?
GTO 01
RCL 02
STO 01
RCL 06
STO 05
LBL 02
RCL 04
STO 02
RCL 07
STO 06
GTO 00
LBL 01
2
ST/ 05
GTO 02
LBL 06
"X="
ARCL 04
PROMPT
LBL 05 
"F1*F2>0"
AVIEW
PSE
GTO 03
LBL 04
ENTER
ENTER
ENTER
RCL 08
*
RCL 09
+
*
RCL 10
+
*
RCL 11
+ 
END
HP41 Standard Applications (modified version)
Changes: predefined function (cubic polynomial) in LBL 04

Usage:

Find a value for x such f(x)=0 for the function defined in LBL 04: ax^3+bx^2+cx+d=0

Example f(x)=x^2-2:
1. set a,b,c,d: A=0 B=1 C=0 D=-2
2. guess (enclose) a root position: GUESS1=1 GUESS1=2 or GUESS1=-2 GUESS1=0

Example 1 from Standard Applications f(x)=x^3-6x^2+11x-1:
A=1 B=-6 C=11 D=-1 (or enter the function: 86 LBL 04 ENTER ENTER ENTER 6 - * 11 + * 1 - END )

Example 2 from Standard Applications:
86 LBL 04 30 - SIN RCL 04 2 * 60 + COS - END
Attachments
30_POLI1_Nullst.raw
(165 Bytes) Downloaded 3 times
My programmable calculators - former: CBM PR100, HP41CV, HP28S, HP11C - current: HP48G(+), HP35S, DM41X, DM42
Post Reply