Re: Newbe: Wave equation
- To: mathgroup@smc.vnet.net
- Subject: [mg12609] Re: Newbe: Wave equation
- From: Bill Bertram <wkb@ansto.gov.au>
- Date: Mon, 25 May 1998 14:25:19 -0400
- Organization: ANSTO
- References: <6k7e0q$1me@smc.vnet.net>
Michal Morawski wrote: > > Hi, > > I got the trial version of Mathematica 3.0. One of the first problems I > want to solve was (is) the wave equation: > > I wrote the following lines: > c[x_] := if[ (x > 0.5) && ( x < 0.75), 3, 2]; R = 2+0.5 I; > solve = NDSolve{D[y[x, t], x, x]-D[y[x, t], t, > t]/(c[x]*c[x])-D[y[x,t],t]/R==0, > y[x, 0] == 0, Derivative[0,1][y][x, 0] == 0, > y[0, t] == Cos[t], > y[1, t]==Exp[-1]}, y, {x, 0, 1}, {t, 0, 2*Pi}] > > I received the message: <Equations may not give solutions for all > "solve" variables> > After further "research" I have discovered none solution was given > > Real "R" (instead of complex) do not change anything. > > My question is: > Is mathematica able to solve such simple equations? Any help? First of all, the correct syntax for a second partial dervative is, D[D[y[x,t],x],x] and not D[y[y,t],x,x] as you've written. Secondly, you must change the "if" in your if[.. statement to "If" with a capital "I". With these changes you should get a solution in the form {{y -> InterpolatingFunction[{{0, 1.}, {0., 6.28319}},<>]}} Hope this helps, Bill