Re: Deriviation
- To: mathgroup at smc.vnet.net
- Subject: [mg70086] Re: Deriviation
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 3 Oct 2006 06:16:26 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <efq53o$228$1@smc.vnet.net>
Karsten Ohme wrote: > Hello, > > I have the following problem, e.g. I derive a function like: > > In[1]:= > f[x] = x^2; > > In[2]:= > D[f[x], x] > Out[2]= > 2 x > > Quite well, but now I want to use it in my own application, so I look > for a free library written in Java (or C) which can do also a symbolic > derivation outside Mathematica. Is there something like this? > > Thanks, Karsten > Hi Karsten, Within a Mathematica notebook, you can use functions such as CForm [1] to get a get a translation of the Mathematica expression to a C expression: In[1]:= f[x] = x^2; D[f[x], x] CForm[%] Out[2]= 2 x Out[3]//CForm= 2*x You can also ask Mathematica to process a source or document file written, say in C or any other languages, that includes Mathematica code, with the Splice function. See [2] for an example in C. Regards, Jean-Marc [1] http://documents.wolfram.com/mathematica/functions/CForm [2] /The Mathematica Book/, Section 1.11.9, "Splicing Mathematica Output into External Files" http://documents.wolfram.com/mathematica/book/section-1.11.9