1
$\begingroup$

I am confident the solution to the following differential equation is correct.

$$\frac{\partial u(t,x)}{\partial t}+\frac{\partial u(t,x)}{\partial x}=0$$

Two Questions: (1) Does the solution verification (pde /. sol // FullSimplify) appear to be constructed correctly? (2) If True (or if False) why does it always return Null (prints as indeterminate)?

pde := D[u[t, x], t] + D[u[t, x], x] == 0
ic := u[0, x] == Exp[-x] Sin[x]^2
bc := u[t, 0] == 0
sol := First[DSolve[{pde, ic, bc}, u[t, x], {t, x}]]
ver := If[pde /. sol // FullSimplify, Style["True", lime], 
  Style["False", Background -> Red], 
  Style["Indeterminate", Black, Background -> Yellow]]
Print[ver]

returns: Indeterminate

goal: return True or False

$\endgroup$

1 Answer 1

2
$\begingroup$

To verify solution of ode or pde, it is better use the form u instead of u[...] in the call. This makes it return a Function which can be used to verify the ode or the pde by direct substitution.

pde = D[u[t, x], t] + D[u[t, x], x] == 0
ic = u[0, x] == Exp[-x] Sin[x]^2
bc = u[t, 0] == 0
sol = First@DSolve[{pde, ic, bc}, u, {t, x}];
(pde /. sol) // Simplify

Mathematica graphics

Verified

side points. No need to use := for assignments to variables. Simply use =

$\endgroup$
1
  • $\begingroup$ Thank you so much. This second time you came through for me in less than 24 hours. $\endgroup$ Apr 22, 2020 at 20:15

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.