With InterCall you can:
Load the InterCall package
In[1]:= <<InterCall.m;
Loading InterCall version 2.1.
Copyright (c) 1992-93 T. D. Robb.
Connect to a computer that has the NAG subroutine library
In[2]:= InterCall["sollya.maths.uwa.edu.au -l abbott"];
Note that computers anywhere on the internet can be specified.
Load the NAG library defaults database
In[3]:= <<InterData.m
Suppose that you want to integrate the oscillatory function x cos(30x)
sin(x) from 0 to 2Pi. First use "find" to locate an appropriate NAG
routine:
In[4]:= find["quadrature" && "finite" && "one" && "oscil"]
D01AKF (NAG)
One-dimensional quadrature, adaptive integration over a finite
interval, method suitable for oscillating functions.
Check the default values for d01akf:
In[5]:= GetDefault[d01akf]
D01AKF[ (* TYPE=S *)
$F -> In, (* DATA=RF[R] *)
$A -> In, (* DATA=R *)
$B -> In, (* DATA=R *)
$EPSABS -> 0., (* DATA=R *)
$EPSREL -> 0.00001, (* DATA=R *)
$RESULT :> Out, (* DATA=R *)
$ABSERR :> d01akf`abserr, (* DATA=R *)
$W :> Null, (* DATA=R[$LW] *)
$LW -> 2000, (* DATA=I *)
$IW :> Null, (* DATA=I[$LIW] *)
$LIW -> $LW/8 + 2, (* DATA=I *)
$IFAIL -> -1 (* DATA=I *)
] (* CODE="LIBRARY" *)
Out[5]= d01akf[$F_, $A_, $B_] -> $RESULT
This indicates that the user only has to supply $F (the function), $A (the
lower integration limit), and $B (the upper integration limit). Other
parameters such as $EPSREL have been assigned default values (here
0.00001).
Compute the integral of x Cos[30x] Sin[x] from 0 to 2Pi:
In[6]:= d01akf[ Function[x, x Cos[30x] Sin[x]], 0, 2Pi ]
InterCall::opened: Opened connection to host sollya
InterCall::import: Importing: {D01AKF}
InterCall::linked:
Using remote driver version 2.0 on host sollya
Out[6]= 0.006989082655373541
Here the function x Cos[30x] Sin[x] is being "emulated" using Mathematica.
Alternatively you can pass compiled fortran or C directly to d01akf from
within Mathematica.
Here is the absolute error in the last integral
In[7]:= d01akf`abserr
-14
Out[7]= 4.399258735077181 10
InterCall completely integrates the symbolic capabilities of
Mathematica with the numeric routines of any external library. You can
pass a Mathematica function, array, or any other expression, as an
argument to any external routine and InterCall will send the correct
type of information to that external routine.
Remote drivers to access external code on a remote computer are available for Apollo, Connection Machine, Convex, DEC/Ultrix, HP9000, IBM RISC, Iris, Sparc, Sun-3 and VAX/VMS. Drivers for AViiON, MIPS and Sony are under development.
For more information on InterCall contact:
Analytica International Pty Ltd PO Box 522 Nedlands, WA 6909 Australia Phone: +61 (0)8 9357 5027 Fax : +61 (0)8 9388 0885InterCall was developed by:
Dr. Terry Robb