Sunday, February 17, 2019

HP 42S/DM 42/Free42: Function Table


HP 42S/DM 42/Free42: Function Table

Introduction

The program FTAB uses the function defined in FX, with variable “X” to generate a 2 column matrix of f(X). The matrix is stored in variable MATS. The program ends with MATS in edit mode, so you see all the points generated. Use the soft key [ → ] to view the entries.

Setting up FX

To set up the function FX, the program needs to be in the following format:

00 {nnn-Byte Prgm}
01 LBL “FX”
02 MVAR “X”
03 f(X) starts here, use RCL “X” for X
nn-1 RTN
nn END

HP 42S Program FTAB
HP 42S, DM 42, Free42

00 { 99-Byte Prgm }
01▸LBL "FTAB"
02 "X Start:"
03 PROMPT
04 STO 01
05 "X Step:"
06 PROMPT
07 STO 02
08 "# Steps:"
09 PROMPT
10 STO 03
11 1
12 -
13 1ᴇ3
14 ÷
15 STO 04
16 RCL 03
17 2
18 DIM "MATF"
19 INDEX "MATF"
20▸LBL 00
21 RCL 01
22 RCL 04
23 IP
24 RCL× 02
25 +
26 STO "X"
27 STOEL
28 J+
29 XEQ "FX"
30 STOEL
31 J-
32 I+
33 ISG 04
34 GTO 00
35 EDITN "MATF"
36 .END.

Example

f(x) = x^2 * e^x

FX:
00 { 18-Byte Prgm }
01▸LBL "FX"
02 MVAR "X"
03 RCL "X"
04 ENTER
05 X↑2
06 X<>Y
07 E↑X
08 ×
09 RTN
10 .END.


Input:
X Start: 0
X Step: 0.1
# Steps: 10

Result Matrix MATS:

MATF= [ 10x2 Matrix ]
1:1= 0.0000
1:2= 0.0000
2:1= 0.1000
2:2= 0.0111
3:1= 0.2000
3:2= 0.0489
4:1= 0.3000
4:2= 0.1215
5:1= 0.4000
5:2= 0.2387
6:1= 0.5000
6:2= 0.4122
7:1= 0.6000
7:2= 0.6560
8:1= 0.7000
8:2= 0.9867
9:1= 0.8000
9:2= 1.4243
10:1= 0.9000
10:2= 1.9923

Matrix (row:column)

Eddie


All original content copyright, © 2011-2019. 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.

Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...