Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: FindRoot and Compile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46908] Re: FindRoot and Compile
  • From: "Peter Pein" <no at spam.no>
  • Date: Sun, 14 Mar 2004 23:54:24 -0500 (EST)
  • References: <c2rnc8$ovp$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Matthias Gottschalk" <gottschalk at gfz-potsdam.de> schrieb im Newsbeitrag
news:c2rnc8$ovp$1 at smc.vnet.net...
> The following used to work in 4.2
>
> y = Compile[{x}, x^2 - 2 == 0]
>
> FindRoot[y[x], {x, .9}]
>
> {x -> 1.41421}
>
>
>
> With 5.01 I get the Message:
>
> CompiledFunction::cfsa: "Argument x at position 1 should be a
> machine-size real number"
>
> In this case I did not get the trick with_?NumericQ to work . Maybe I
> am not doing it correctly.
> Any suggestions?
>
> Thanks
> Matthias
>
>
>
> -- 
>
> PD Dr. Matthias Gottschalk
> GeoForschungsZentrum
> Projektbereich 4.1
> Telegrafenberg
> 14473 Potsdam
> Germany
>
> tel/fax  +49 (0) 331 288-1418/1402
>


Hi Matthias,

y[x_?NumericQ]:=Evaluate[Compile[{t},t^2-2]][x]

doesn't work? I do not have access to Version 5 - so i have to guess :-(

-- 
Peter Pein, Berlin
petsie at arcAND.de
replace && by || to write to me



  • Prev by Date: Mathematica 5: Integration bug in quadratic found by the GEMM machine
  • Next by Date: shade area between vertical lines
  • Previous by thread: FindRoot and Compile
  • Next by thread: Undiscovered Bug?