Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!vmsdev.enet.dec.com!edp From: edp@vmsdev.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) Newsgroups: comp.sys.handhelds Subject: Re: Building an Algebraic Message-ID: <12965@shlump.nac.dec.com> Date: 29 Jun 90 11:57:33 GMT References: Sender: newsdaemon@shlump.nac.dec.com Reply-To: edp@vmsdev.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) Organization: Digital Equipment Corporation Lines: 21 > I would like to build an algebraic expression from within a program. > What I want to do is something like: > Pull 2 from the stack, then pull 3 from the stack and make '2*S^3' , > so then I could take the derivative of it. If two algebraic objects (including simple numbers and names) are on the stack (call them a and b), you can form the algebraic a*S^b with the following: << "*S^" SWAP + + "'" SWAP + OBJ-> >> or with: << 'S' SWAP ^ * >> The former is longer, but does not do some of the evaluations you get in the latter case. E.g., if a is 0, the latter program will return 0, but the former will return 0*S^b. -- edp