Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: How to NDSolve the differential equation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19625] Re: How to NDSolve the differential equation
  • From: "Kevin J. McCann" <kevinmccann at Home.com>
  • Date: Mon, 6 Sep 1999 04:20:41 -0400
  • Organization: @Home Network
  • References: <7qulo3$2r5@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Chee Lim,

Look at your DE when x=0 with your IC.  The whole thing is zero.  When this
happens NDSolve can't get any traction on the problem.  Maybe you could try
something like this instead:

NDSolve[{x y''[x] + Sin[x] y'[x] + 2 x y[x] == 0, y[0.001] == 0,
    y'[0.001] == 1}, y,
{x, 0.001, 2}]


Alternatively, divide through by x and solve this DE:

y''[x] + y'[x] Sin[x]/x + 2 y[x] == 0

again you will have problems at x=0, this time because of the Sin[x]/x; so,
why not expand it:

s[x_] = Normal[Series[Sin[x]/x, {x, 0, 12}]]

This gives about 9-place accuracy over the [0,2] range.  Then:


q=y/.NDSolve[{y''[x] + y'[x] s[x]+ 2 y[x] == 0
, y[0] == 0,
    y'[0] == 1}, y,
{x, 0, 2},WorkingPrecision->20][[1]]

This gives a solution which satisfies the original DE to about 7 places.

Plot[x q''[x] + q'[x]Sin[x] + 2x q[x], {x, 0, 2},
  PlotRange -> {-0.000001, 0.000001},
  PlotStyle -> RGBColor[1, 0, 0]];


Kevin

Chee Lim Cheung <cheelc at mbox2.singnet.com.sg> wrote in message
news:7qulo3$2r5 at smc.vnet.net...
> Dear Mathematica gurus & users,
>
> I encountered error messages with the tag Power::infy when I tried to do
> the following:
>
> NDSolve[{x y''[x] + Sin[x] y'[x] + 2 x y[x] == 0,y[0]==0, y'[0]==1}, y,
> {x,0,2}]
>
> Can anyone help me in getting Mathematica to produce an answer? I am using
> Mathematica 4.0 & Mathematica 3.0.
>
> Thanks
> Chee
>




  • Prev by Date: Re: crystal structure?
  • Next by Date: Re: Nonlinear Fit with complex model
  • Previous by thread: How to NDSolve the differential equation
  • Next by thread: Re: Re: How to NDSolve the differential equation