2
$\begingroup$

And so I want to solve the following equation, subject to these initial conditions:

$\ u_{tt} - u_{xx} = 6u^5+(8+4a)u^3-(2+4a)u$

$\ u(0,x)=\tanh(x), u_t(0,x)=0$

When I use NDSolve to solve within the intervals $\ [0,10] \times [-5,5]$, I tried this as a code:

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

But Mathematica then returns the following line:

NDSolve::deqn: Equation or list of equations expected instead of True in the first argument

where the True affirmation seemingly refers to the second initial condition. What is it that I did wrong? Is there anything wrong with the code? Is there anything wrong with the problem?

$\endgroup$
1
  • $\begingroup$ D[u[0, x], t] == 0 is trivially true because u[0,x] does not depend on t. To write the equation you mention, write it as Derivative[1, 0][u][0, x]. As a beginner as yet unfamiliar with Derivative, you could have constructed this expression as D[u[t, x], t] /. t -> 0, i.e. take the derivative first, and substitute the value t=0 only afterwards. $\endgroup$
    – Szabolcs
    Feb 4, 2014 at 16:26

1 Answer 1

3
$\begingroup$

Since u[x,0] does not depend on t differentiating leads to 0==0. It should be Derivative[1, 0][u][0, x] == 0 Also for your problem one needs some boundary conditions.

$\endgroup$
1
  • $\begingroup$ Now I'd love to be able to compute a numerical integral of the solution, or a function thereof... $\endgroup$ Feb 6, 2014 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.