MathGroup Archive 2009

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

Search the Archive

Re: Can Plot, can't FindRoot - what gives?


Aaron Fude wrote:
> Hi,
> 
> Here's my code for a model problem. I do not need a solution to this
> simple problem, of course - I just need to understand why Mathematica
> is giving me an error.
> 
> f[c_] := (
>   s = NDSolve[{ y'[x] == c - 1, y[0] == 0}, y, {x, 0, 2*Pi}];
>   (Evaluate[y[x] /. s] /. x -> 2*Pi)[[1]]
>   )
> Plot[f[c], {c, 0, 10}]
> f[1]
> FindRoot[f[c] == 0, {c, 1}]
> 
> I get a series of errors, the first of which is
> NDSolve::ndnum: Encountered non-numerical value for a derivative at x
> \== 0.`
> 
> I'm on Win32 version 6.
> 

Clear[f], then change f[c_] := ... to f[c_?NumericQ] := ...



  • Prev by Date: Re: Bug in LaplaceTransform?
  • Next by Date: Re: demonstrations and presentations
  • Previous by thread: Re: Can Plot, can't FindRoot - what gives?
  • Next by thread: Internet connectivity -- CountryData