Re: NDSolve and error
- To: mathgroup at smc.vnet.net
- Subject: [mg92565] Re: NDSolve and error
- From: "M.G. Bartlett" <marshall.bartlett at gmail.com>
- Date: Mon, 6 Oct 2008 04:12:25 -0400 (EDT)
- References: <gc7fql$elo$1@smc.vnet.net>
On Oct 5, 12:16 am, doda... at poczta.fm wrote:
> Hello!
> Lately I wrote simple code in Mathematica
>
> sol[p_] :=
> NDSolve[{Sqrt[
> 1 + (y'[t])^2] == (x^(p - 1) + (y[x])^(p - 1)*y'[=
x])/(x^p +
> y[x]^p)^(1 - 1/p), y[1] == 6}, y, {x,=
1, 4}]
>
> but when I typed sol[2] the following kind of error was shown:
>
> NDSolve::"ndnum": "Encountered non-numerical value for a derivative at
> \
> \!\(x\) == \!\(4.587812868332132`*^-296\)."
>
> May I know what I'm doing wrong? Or how can I improve that code to
> work correctly?
> Thank you in advance
> John
John,
I think your error results from the fact that you have defined y as
both a function of x and as a function of t (y[t] and y[x]). I am not
certain if you meant for y to be a function of both (in which case you
need to specify it as such (y[x,t]) throughout the equation (and
specify which derivatives you are taking) or if the y[t] on the left
side of your differential equation should be a y[x] (leaving you with
a tractable ordinary differential equation). Hope that helps,
Marshall