Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a question regarding the error message:

NDSolve::ivone: Boundary values may only be specified for one independent variable.
Initial values may only be specified at one value of the other independent variable. >>

I'm curious as to when this error shows up. If I run the heat equation example from the NDSolve documentation, I get a valid solution. However, consider an edit to the p.d.e to

NDSolve[{D[u[t, x], {t, 2}] == D[u[t, x], {x, 2}], u[0, x] == 0, 
  u[t, 0] == 0, u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}]

That is, I changed $u_t = u_{xx}$ to $u_{tt} = u_{xx}$ and also changed an initial condition. (A solution of course is $u(x, t) = 0$.) Now, if I run this, I will get the error quoted above. I believe NDSolve doesn't even try to run.

How do I need to edit the boundary conditions in order to get a run attempt? Does NDSolve only accept certain types of boundary conditions dependent on the order of the p.d.e? How do I find out what boundary conditions are acceptable?

I'm asking about this because I'm trying to solve a very complicated third-order, nonlinear, p.d.e resulting from an optic equation and every set of initial conditions that I have given NDSolve for this 3rd-order equation has resulted in the above error.

share|improve this question
add comment

1 Answer 1

For a wave equation (2nd order in time) you need an initial condition and a derivative of an initial condition, like so:

NDSolve[{D[u[t, x], {t, 2}] == D[u[t, x], {x, 2}], u[0, x] == 0, 
  Derivative[1, 0][u][0, x] == 0, u[t, 0] == 0, u[t, 5] == 0}, u, {t, 
  0, 10}, {x, 0, 5}]

As a side note sometimes (not in this case though) it may be helpful to NDSolve to specify the temoral variable. This can be done like this:

NDSolve[{D[u[t, x], {t, 2}] == D[u[t, x], {x, 2}], u[0, x] == 0, 
  Derivative[1, 0][u][0, x] == 0, u[t, 0] == 0, u[t, 5] == 0}, u, {t, 
  0, 10}, {x, 0, 5}, Method -> {MethodOfLines, TemporalVariable -> t}]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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