Re: Compiling functions
- To: mathgroup at smc.vnet.net
- Subject: [mg31762] Re: Compiling functions
- From: Tom Burton <tburton at cts.com>
- Date: Sat, 1 Dec 2001 02:44:36 -0500 (EST)
- References: <9u4g5i$lhk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello, Because Compiles had Attribute HoldAll (you should in my opinion always check attributes of a function at the first hint of a problem, unless you are sure what they are), you need to Evaluate the argument expr. An easy way to prepare Compile for a complex result is to declare complex input: tf = Compile[{{a, _Complex}, {b, _Complex}, {c, _Complex}}, Evaluate[expr]] On Thu, 29 Nov 2001 05:13:22 +0000 (UTC), in comp.soft-sys.math.mathematica you wrote: >Hello. I would like to ask you for help with compiling functions. > >Let's have >expr = (-b + Sqrt[b^2 - 4*a*c])/(2*a) > >Simple compile does not work for me: >tf = Compile[{a, b, c}, expr]; tf[1, 2, 3] Tom Burton