       Difference between Mathlink and frontend output

• To: mathgroup at smc.vnet.net
• Subject: [mg14754] Difference between Mathlink and frontend output
• From: Jim McGuire <jimm at opticalres.com>
• Date: Thu, 12 Nov 1998 02:17:52 -0500
• Organization: Optical Research Associates
• Sender: owner-wri-mathgroup at wolfram.com

```I am reading a function from a package into a Mathlink which defines the
function

xx[a_, b_List, c_List, d_, e_,  f_] :=
x[a] /. xxRules[b, c, d, e,  f]

where xxRules is the result of a rather complicated NDSolve.  When I
read the package into a Mathematica session and evaluate the function

Get["D:\\jimm\\svgcn018\\TED.m"];
xx[0.5, {0.5, 1.2566370362}, {0.000001, 60}, 1000, 100, 0]

I get the expected numerical result.  However, when I try the same thing

// constants for mathematica calls
double phiBound[]={0.5, 1.2566370362};	// array of starting + ending phi
values
double xBound[]={0.000001, 60.};	// array of starting + ending x values
double H=1000.;                         // distance between source
pupil plane
double rStart=100.;                     // distance from source to ID of
collector
int n=0;                                // number of iterations for
reflectivity

MLPutFunction(stdlink,"EvaluatePacket",1);		 // start evaluation
packet
Mathematica definitions

// Read and discard data until an error or return packet is found
while ((pkt = MLNextPacket(stdlink)) && pkt != RETURNPKT)
MLNewPacket(stdlink);     // discard NULL symbol returned from GET

MLPutFunction(stdlink,"EvaluatePacket",1);			   // call Mathematica
function
MLEndPacket(stdlink);			                    // end of Mathematica
input

// Read and discard data until an error or return packet is found
while ((pkt = MLNextPacket(stdlink)) && pkt != RETURNPKT)

printf(str);

I get the the unevaluated InterpolatingFunction

InterpolatingFunction[{{0.5,1.25663703619999989058442}}, <>][0.5]

I assume that the FrontEnd is forcing the evaluation and I am not with
the MathLink code.  Any suggestions?