Mathematica 9 is now available
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 2001

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

Search the Archive

Compiling functions

  • To: mathgroup at
  • Subject: [mg31720] Compiling functions
  • From: Cyril Fischer <fischerc at>
  • Date: Thu, 29 Nov 2001 00:13:38 -0500 (EST)
  • Organization: Inst. of Theoretical and Applied Mechanics
  • Sender: owner-wri-mathgroup at

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]

in this case the the values are not substitued for symbols.

Such a ugly construction works
tf = Compile[{a1, b1, c1},
    Evaluate[expr /. {a -> a1, b -> b1, c -> c1}]]; tf[1, 2, 3]

however it failes to evaluate compiled expression as the sqrt result is
not real.

1. How can I compile (assigned) expressions without substitution for
each parameter?

2. How can I compile expressions, which (for real input) can give
complex output?

Thanks, Cyril F.

  • Prev by Date: Import power point slides to Mathematica - please help !
  • Next by Date: Re: right StoppingTest
  • Previous by thread: Import power point slides to Mathematica - please help !
  • Next by thread: Symbolize