Re: Can Plot, can't FindRoot - what gives?
- To: mathgroup at smc.vnet.net
- Subject: [mg97730] Re: Can Plot, can't FindRoot - what gives?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 19 Mar 2009 05:24:46 -0500 (EST)
- Organization: Uni Leipzig
- References: <gpsrae$mm8$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
f[c_?NumericQ] := (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}]
gives not a single error ..
Regards
Jens
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.
>
> Many thanks in advance,
>
> Aaron
>