2
$\begingroup$

I am trying to solve:

$u_t - 2u_{xt} = 0,\ $ where: $\ u(x,0) = \sin(x),\ \ u(0,t) = t. $

So I tried the following:

pde = {D[u[x, t], t] - 2 D[u[x, t], x, t] == 0, u[x, 0] == Sin[x], u[0, t] == t};
soln = DSolve[pde, u[x, t], {x, t}]

But I keep getting a failure to evaluate without errors, i.e.:

DSolve[{(u^(0,1))[x,t]-2 (u^(1,1))[x,t]==0,u[x,0]==Sin[x],u[0,t]==t},u[x,t],{x,t}]

Would someone please point me out as to the solution to this issue? I have looked at the documentation and tried it different ways, but cannot resolve it. Thank you.

$\endgroup$
4
$\begingroup$

OK, seems that DSolve is still not strong enough, then let's turn to LaplaceTransform:

pde = {D[u[x, t], t] - 2 D[u[x, t], x, t] == 0};
ic = u[x, 0] == Sin[x];
bc = u[0, t] == t;

teqn = LaplaceTransform[{pde, bc}, t, s] /. Rule @@@ {D[ic, x], ic}

tsol = u[x, t] /. 
  First@DSolve[teqn /. HoldPattern@LaplaceTransform[a_, __] :> a, u[x, t], x]

solfunc[x_, t_] = InverseLaplaceTransform[tsol, s, t]
(* E^(x/2) t + Sin[x] *)
$\endgroup$
2
$\begingroup$

The inability of DSolve to produce an answer appears to be a bug. To see that this is the case, consider

pde = {D[u[x, t], t] - 2 D[u[x, t], x, t] == 0, u[0, t] == t};
soln = DSolve[pde, u[x, t], {x, t}]

the ODE in the question with u[x, 0] == Sin[x] omitted. DSolve yields

(* {{u[x, t] -> E^(x/2) t}} *)

which is wrong. The correct answer is

(* {{u[x, t] -> E^(x/2) t + C[1][x]}} *)

where C[1][x] is an arbitrary function of x. Without this term, DSolve cannot match the first solution obtained above to u[x, 0] == Sin[x], so it is perhaps not surprising that DSolve returns unevaluated when attempting to solve the ODE in the question.

Addendum - Solution Using DSolve

As is often the case, DSolve can in fact solve the system in the question, if it is broken into simpler pieces. Here, represent D[u[x, t], t] as w[x,t]. Then,

Flatten@DSolve[{w[x, t] - 2 D[w[x, t], x] == 0, w[0, t] == 1}, w[x, t], {x, t}]
(* {w[x, t] -> E^(x/2)} *)
Flatten@DSolve[{D[u[x, t], t] == w[x, t] /. %, u[x, 0] == Sin[x]}, u[x, t], {x, t}]
(* {u[x, t] -> E^(x/2) t + Sin[x]} *)

as desired.

$\endgroup$
  • $\begingroup$ I guess in this case DSolve is solving an initial value problem of x i.e. it actually does something like fo = FourierTransform[#, t, s] &; InverseFourierTransform[ DSolve[{fo@D[u[x, t], t] - 2 fo@D[u[x, t], x, t] == 0, fo@u[0, t] == fo@t} /. HoldPattern@FourierTransform[a_, __] :> a, u[x, t], x][[1, 1, -1]], s, t] $\endgroup$ – xzczd Oct 24 '16 at 1:34
1
$\begingroup$

But with NDSolve it works:

pde = {D[u[x, t], t] - 2 D[u[x, t], x, t] == 0, u[x, 0] == Sin[x], u[0, t] == t};
soln = NDSolve[pde, u[x, t], {x, 0, 5}, {t, 0, 10}]
Plot3D[u[x, t] /. soln, {x, 0, 5}, {t, 0, 10}, PlotRange -> All]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you for your answer, however, I need the actual function as a solution. It works without BC, but introducing them leads to the issue outlined above. $\endgroup$ – Lucif3r Oct 21 '16 at 20:03
  • $\begingroup$ Try this solution t Exp[x/2] + Sin[x] $\endgroup$ – user36273 Oct 21 '16 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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