MathGroup Archive 2001

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

Search the Archive

Re: Mathlink and BorlandC++

  • To: mathgroup at
  • Subject: [mg30435] Re: [mg30391] Mathlink and BorlandC++
  • From: Omega Consulting <omega_consulting at>
  • Date: Sat, 18 Aug 2001 04:04:59 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

At 12:03 AM 8/15/2001, konraad dullaert wrote:
>I'm writting a program in Borland where I need to solve a differential
>equation (have to use NDSolve).
>After opening a link to Mathlink, you have to put the function that you want
>to use.
>         MLPutFunction (alink, "NDSolve, 3)
>But how do I send the two equations (namely the differential equation and the
>initial value) and the interval in which the equation has to solved to the
>Mathematica Kernel?
>Thanks for the effort,

You have to send the full expression out on the link piece by piece. Take 
the following.


To see the full expression, use FullForm



Or maybe TreeForm works better for you.


So you would do the following

MLPutFunction (alink, "NDSolve", 3);
   MLPutFunction (alink, "List", 2);
     MLPutFunction (alink, "Equal", 2);
       MLPutFunction (alink, "D", 2);
         MLPutFunction (alink, "y", 1);
           MLPutSymbol(alink, "x");
         MLPutSymbol (alink, "x");
       MLPutFunction (alink, "y", 1);
         MLPutSymbol(alink, "x");
     MLPutFunction (alink, "Equal", 2);
       MLPutFunction (alink, "y", 1);
         MLPutInteger(alink, 1);
       MLPutInteger (alink, 2);
   MLPutSymbol (alink, "y", 1);
   MLPutFunction (alink, "List", 3);
     MLPutSymbol(alink, "x");
     MLPutInteger(alink, 0);
     MLPutInteger(alink, 3);

If you're uncomfortable with FullForm, you can send an InputForm string and 
have M_ turn it into an expression with the ToExpression command.

MLPutFunction (alink, "ToExpression", 1);
   MLPutString(alink, "NDSolve[{D[y[x],x]==y[x],y[1]==2},y,{x,0,3}]");

  • Prev by Date: Re: byte[ ] of J/Link
  • Next by Date: Re: Re: Rotation3D, MatrixRotation3D ?
  • Previous by thread: Re: Mathlink and BorlandC++
  • Next by thread: AW: problems with lists