MathGroup Archive 2009

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

Search the Archive

Re: what went wrong in this ordinary differential eq

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98544] Re: [mg98504] what went wrong in this ordinary differential eq
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 12 Apr 2009 03:47:37 -0400 (EDT)
  • References: <200904110754.DAA22155@smc.vnet.net>
  • Reply-to: drmajorbob at bigfoot.com

g[x_]:=x y'[x]
s=NDSolve[{g'[x]+Sin[y[x]]*y[x]==0,y[0]==1,y'[0]==0},y[x],{x,0,30}]

Power::infy: Infinite expression 1/0. encountered. >>
NDSolve::ndnum: Encountered non-numerical value for a derivative at x ==  
0.`. >>
NDSolve[{Sin[y[x]] y[x]+(y^\[Prime])[x]+x  
(y^\[Prime]\[Prime])[x]==0,y[0]==1,(y^\[Prime])[0]==0},y[x],{x,0,30}]

Mathematica needs to solve for y''[0] and can't, because its coefficient  
(x) is 0.

THIS problem works fine, on the other hand:

Clear[s]
g[x_]:=(x+1) y'[x]
s[x_]=y[x]/.NDSolve[{g'[x]+Sin[y[x]]*y[x]==0,y[0]==1,y'[0]==0},y[x],{x,0,30}]

{InterpolatingFunction[{{0.,30.}},<>][x]}

Plot[s@x, {x, 0, 30}, PlotStyle -> Automatic]

Bobby

On Sat, 11 Apr 2009 02:54:57 -0500, Janpou Nee <jpnee2000 at yahoo.com.tw>  
wrote:

> s = NDSolve[{(x*y'[x])'[x] + Sin[y[x]]*y[x] == 0, y[0] == 1,
>     y'[0] == 0}, y[x], {x, 0, 30}];
> Plot[Evaluate[{y[x]} /. s], {x, 0, 30}, PlotStyle -> Automatic]
>



-- 
DrMajorBob at bigfoot.com


  • Prev by Date: Re: Mathematica behavior using highlighting and keyboard arrows -
  • Next by Date: Re: Scaling JPEGs or TIFFs inside PDF slides (using Illustrator)?
  • Previous by thread: Re: Mathematica behavior using highlighting and keyboard arrows -
  • Next by thread: Re: Change in NSolve algorithm