a bug in mathematica 5?
- To: mathgroup at smc.vnet.net
- Subject: [mg43047] a bug in mathematica 5?
- From: Li-Xin Li <lli at fas.harvard.edu>
- Date: Sat, 9 Aug 2003 02:57:48 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Is the following a bug in mathematica 5?
I typed
sol[x_] := NDSolve[{y'[t] == x Sin[t] y[t], y[0.01] == 1},
y, {t, 0.01, 10}]
u[x_] := ((y[1] /. sol[x])[[1]]) - 3
to define a function u[x]. It works, e.g. u[1] = -1.41648.
Then, I typed
FindRoot[u[x] == 0, {x, 2, 3}]
to find the root for u[x] = 0. But this does not work. Instead, it
gives the following error messages:
NDSolve::ndnum: Encountered non-numerical value for a derivative at
t==0.01`.
ReplaceAll::reps: {NDSolve[{y'[t] == x Sin[t] y[t], y[0.01] == 1},
y, {t, 0.01, 10}]} is neither a list of replacement rules nor
a valid dispatch table, and so cannot be used for replacing.
FindRoot::ndnum: The function value {-3+y[1.]} is not a list of
numbers with dimension {1} at {x} = {2.}.
This small program works perfectly for 4.1 and 4.2, but not for
5. Does anybody knows why?
If it is really a bug, how to inform the wolfram company?
Best wishes,
Li-Xin Li