MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help Needed: How to use a Notebook from an external Program via Mathlink?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20243] Re: Help Needed: How to use a Notebook from an external Program via Mathlink?
  • From: "P.J. Hinton" <paulh at wolfram.com>
  • Date: Fri, 8 Oct 1999 18:30:18 -0400
  • Organization: "Wolfram Research, Inc."
  • References: <7tgre3$si9@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 6 Oct 1999, Ulrich Klein wrote:

> I am a Mathematica beginner (so perhaps the question is not hard at all)
> and I have to develop a software for a couple of tasks, some of them
> being numerical evaluations of differential equations (e.g.).
> 
> I have to decide whether
> 1. to write the software monolithically OR
> 2. to use Mathematica for easy definition of the differential equations to
>    be solved
> 
> QUESTION(S):
> Can I use Mathematica to specify the eqations / systems to be solved,
> sending only parameters from my main program via Mathlink?

It's not clear what you mean by "using Mathematica to define differential
equations" and sending parameters to Mathematica by way of MathLink.

If you are trying to use the Mathematica kernel as a back end that will
solve many differential equations with either DSolve[] or NDSolve[], and
the differential equations have the same generic form, it should be
possible to define a function in Mathematica such as this.

solveMyDiffEq[a_, b_, c_] := 
  DSolve[a y'[t] + b [y] + c == 0, y, t]  

As part of initializing the backend kernel, you would load this definition
from a file, just as you would any other Mathematica package.  You could
then use MathLink API calls to MLPutFunction(), followed by calls to put
whatever data types that a, b, and c happen to be.

> Can I tell Mathematica to load and use a pre-defined notebook (with my
> definitions)?

Yes, but you won't tell Mathematica to load the notebook.  Instead, you
will want to use the front end to export out the contents of your
notebook's evaluatable cells as a Mathematica package.  I've posted an
article or two on how to do this effectively.  You can retrieve one of
them from deja.com here:

	http://x40.deja.com/getdoc.xp?AN=374425001

--
P.J. Hinton
Mathematica Programming Group           paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.




  • Prev by Date: Re: Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica
  • Next by Date: Re: Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica
  • Previous by thread: Help Needed: How to use a Notebook from an external Program via Mathlink?
  • Next by thread: Inverting a non-square matrix