       Re: exporting a list of functions for use in a C function

• To: mathgroup at smc.vnet.net
• Subject: [mg44361] Re: exporting a list of functions for use in a C function
• From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
• Date: Fri, 7 Nov 2003 05:16:05 -0500 (EST)
• Organization: Universitaet Leipzig
• References: <bob7qo\$qu1\$1@smc.vnet.net>
• Reply-to: kuska at informatik.uni-leipzig.de
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

you don't like to use CForm[] and you don't like to use
the pow() function of your C-library ??

Strange ...

Regards
Jens

Nathan Moore wrote:
>
> I've composed a large list of functions in Mathematica that I'd like to
> have a c function evaluate.  To my knowledge c and C++ reject the
> convention x^2 and prefer either x*x or pow(x,2).  The functions are
> integer powers of a single variable.  I'm using the command,
>
> Export["function_list.txt", Table[gflist[p], {p, 2, 5}], "CSV"]
>
> where "gflist[n]" generates the said set of functions for the case "n".
>   The output file then looks like:
>
> [winesap:~] nmoore% cat function_list.txt
> 1/(8*d*l^3*Pi)
> 1/(8*l^3*Pi),-(-3 + d)/(16*d*l^3*Pi)
> (8 - 3*d)/(64*l^3*Pi),(-4 + d)^2/(64*d*l^3*Pi)
> -(-5 + d^2)/(64*l^3*Pi),(-5 + 30*d - 15*d^2 +
> 2*d^3)/(192*d*l^3*Pi),-(-5 + d)^3/(384*d*l^3*Pi)
>
> I don't mind pasting in the "case" statement required by c, but I don't
> have the free two days required to re-express all the carats (^).  How
> can I have Mathematica express x^15 as x*x*x*x*x*x*x*x*x*x*x*x*x*x*x
> (the highest power of the polynomial is "n", I'd like to export the set
> of functions n=2 to n=30 or so - far too much typing for me)
>
> NT Moore
> University of Minnesota Physics

```

• Prev by Date: Re: exporting a list of functions for use in a C function
• Next by Date: Re: serious NDSolve bug?
• Previous by thread: Re: exporting a list of functions for use in a C function
• Next by thread: Re: exporting a list of functions for use in a C function