Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!decwrl!shlump.nac.dec.com!jareth.enet.dec.com!edp From: edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) Newsgroups: comp.sys.handhelds Subject: Re: OBGET and EXGET Message-ID: <12069@shlump.nac.dec.com> Date: 30 May 90 21:16:21 GMT References: <3ahdinw01@ULKYVX.bitnet> Sender: newsdaemon@shlump.nac.dec.com Reply-To: edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) Organization: Digital Equipment Corporation Lines: 36 I don't think OBGET and EXGET are in the HP-48. They are replaced by OBJ-> which, for an algebraic input, returns to the stack the "outermost" function (e.g., "+" in '3+4*5'), the number of arguments of that function, and the arguments. Then you can further decompose the arguments by using OBJ-> again, so you can completely take apart and reconstruct an algebraic. This operation is one of the things I (and probably others) asked HP for; it is a natural way to work with algebraic expressions. The OBGET and EXGET operations had a shortcoming in that you could not use them to take apart and reconstruct algebraics without additional information. Viz., I think there exist expressions for which EXGET and other HP-28 operations cannot be used to determine which subexpressions are arguments of which functions unless your program has knowledge of which functions are infix or prefix and how many arguments they take -- so you would need something like built-in tables of functions in order to write a general algebraic manipulation program. You can get TRG* in a program with { 'EXP(&A)' 'COS(&A/i)+SIN(&A/i)*i' } ^MATCH. This will look for EXP applied to any expression and will convert it to the trigonometric definition. I think it may perform multiple expansions if the expressions appear disjointly in the original; you can defeat that by taking apart the expression first and presenting only pieces to ^MATCH. On the other hand, if you want to replace all occurrences, you need to call ^MATCH repeatedly until it indicates there are no more matches. You can use the RULES menu to find the appropriate match pattern. Just create an expression with &A in it, such as 'SIN(&A)', or &B . . . if there are more than one different subexpression. Then invoke RULES and transform it as you please. ->DEF changes the above to '(EXP(&A*i)-EXP(-(&A*i)))/(2*i)'. Incorporate the result in a list with the original expression, and use ^MATCH. -- edp