I want to solve the following problem in Mathematica: enter image description here

I used the following Mathematica code. I am unsure whether this is the correct way of entering the assumptions for the initial and boundary conditions though (i.e. whether DSolve takes these assumptions into account.

eq = D[u[x, t], t, t] - 4*D[u[x, t], x, x] == 0

ic = {Simplify[u[x, 0] == 4 Sin[x], Assumptions -> x > 0], Simplify[Derivative[0, 1][u][x, 0] == 0, Assumptions -> x > 0]}

bc = {Simplify[Derivative[1, 0][u][0, t] == 0, Assumptions -> t > 0]}

Simplify[DSolve[{eq, ic, bc}, u[x, t], {x, t}, Assumptions -> t > 0 && x > -t]]
  • $\begingroup$ The line $x = 0$, $t>0$ (where your last boundary condition is specified) is in the interior of the region where the full ODE is specified ($t > 0, x>-t$.) So it's not really a "boundary" condition like we'd normally encounter. Can you confirm that this is correct and doesn't have some weird typo? $\endgroup$ Jun 2, 2020 at 21:41
  • $\begingroup$ @Michael Seifert It's actually $x = -t$, not $x = 0$, but Mathematica can't solve such conditions, so I chose something else to ask the question (whose main point was to check whether this is the correct way of entering the assumptions). $\endgroup$
    – Leponzo
    Jun 2, 2020 at 22:20
  • 1
    $\begingroup$ Your code works fine for me although for some reason Mathematica includes an arbitrary constant C[1]. After making C[1]->1 , the solution satisfies the pde as well as the bc and ic's. $\endgroup$
    – Bill Watts
    Jun 2, 2020 at 22:50
  • $\begingroup$ @Bill Watts It works for this example, but I'm not sure whether DSolve takes these assumptions into account. $\endgroup$
    – Leponzo
    Jun 2, 2020 at 23:01
  • 1
    $\begingroup$ I worked it without any of the assumptions and I got an answer that also satisfied all the conditions. But the solution with assumptions was shorter, so they did something. Simplifying with appropriate assumptions after the solution is found may do just as well. I doubt assumptions on the DSolve command will restrict the solution to a particular domain. $\endgroup$
    – Bill Watts
    Jun 2, 2020 at 23:11


Your Answer

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