Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site randvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!tektronix!hplabs!sdcrdcf!randvax!George J. Carrette From: George J. Carrette Newsgroups: net.math.symbolic Subject: Re: Speeding up Macsyma Message-ID: <2667@randvax.UUCP> Date: Mon, 26-Aug-85 13:21:40 EDT Article-I.D.: randvax.2667 Posted: Mon Aug 26 13:21:40 1985 Date-Received: Sun, 1-Sep-85 12:53:57 EDT References: <2666@randvax.UUCP> Sender: lseward@randvax.UUCP Distribution: net Organization: Rand Corp., Santa Monica Lines: 30 The Macsyma command FORTRAN can indeed create fortran code fragments from symbolic expressions in macsyma. These can be edited into a fortran function or main program. The FORT command in MAX$DISK:[LPH]FORT.MC (in the DOE-MACSYMA release) gets rid of the editing step in many cases by generating the FUNCTION, RETURN, and END statements for you. However, even that may not be worth the bother if you only want reasonable efficiency in numerical code for calling the 3-D plot command or contourplot or the ROMBERG numerical integrator, all of which may evaluate a given expression many many times. The use of the Macsyma->Lisp translator and Lisp->Machine-code compiler may be all that is required. Here is an example from the PLOT DEMO: (X^3+Y^4-0.2*X)*EXP(-X^2-Y^2)+0.3*EXP(-(X-1.225)^2-Y^2); PLOT3D(%,X,-3,3,Y,-3,3)$ If instead we define a function: F(X,Y):=(MODE_DECLARE([X,Y],FLOAT), (X^3+Y^4-0.2*X)*EXP(-X^2-Y^2)+0.3*EXP(-(X-1.225)^2-Y^2)); And: TRANSLATE(F); COMPILE(F); Then the PLOT3D will go noticably faster as PLOT3D(F(X,Y),X,-3,3,Y,-3,3); Files of Macsyma source code are translated and compiled with the TRANSLATE_FILE and COMPILE_LISP_FILE commands. -gjc