Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Mathematica as an Object' topicStudent Support Forum > General > Archives > "Mathematica as an Object"

Next Comment >Help | Reply To Topic
Author Comment/Response
David Revelt
01/31/99 3:53pm

Greetings,

I am writing a statistics program that needs to integrate a function over and
over again. The quickest method to do this within Mathematica is to integrate
it once symbolically and then evaluate it at different points. The evaluation
is non-trivial however since the solution to the symbolic integral is a poly-
nomial with potentially over 100 terms.

Since I am using a large data set, I would like to call Mathematica as an
external program from Gauss. In short, I would like to call Mathematica once
to have it integrate my function symbolically, and then repeatedly call
Mathematica from within Gauss whenever I need to evaluate this integral. (The Gauss routine will be doing Newton-Raphson maximization.)

The problem is that from my reading of the MathLink documentation, it seems
that Mathematica can only be called as a function. That is, I can call it to
perform some operation and then it disappears from memory. Is there anyway
that I can treat Mathematica like an object where it will symbolically integrate
my function upon construction and then evaluate this polynomial whenever
I message it? That is, I don't want the Mathematica process to disappear
from memory whenever I am done evaluating the symbolic integral because then
I will have to re-integrate it the next time I want to evaluate it. Is there
a way that Mathematica can sleep, holding in memory the solution to the symbolic
integral, and ready to wake up and evaluate the integral when called?

(One solution I have already thought of is to have Mathematica print out the
symbolic integral to a file in CForm[], and then call the C function whenever
I need to evaluate it. This solution is not optimal however for reasons
that you don't really want to know about.)

Thanks for your help.

David

URL: ,

Subject (listing for 'Mathematica as an Object')
Author Date Posted
Mathematica as an Object David Revelt 01/31/99 3:53pm
Re: Mathematica as an Object Forum Modera... 02/06/99 12:36pm
Next Comment >Help | Reply To Topic