Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Previous section-----Next section

1.11.9 Splicing Mathematica Output into External Files

If you want to make use of Mathematica output in an external file such as a program or document, you will often find it useful to "splice" the output automatically into the file.

Splice["file.mx"] splice Mathematica output into an external file named file.mx, putting the results in the file file.x
Splice["infile", "outfile"] splice Mathematica output into infile, sending the output to outfile

Splicing Mathematica output into files.

The basic idea is to set up the definitions you need in a particular Mathematica session, then run Splice to use the definitions you have made to produce the appropriate output to insert into the external files.

#include "mdefs.h"

double f(x)
double x;
{
double y;

y = <* Integrate[Sin[x]^5, x] *> ;

return(2*y - 1) ;
}

A simple C program containing a Mathematica formula.

#include "mdefs.h"

double f(x)
double x;
{
double y;

y = -5*Cos(x)/8 + 5*Cos(3*x)/48 - Cos(5*x)/80 ;

return(2*y - 1) ;
}

The C program after processing with Splice.


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: