[comp.sys.handhelds] Numerical Integration on the HP48

wjc@llex.ll.mit.edu ( Bill Chiarchiaro) (06/06/91)

I have a version E HP48SX and have been trying to get it to
numerically integrate a program object (rather than an algebraic).  I
used to be able to do this on my HP28S, and it was actually useful.
Integration of a program was faster than integration of the
corresponding algebraic expression.  Also, if the definition of the
integrand changed over the range of the variable of integration, then
that could be handled simply by a conditional.  The algebraic object
equivalent would be to split the integration into two or more
integrations and to combine the results.

If I put limits of integration in stack levels 3 and 4, a program
object in level 2, and a quoted name in level 1, I get a "Bad Argument
Type" error when I hit the integral key.  This is in spite of the fact
that the USAG program claims that the integrand can be of any type.  I
have tried storing the program in a variable and putting the
variable's quoted name in level 2.  I tried this in combination with
various settings of flags -2 and -3 and with the specified variable of
integration either existing or not existing as a global variable.  In
some cases, the 48 did not complain and was clearly seeing the program
object, but it never gave a correct result.

I haven't found an answer in the manuals, and the HP Calculator
Support line has not been helpful.

Any ideas?


Thanks,

Bill Chiarchiaro
wjc@ll.mit.edu

edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) (06/06/91)

In article <1991Jun5.192839.4847@ll.mit.edu>, wjc@llex.ll.mit.edu ( Bill
Chiarchiaro) writes:

>I have a version E HP48SX and have been trying to get it to
>numerically integrate a program object (rather than an algebraic).

>If I put limits of integration in stack levels 3 and 4, a program
>object in level 2, and a quoted name in level 1, I get a "Bad Argument
>Type" error when I hit the integral key.

Put the following on the stack:
	lower upper 'expression' variable

In the expression, calls to programs should appear in the form:
	name(arguments)

The program should have the form:
	<< -> local variable names << program code >> >>

I tried this with:
	2 3 'S(X)' 'X'

while S contained \<< \-> X \<< X SQ \>> \>>, and it worked. giving the
correct result (6.333...).


				-- edp (Eric Postpischil)
				"Always mount a scratch monkey."
				edp@jareth.enet.dec.com

wjc@llex.ll.mit.edu ( Bill Chiarchiaro) (06/07/91)

Thanks to Eric Postpischil (edp@jareth.enet.dec.com) for showing how
to numerically integrate a program object on the HP48.  However, I
found it is necessary to have flag -3 set in order for evaluation to
proceed to a numeric result.

Bill Chiarchiaro
wjc@ll.mit.edu

edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) (06/07/91)

In article <1991Jun6.175351.11032@ll.mit.edu>, wjc@llex.ll.mit.edu (
Bill Chiarchiaro) writes:

> However, I found it is necessary to have flag -3 set in order for
>evaluation to
> proceed to a numeric result.

Or just press ->NUM.


				-- edp (Eric Postpischil)
				"Always mount a scratch monkey."
				edp@jareth.enet.dec.com