Re: differential equation with buondary conditions

*To*: mathgroup at smc.vnet.net*Subject*: [mg30323] Re: differential equation with buondary conditions*From*: "Allan Hayes" <hay at haystack.demon.co.uk>*Date*: Sat, 11 Aug 2001 03:39:46 -0400 (EDT)*References*: <9kqk0f$4g6$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Gustavo, We have, DSolve[{y''[x]+k y[x]==0, y[0]==0,y[a]==0},y,x] {{y -> Function[{x}, 0]}} This is the generic solution, the only other possibility is for special values of k and/or a (see below) Leave out the boundary conditions sol=DSolve[{y''[x]+k y[x]==0},y,x] {{y -> Function[{x}, C[1]*Cos[Sqrt[k]*x] + C[2]*Sin[Sqrt[k]*x]]}} Get the function ys = y/.sol[[1]] Function[{x}, C[1]*Cos[Sqrt[k]*x] + C[2]*Sin[Sqrt[k]*x]] The first boundary condition gives ys[0]==0 C[1] == 0 Using this on the second boundary condition we get ys[a]==0/.C[1]->0 C[2]*Sin[a*Sqrt[k]] == 0 This entails C[2] =0 unless Sin[a*Sqrt[k]] =0. -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Gustavo Seabra" <gseabra at swbell.net> wrote in message news:9kqk0f$4g6$1 at smc.vnet.net... > Hello, > > I'm trying to make Mathematica solve the following: > > y''[x] + k y[x] == 0 > > subject to the boundary conditions: > y[x<0] = 0 > y[x>a] = 0 > so that y[x] != 0 only if 0 < x < a. > (yes, it's the "particle in a 1-d box problem.) > > If I just do: DSolve[{y''[x] + k y[x] == 0}, y[x], x] > it works fine, giving: > {{y[x] -> C[2] Cos[Sqrt[k] x] + C[1] Sin[Sqrt[k] x]}}, > which is perfectly ok. > > But if I include the boundary conditions y[0] == y[a] == 0, > it doesn't work. > > Any ideas? > -- > ----------------------------------------------------------------- > Gustavo Seabra - Graduate Student > Chemistry Department > Kansas State University > ----------------------------------------------------------------- > >