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 1995

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

Search the Archive

Re: Help using Compile with Solve

  • To: mathgroup at
  • Subject: [mg879] Re: Help using Compile with Solve
  • From: danl (Daniel Lichtblau)
  • Date: Thu, 27 Apr 1995 01:51:42 -0400
  • Organization: Wolfram Research, Inc.

In article <3n9t75$poj at> Bill Harbaugh  
<harbaugh at> writes:
> I want to create a compiled function that uses Solve, like this
> (IN)
> t1=Compile[{x,y},Solve[x+y==z,z]]
> (OUT)
> CompiledFunction[{x, y}, Solve[x + y == z, z], -CompiledCode-]
> (IN)
> t1[1,1]
> (OUT)
> CompiledFunction::ccr: 
>    Expression z should be a machine-size real number.
> CompiledFunction::cfex: 
>    External evaluation error at instruction 5; proceeding with
>      uncompiled evaluation.
> {{z -> 2}}
> As you can see, this doesn't work as a compiled function.  
> It seems like I need to tell Compile that z is also real, but 
> I'm not sure how to do that.
> Thanks, Bill

  Compile can only be used on numeric functions e.g. Cos[#]. Solve is not  
a numeric function.

  Daniel Lichtblau, WRI

  • Prev by Date: NDSolve problem
  • Next by Date: How do I define a range of a symbol?
  • Previous by thread: Help using Compile with Solve
  • Next by thread: Tick marks on Axes AND Frame?