I have near to no experience with mathematica, so this might seem pretty trivial.
I want to solve an Evolution equation, i.e. we have a function $f(t,x)$ and a differential operator $T(t,\partial_t)$. The equation is then

$T(t,\partial_t) f(t,x) = c$

As an example consider $T = t \partial_t$,the initial condition $f(1,x) = e^{x}$ and $c=1$. Then we have the differential equation

$\partial_t f(t,x) = \frac{1}{t} \rightarrow f(t,x) = f(1,x) + \log(t) = e^{x} + \log(t)$

Then I would want to plot $f$ for some fixed value of $t$, e.g. $f(2,x) = e^{x} + \log(2)$.
My first try would be something like

NDSolve[{Derivative[f[t, x], t] == 1/t, f[1, x] == Exp[x]}, {x, 0, 3}, {t, 1, 2}] Plot[Evaluate[f[2,x] /. %], {x, 0, 3}]

But that doesn't seem to work...


1 Answer 1


You need to use D instead of Derivative, and you need to include the function to be solved for (f):

NDSolve[{D[f[t, x], t] == 1/t, f[1,x] == Exp[x]}, f, {x, 0, 3}, {t, 1, 2}];
Plot[f[2, x] /. %, {x, 0, 3}]

enter image description here

In this case, the Evaluate is not necessary.

(If you do want to use Derivative instead, it should be Derivative[1, 0][f][t, x])


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.