HP 15c User Manual

Page 137

Advertising
background image

Section 4: Using Matrix Operations

137

N

Determines the maximum number of iterations that the program will attempt in each
of two procedures: the bounding search and the overall optimization procedure. That
is, the program halts if the bounding search finds no change of sign within N
iterations. Also, the program halts if the norm of the gradient is still too large at x

N

.

Each of these situations results in an Error 1 display. (They can be distinguished by
pressing −.) You can continue running the program if you desire.

The program requires that you enter a subroutine that evaluates f(x) and

f(x). This

subroutine must be labeled "E", use the vector x stored in matrix A, return the gradient in
matrix E, and place f(x) in the X-register.

In addition, the program requires an initial estimate x

0

of the desired critical point. This

vector must be stored in matrix A.

The program has the following characteristics:

The program searches for any point x where

f(x) = 0. Nothing prevents convergence

to a saddle-point, for example. In general, you must use other means to determine the
nature of the critical point that is found. (Also, this program does not address the
problem of locating a maximum or minimum on the boundary of the domain of f(x).)

You may adjust the convergence parameters after starting the program. In many cases,

this dramatically reduces the time necessary for convergence. Here are some helpful
hints:

If the program consistently enters the interval reduction phase after sampling only

one point u

1

, the initial step size may be too large. Try reducing the magnitude of d

to produce a more efficient search.

If the results of the bounding search look promising (that is, the slopes are

decreasing in magnitude), but then begin to increase in magnitude, the search may
have skipped past a critical point. Try reducing a to produce more close sampling;
you may have to increase N also.

You can replace ¦ at line 102 with © or perhaps delete it entirely if you have

no interest in the intermediate results.

For a function of n variables, the program requires 4n+1 registers devoted to matrices.

Keystrokes

Display

Program mode.

´CLEARM

000-

´b8

001-42,21, 8

Routine to swap A and C using
E.

l>C

002-45,16,13

O>E

003-44,16,15

l>A

004-45,16,11

O>C

005-44,16,13

l>E

006-45,16,15

O>A

007-44,16,11

Advertising