HP 39gii Programming Tutorial  Part 8: Functions as Arguments
Apologies for the delay.
In part 8, I will show you several was you can use functions as arguments in programs. First, some pointers to help make the programming experience less daunting:
1. The HP 39gii is not a CAS machine. Everything must be evaluated to a number.
2. Functions are entered either as strings (expressions surrounded by quotation marks) or by the use of the QUOTE command. The QUOTE command can be found by pressing [Math], [ 1 ], [ 2 ]. It may help to store the required equation/function in E#/F# first before running the program, which is the case with PARTDER.
3. When using HP mathematical commands, you may have to store passthrough variables into global variables first. I am not sure why this is true for some commands but not for others.
4. The use of expressions and functions don't always work in programming. Use caution. I have particular trouble with SOLVE and FNROOT in this situation.

Note: Recall there are two ways to store objects, one the store arrow ( →) and the assign operator ( := ). I usually code the latter, but for most applications, either way is acceptable. I use both methods in today's programming examples. And yes, we can use both methods in one program.
Hint: I often test commands and their usage at the Home screen to get a better understanding on how mathematical commands work. I also note their syntax by both using the command and accessing the help menu ([SHIFT] [Views]).

The Program PARTDER
PARTDER takes the partial derivatives of the function f(X,Y) at the point (x, y) and returns a list of the values {df/dx, df/dy}.
PARTDER takes two passthrough arguments:
x = value of x
y = value of y
Define f(X,Y) as a string into E0 outside the program.
EXPORT PARTDER(a,b)
BEGIN
a → A; b →Y; ∂(E0, X=A) → C;
b → B; a → X; ∂(E0, Y=B) → D;
RETURN {C, D};
END;
Examples:
"SIN(X*Y)+Y^2"→E0
PARTDER(π, 1) returns { 1, 1.14159265359 }
QUOTE(X^(2*Y+1))→E0
PARTDER(4,1) returns {48, 177.445678223}
Eddie
This blog is property of Edward Shore. 2013
A blog is that is all about mathematics and calculators, two of my passions in life.
Tuesday, April 23, 2013
HP 39gii Programming Tutorial  Part 8: Functions in Programs
Subscribe to:
Post Comments (Atom)
Eclipse and HHC 2017
Eclipse On August 21, 2017 there will be a solar eclipse. Totality (where the moon completely covers the sun) will occur in the northern...

Casio fx991EX Classwiz Review Casio FX991EX The next incarnation of the fx991 line of Casio calculators is the fx991 EX. ...

TI36X Pro Review This is a review of the TI36X Pro Calculator by Texas Instruments. History Originally, this was the TI30X Pro that w...

One of the missing features of the TI82/83/84 family is the ability to convert between bases. Here are two programs in TIBasic to help...
thanks for this part 8 Hp30gii programming tutorial . I am learning , this will help a lot not just for me but for all the people :)
ReplyDeletehttp://merlenemath.com/
Much appreciated, Jason.
Delete