Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: Mathematica <-> fortran

  • To: mathgroup at
  • Subject: [mg9156] Re: Mathematica <-> fortran
  • From: Paul Abbott <paul at>
  • Date: Thu, 16 Oct 1997 03:37:57 -0400
  • Organization: University of Western Australia
  • Sender: owner-wri-mathgroup at

hashemi at wrote:

>         I would like to know if there is any way to call mathematica
> functions (like Bessel Functions) from a FORTRAN program and vice-versa (i.e.,
> to use mathematica to compute some functions in my own FORTRAN program). 

If you are using Unix you could use InterCall.  See below for more
information.  InterCall is a Mathematica package designed to make it
easy to link Mathematica and
fortran.  See

> Also, is there anyway to compute Mathieu, Weber, and Spheroidal functions of 
> complex argument using mathematica and subsequently use these values in our 
> FORTRAN code?

Mathieu functions of complex argument are built-in to Version 3.0:

In[1]:= ?MathieuC
	"MathieuC[a, q, z] gives the even Mathieu function with characteristic
	 a and parameter q."

In[2]:= ?MathieuS
	"MathieuS[a, q, z] gives the odd Mathieu function with characteristic
value a
	and parameter q."

Yn(z) is referred to as the Bessel function of the second kind, the
Weber function, or the Neumann function (denoted Nn(z)). BesselY is

Spheroidal harmonics are not built-in.  However, last year I wrote some
Mathematica code for computing the (angular prolate) spheroidal
harmonics by expanding the solutions to the differential equation into
a basis of associated Legendre functions.   This code is short and
computationally quite efficient and appeared in The Mathematica
Journal, 7(1): 18-22.

You could use InterCall or MathLink to call Mathieu or Weber functions
from fortran code.  


Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul at  AUSTRALIA                   

            God IS a weakly left-handed dice player


                               I n t e r C a l l

What is InterCall?

InterCall is a Mathematica package that provides:

o easy access to all the routines in the NAG, IMSL, LINPACK, MINPACK and

  ITPACK subroutine libraries.
o interactive access to any other library or user-written code. o
straightforward declaration of default settings for arguments in

With InterCall you can:

o import routines written in Fortran, C, or Pascal and call them as if
  were Mathematica functions.
o call external routines on a remote computer. o develop and test the
robustness and correctness of external libraries. o write your own
interface to other external libraries.

Why Use InterCall?

o To extend the type of problems that Mathematica can solve. o The full
scope of routines in standard numerical libraries become 
  available to Mathematica users.
o Intelligent defaults are supplied automatically by InterCall when you 
  call an external routine.
o Inspecting and modifying defaults is simple and uses commands named
  GetDefault and SetDefault.
o Independent documentation, for calling external routines from within
  Mathematica, is not required. 

Who Should Use InterCall?

o Anyone whose work involves numeric processing and who wants 
  Mathematica's ease of use.
o Mathematica users who need to access numerical libraries on a 
  remote machine.
o Current users of numerical libraries who want a simple development 
o Teachers of courses such as numerical methods.  o Engineers,
scientists, economists, physicists, mathematicians, 
  statisticians etc.

How Does One Use InterCall?

  Loads the InterCall package                  In[1]:= <<InterCall`;
  Load the numerical library databases         In[2]:= <<InterData`;

  Import IMSL's dqdag integration routine      In[3]:=  GetDefault[dqdag
  The ouput indicates the calling syntax       Out[3]=  dqdag[$F_, $A_,
$B_] ->
  Integrate Sin[x] from x = 0 to x = Pi        In[4]:=  dqdag[ Sin[#]&,
0, Pi ]
  using IMSL.                                  Out[4]=  2.

  Import IMSL's devasb routine for finding     In[5]:=  GetDefault[
devasb ]
  eigenvalues of a band-symmetric matrix.      Out[5]=  devasb[$A_] ->
  Define a band-symmetric  matrix.             In[6]:=  matrix =

  Find the three smallest eigenvalues.         In[7]:=  devasb[ matrix, 
  (NEVAL is documented in the IMSL manual)                     $NEVAL

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.

System Requirements:

InterCall runs under Mathematica version 3, and requires a Unix kernel
or a Macintosh with a TCP/IP network connection. 

Remote drivers to access external code on a remote computer are
available for Alliant, CrayC90, CrayYMP, CM2sun, CM5sun, Convex, DEC,
HP9000, HP9000_RISC, HP9000S700, IBMRS6000, NeXT, Sequent,SGI, Solaris,
SPARC, VAX, VP.  A driver 
for DEC Alpha (OSF) is under development.

InterCall includes:

o all the files needed to run InterCall on your computer. o various
remote drivers (available upon request) o a detailed TeX manual
describing how to use InterCall with Notebook examples 

InterCall is distributed by a number of methods:

 o email/ftp with TeX manuals              $275                 $475   
 o email/ftp with manuals sent by post     $300                 $500
 o tar or Mac formatted disk               $315                 $515
   with printed manuals sent by post
 o full installation done by rlogin        $375                 $575
   via internet - printed manuals post                

For more information on InterCall, please contact:

PO Box 522
Nedlands, WA 6909
Phone/Fax   +61 8 9386 5666

Email: john at

InterCall was developed by:

Dr. Terry Robb
Wolfram Research

  • Prev by Date: Re: Working with large data files (hundreds of megas)
  • Next by Date: Re: ComplexExpand and FontSize
  • Previous by thread: Re: Mathematica 2.2 sound export
  • Next by thread: Re: ComplexExpand and FontSize