Numerical solution to a partial differential equation

Catria
Messages
145
Reaction score
4

Homework Statement



Solve the inhomogenous partial differential equation \frac{∂^{2}u}{∂t^{2}}-\frac{∂^{2}u}{∂x^{2}}=-6u^{5}+(8+4ε)u^3-(2+4ε)u by using the NDSolve function in Mathematica for the interval [0,10] x [-5,5].

Homework Equations



Initial conditions:

u(0,x)= tanh(x)
u'(0,x)= 0

The Attempt at a Solution



NDSolve[{D[u[t, x], t, t] - D[u[t, x], x, x] ==
6 u^5 + (8 + 4 a) u^3 - (2 + 4 a) u, u[t, x] /. t -> 0 == Tanh[x],
D[u[t, x], t] /. t -> 0 == 0, u}, u[t, x], {t, 0, 10}, {x, -5, 5}]

But when I enter this into Mathematica, I get the message NDSolve::deqn: "Equation or list of equations expected instead of u[0==Tanh[x],x] in the first argument...
 
Physics news on Phys.org
You have a few problems.

You appear to be missing a minus sign in front of

6 u^5

and this

6 u^5 + (8 + 4 a) u^3 - (2 + 4 a) u

should be this

-6 u[t, x]^5 + (8 + 4 a) u[t, x]^3 - (2 + 4 a) u[t, x]

which is a very common mistake that newer users make

and this

u[t, x] /. t -> 0 == Tanh[x]

should probably be this

u[0, x] == Tanh[x]

and your second boundary condition

D[u[t, x], t] /. t -> 0 == 0

might perhaps be

Derivative[1, 0][0, x] == 0

But I don't think that is enough to resolve your boundary condition problems because with these changes I'm getting a "non-numerical" complaint about derivatives when t is 0 and I can't track that down.

Unfortunately at the moment my Mathematica PDE brain cells are hiding and I can't find them. Hopefully either these will be enough hints to help you solve this or I will track down what I've forgotten and provide a little more assistance.

Ah, what was I thinking, I should have caught this instantly. Inside NDSolve all parameters are going to have to have been assigned constant numeric values, so your parameter a without a defined value isn't going to pass. If I put

a=1;

in front of your NDSolve then the "non-numerical" complaint goes away, that may have been because of your variable, but with this

a = 1;
sol = NDSolve[{D[u[t,x], {t,2}]-D[u[t,x], {x,2}] == -6 u[t,x]^5 + (8+4 a) u[t,x]^3-(2+4 a) u[t,x],
u[0, x] == Tanh[x], Derivative[1, 0][0, x] == 0},
u[t, x], {t, 0, 10}, {x, -5, 5}][[1, 1]];
Plot3D[u[t, x] /. sol, {t, 0, 10}, {x, -5, 5}]

does provide a plot, correct or probably not.

Now there is a lot more work for you to do to deal with the error and warning messages and all the rest.

You want to test all this very carefully when you are done to make certain the result is correct.
 
Last edited:
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top