0
$\begingroup$

I'm trying to solve a PDE. My code is:

sol = NDSolve[{
        D[u[x, t], t] - D[u[x, t], {x, 2}] + 4 D[u[x, t], x] -4 u[x, t] == 
             (3 - 2 t) e^(2 t) + (1 - 9 t) e^(-x),
        u[x, 0] == -1 , 
        (D[u[x, t], x] /. x -> 0) == -t, 
        (D[u[x, t], x] /. x -> 300) == 0},
       u[x, t], {x, 0, 300}, {t, 1.5, 100}
      ]

However it shows the following error:

encountered non-numerical value for a derivative at t == 0

Is there a way to fix this?

$\endgroup$
  • $\begingroup$ Mathematica is case-sensitive, so e is not the same as E (2.71...) $\endgroup$ – Chris K Feb 22 at 16:46
  • $\begingroup$ I changed it to E, but now I am getting new error: Could not solve for equations at boundary points from the boundary conditions. $\endgroup$ – Mohammad E. Feb 22 at 17:16
1
$\begingroup$

Try

sol = NDSolve[{Derivative[0, 1][u][x, t] - Derivative[2, 0][u][x, t] + 
4 Derivative[1, 0][u][x, t] -4 u[x, t] == (3 - 2 t) Exp[2 t] + (1 - 9 t) Exp[-x], 
u[x, 0] == -1,
Derivative[1, 0][u][0, t] == -t, 
Derivative[1, 0][u][300, t] == 0}, 
u[x, t], {x, 0, 300}, {t, 1.5, 100}]

This gives a result, which grows rapidly with t. You should check the pde.

$\endgroup$

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.