Swiss Micros DM32: Solving Integral Equations
Introduction
The programs presented today solves the following equation for X:
X
∫ F(T) dT = C
0
Since we are not able to use an integration command in solving a program on the DM32 (and the HP 32S and 32SII), we will have to use a manual method, mainly Newton's Method:
X_n+1 = X_n - [ ∫( F(T) dT from T = 0 to T = x_n) - C ] ÷ f(x_n)
with in tolerance D.
To see a similar program for the HP Prime, posted on April 3, 2020, please click here:
https://edspi31415.blogspot.com/2020/04/hp-prime-solving-integral-equations.html
DM32 Code: Integral Equations
LBL H: Help File
LBL H
SF 10
EQN: L B L _ F - F ( T )
EQN: L B L _ S - S O L V E
EQN: S _ H A S _ R C L _ T
EQN: C = C O N S T
EQN: D = T O L E R
EQN: G U E S S _ X E Q _ S
CF 10
RTN
Note: Underscore is the space key. Press R/S after each message.
LBL F
RCL T
enter f(T), the integrand, here
RTN
Note: The variable used is T. If you want to test out the function, store a value in the variable T first.
LBL S
RAD
STO X
LBL A
FN= F
0
RCL X
∫ FN d T
RCL- C
STO Y
RCL X
STO T
XEQ F
STO÷ Y
RCL X
RCL- Y
STO Y
RCL Y
RCL- X
ABS
RCL D
x<y?
GTO B
RCL Y
RTN
LBL B
RCL Y
STO X
GTO A
Note: This is the main program. Enter a guess, and then key in XEQ S.
Variables Used:
T = independent variable
C = constant
D = tolerance (i.e. 10^-4, 10^-5, 10^-6, etc)
X = x_n
Y = x_n+1, final approximation
Download the state file here: ntegralequ.dm32
The state file includes a sample integrand:
e^(-T ÷ 4):
LBL F
RCL T
x^2
+/-
4
÷
e^x
RTN
Examples
In the following examples, the tolerance is 10^-5 (5 +/- 10^x STO D) and FIX 5 mode is set.
1. ∫( e^(-T^2 ÷ 4) dT for T = 0 to X) = 1
C = 1
Guess = 2, Result: 1.10208
Guess = 1, Result: 1.10208
Guess = 3, Result: Division by 0 error
Note that initial guesses are important.
2. ∫( e^-sin(T + 1) dT for T = 0 to X) = 10
C = 10
LBL F
RCL T
1
+
SIN
+/-
e^x
RTN
Guess = 5; Result: 9.10014
3. ∫( T^3 - 2 × T dT for T = 0 to X) = 40
C = 40
LBL F
RCL T
3
y^x
RCL T
2
×
-
RTN
Guess = 5; Result: 3.84789
4. ∫( sin^2 T dT for T = 0 to X) = 1.4897
C = 1.4897
LBL F
RCL T
SIN
x^2
RTN
Guess = 2; Result: 2.49991
Eddie
All original content copyright, © 2011-2023. 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.