MathGroup Archive 2009

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

Search the Archive

Re: FindRoot and evaluations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96984] Re: FindRoot and evaluations
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sun, 1 Mar 2009 04:55:02 -0500 (EST)
  • References: <gob7r0$g4q$1@smc.vnet.net>

Davide,

You should define SomethingLongAndHeavy so that it only accepts
numeric input.

Instead of defining it as SomethingLongAndHeavy[x_] := ... define it
as SomethingLongAndHeavy[x_?NumericQ] := ...

Don't forget to clear the previous definition before using ClearAll
[SomethingLongAndHeavy] or Quit the kernel.

Cheers -- Sjoerd


On Feb 28, 1:40 pm, ventut... at gmail.com wrote:
> Let's say:
>
> F[x_]:=Module[
>           {x0=x},
>           Print[x0];
>           SomethingLongAndHeavy[x0]
> ];
>
> now I do:
>
> FindRoot[F[x],{x,0}]
>
> and it prints:
>
> x
>
> because it first attempts to evaluate F[x] in a symbolic form.
> I don't want this. Because SomethingLongAndHeavy is a recursion set of
> relations which generates a polynomial of order... too much. What I
> would like to see is:
>
> 0.0001
> 0.0002
> ...
>
> So that F[x] is treated as a blackbox, and some Newton or Bisection
> method is applied on this blackbox.
> How to do that?
>
> Thanks!
> Davide
>
> PS: Based on previous discussions I already tried to play with
> attributes HoldAll and option Evaluated, with no success.



  • Prev by Date: Re: Can't quite figure out tensors
  • Next by Date: Re: newbie: diff equation
  • Previous by thread: Re: FindRoot and evaluations
  • Next by thread: Do Hershey Vector Fonts exist in Mathematica?