Finding Min/Max of a function for HP-67
03-10-2014, 05:48 PM
Post: #1
 Namir Senior Member Posts: 690 Joined: Dec 2013
Finding Min/Max of a function for HP-67
finding the minimmum/maximum of a function using Newton's method.

Memory Map

R0 = tolerance
R1 = x
R2 = h
R3 = f(x), f''(x)
R4 = f(x+h)
R5 = f(x-h)

HP-67 Implementation

Code:
1 LBL A
2 STO 1     # store guess for optimum x
3 X<>Y
4 STO 0     # store tolerance
5 LBL 0
6 RCL 1     # display current guess for optimum x
7 PAUSE
8 ABS
9 1
10 +
11 EEX
12 CHS
13 3
14 *
15 STO 2     # calculate and store h
16 RCL 1
17 GSB E
18 STO 3     # Calculate and store f(x)
19 RCL 1
20 RCL 2
21 +
22 GSB E
23 STO 4     # Calculate and store f(x+h)
24 RCL 1
25 RCL 2
26 -
27 GSB E
28 STO 5     # Calculate and store f(x-h)
29 RCL 4
30 +
31 RCL 3
32 2
33 *
34 -
35 RCL 2
36 X^2
37 /
38 STO 3     # calculate and store f''(x)
39 RCL 4
40 RCL 5
41 -
42 RCL 2
43 /
44 2
45 /         # calculate f'(x)
46 RCL 3
47 /         # calculate diff
48 STO- 1    # x = x - diff
49 ABS
50 RCL 0
51 X<=Y?
52 GTO 0
53 RCL 1
54 RTN
55 LBL E
56 EXP
57 LASTX
58 X^2
59 3
60 *
61 -
62 RTN

Usage

LBL E has the code for the function whose minimum or maximum you seek.

1) Enter the tolerance and press [ENTER].
2) Enter a guess for the minimum/maximum and pres [A].
3) The program pauses showing intermediate values for the refined min/max values. When the program has reached the tolerance level it displays the value of the X for the min/max value.
 « Next Oldest | Next Newest »

 Messages In This Thread Finding Min/Max of a function for HP-67 - Namir - 03-10-2014 05:48 PM RE: Finding Min/Max of a function for HP-67 - Matt Agajanian - 04-26-2014, 12:30 AM RE: Finding Min/Max of a function for HP-67 - Willy R. Kunz - 05-26-2014, 12:14 PM RE: Finding Min/Max of a function for HP-67 - Thomas Klemm - 05-26-2014, 10:13 PM RE: Finding Min/Max of a function for HP-67 - Willy R. Kunz - 06-08-2014, 04:08 PM RE: Finding Min/Max of a function for HP-67 - PedroLeiva - 05-21-2016, 10:50 PM RE: Finding Min/Max of a function for HP-67 - Dieter - 05-22-2016, 01:11 AM RE: Finding Min/Max of a function for HP-67 - PedroLeiva - 05-22-2016, 01:26 AM RE: Finding Min/Max of a function for HP-67 - Dieter - 05-22-2016, 07:34 PM RE: Finding Min/Max of a function for HP-67 - PedroLeiva - 05-22-2016, 10:35 PM RE: Finding Min/Max of a function for HP-67 - Dieter - 05-23-2016, 01:08 PM RE: Finding Min/Max of a function for HP-67 - PedroLeiva - 05-23-2016, 07:37 PM RE: Finding Min/Max of a function for HP-67 - bshoring - 05-23-2016, 08:00 PM RE: Finding Min/Max of a function for HP-67 - rprosperi - 05-26-2014, 10:13 PM RE: Finding Min/Max of a function for HP-67 - bshoring - 05-24-2016, 06:47 AM RE: Finding Min/Max of a function for HP-67 - bshoring - 05-28-2016, 08:09 PM RE: Finding Min/Max of a function for HP-67 - PedroLeiva - 05-28-2016, 09:43 PM

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