# Homework Help: Solve Wave Function - Computational

1. Nov 24, 2014

### leonmate

1. The problem statement, all variables and given/known data

Hi all,

I've been working on this assignment for some time now and seem to be stuck before I even get going!
So,

The wave equation:

d^2 u(x,t) / dx^2 = d^2 u(x,t) / dt^2

can be written as:

du/dt = v
dv/dt = dw/dx
dw/dt = dv/dx
w = du/dx

I need to solve this using Python. I'm going to do it using Euler's method.

Some initial conditions:

u(x,0) = e^(-x^2 / 2*sigma^2)

sigma = 0.1

du(x,0) / dt = 0

du(x,0) / dx = -100x*u(x,0)

_________

What I've figured, is that in order to implement Euler I need to use the u_dot, v_dot and w_dot as a vector of your RHS. So you use this do calculate the next time step since

U(u,v,w)n+1 = U(u,v,w)n + dt*RHS(u_dot,v_dot,w_dot)

u_dot being du/dt btw

However, I have no idea how to actually do this, I'm completely thrown :(
I've been trying to get somewhere on paper and on the computer coding and neither has really given me anything I can use. How do I find U(u,v,w)n for a start?? and the RHS is d^2u/dt^2 i think.. How am I ever going to put that into python :S :S :S??

Any help and hints would really be helpful the deadline is coming up soon and I'm very stumped here.

Cheers all

2. Nov 24, 2014

### leonmate

Also, everywhere I look the wave function equation is written d^2u / dt^2 = c^2 * d^2u / dx^2

I have no idea why the one in my question is different. Any ideas?