HUBER@gacvx1.gac.edu (01/14/91)
I want to evaluate derivatives of two numbers which have units, however the HP-48 chokes on some of the intermediate calculations because it plugs in the units before eliminating terms which have multiplication by zero. For example, if the variables X and T are NOT define, then when I evaluate 'X/T' 'T' \136 (where \136 is the deriviative operator) it correctly evaluates to -(X/T^2) with symbolic mode ON. It will also calculate correctly if X & T are defined without units (for example, for X=2 and T=3 it evaluates to -0.22222) However, if the variables X and T are defined as X = 2_m T = 3_s Then when I evaluate 'X/T' 'T' \136 (where \136 is the derivative operator) it comes up with "- Error : Inconsistant Units". Apparently, it evaluates d/dT (X/T) as (T*(dX/dT) - X*(dT/dT))/T^2 and thus the two terms T*0 and X*1 will have different units. This happens with both SYM mode on or off. In a program, is there any way (in general) to have the '48 reduce an expression algebraically BEFORE it plugs in the values? Thanks! Tom Huber, Physics Department Gustavus Adolphus College, St. Peter, MN 56082 Bitnet: HUBER@GACVAX1 Internet: HUBER@GAC.EDU (507)933-7036
billw@hpcvra.cv.hp.com. (William C Wickes) (01/15/91)
In general, you can avoid this kind of problem by keeping your variables formal (i.e. undefined) until after the algebra is done, then substituting values in at the end. For your particular example with differentiation involving units, the following procedure will work: 'X' RCL 'T' RCL \-> x t \<< { X T } PURGE 'X/T' X \.d x 'X' STO t 'T' STO EVAL \>> Of course, this can be generalized to arbitrary calculations. Bill Wickes HP Corvallis