RE: Repeated calls to Mathematica process

*To*: mathgroup at smc.vnet.net*Subject*: [mg15710] RE: [mg15705] Repeated calls to Mathematica process*From*: "ELLIS, Luci" <EllisL at rba.gov.au>*Date*: Fri, 5 Feb 1999 03:42:11 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Hi, A couple of ideas: * Solve the integral, format the output as FortranForm, and paste this code into your Gauss routine to be evaluated there. This means Gauss needs to do the evaluation of the integrated expression. This should be ok if the result doesn't involve special functions or special Mathematica commands that Gauss can't cope with. There is an article in Hal Varian's book "Economic and Financial Modelling with Mathematica" by Stephen J Brown, "Nonlinear Systems Estimation: Asset Pricing Model Application" that deals with the interaction between Gauss and Mathematica in detail; or * Leave Mathematica open. * At the end of the first Mathematica session, use DumpSave[] to save the result from the integration in internal Mathematica format to a file. Then in each subsequent Mathematica session, you can just read in the result from the file instead of recalculating the integral. Using DumpSave instead of Save generates non-human-readable files, but it's MUCH faster reading it back into Mathematica. * Of course, life would be easier if Mathematica's large-data-set handling was as efficient as Gauss's. (this is a hint about the next version and its suggested capabilities) Then you wouldn't need Gauss. And the world would be a better place (-: Hope this helps, Regards, Luci ____________________________________________________ Luci Ellis ph:61-2-9551-8881 Acting Senior Economist fx:61-2-9551-8833 Financial & Monetary Conditions ellisl at rba.gov.au Economic Analysis Department GPO Box 3947 Reserve Bank of Australia Sydney NSW 2001 -----Original Message----- From: reveltd at leland.stanford.edu [mailto:reveltd at leland.stanford.edu] To: mathgroup at smc.vnet.net Subject: [mg15710] [mg15705] Repeated calls to Mathematica process *** This E-Mail has been checked by MAILsweeper *** Greetings, I have an integral function which I need to maximize. The maximization procedure requires many evaluations of this function. The fastest way for me to evaluate this function is to integrate it symbolically once and then evaluate it repeatedly as the parameters change in the maximization routine. Since I have a large data set, I am using Gauss to maximize this function, and the Gauss procedure can call the Mathematica process. What I don't know how to do is to maintain the memory state of the Mathematica process as I move back and forth to Gauss. That is, I want to symbolically integrate the function once, then do some work in Gauss, and then come back to Mathematica to evaluate the function. But once I exit the mathematica process, I will lose the symbolic solution to my integral. In short, I want to treat the Mathematica process like an object (rather than a function) which performs the symbolic integration upon construction, remains in memory while I do other things, and then evaluates it whenever I message it. Short of reading and writing back and forth to files (which is expensive time-wise) is there any way to hold the memory state of a Mathematica process while I do the work in Gauss? Thanks David