0
$\begingroup$

I tried the following mixed pde but although I get an interpolation function - I still can't plot it.

sol1 = NDSolve[{D[u[x, t], t, x] + Exp[x*t]*u[x, t] == 0, 
   u[-25, t] == Exp[-100], u[25, t] == Exp[-100], u[x, 0] == Exp[0]}, 
  u, {x, -25, 25}, {t, 0, 25}]

Plot3D[sol1, {x, -25, 25}, {t, 0, 25}]

I remember using the exponential trick for the boundaries. Is there another trick to get a solution for this?

$\endgroup$
1
  • $\begingroup$ NDSolve gives you replacement rules, not a function. To get a function and plot it, you would e.g. write:fun = u /. sol1[[1]]; Plot3D[fun[x, t], {x, -25, 25}, {t, 0, 25}] But first you must get your boundary and initial conditions right, otherwise the function is garbage $\endgroup$ Commented Oct 31, 2020 at 8:29

1 Answer 1

2
$\begingroup$

You can give suitable boundary condition. For example,

sol1 = NDSolve[{D[u[x, t], t, x] + Exp[x*t]*u[x, t] == 0, 
   u[-25, t] == Exp[-100 t], u[x, 0] == Exp[0]}, 
  u, {x, -25, 25}, {t, 0, 25}]
Plot3D[u[x, t] /. sol1, {x, -25, 25}, {t, 0, 25}]
$\endgroup$
1
  • $\begingroup$ Thank you. What is a suitable boundary condition. Technically, this pde has only the initial condition - I added the rest trying to get something back. $\endgroup$
    – Edv Beq
    Commented Oct 31, 2020 at 17:04

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.