0
$\begingroup$

This question already has an answer here:

I have a function g=f(x,t). The function "g" came from a numerical integration:

g[x_?NumericQ,t_?NumericQ]:=NIntegrate[tt[x,r,t],{r,rmin,rmax}]

and tt(x,r,t) came from a data file.

How to plot the second derivative of g(x,t) with respect to "t" for a fixed "x" using the ND command?

enter image description here

For the first derivative, I can use:

ListPlot[Table[{y, ND[g[y, t], t, 15]}, {y, 50, 200, 3}]]

enter image description here

What about the second derivative? The query "numerical partial derivative" have no answer for the second derivative with respect to the same variable.

$\endgroup$

marked as duplicate by Jens, bbgodfrey, ciao, m_goldberg, Kuba Apr 23 '15 at 6:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ It's been awhile since I took calculus... but I'm pretty sure you can take the derivative with respect to t before you integrate with respect to r, as long as rmin, and rmax don't depend on t, (Leibniz rule?). Then I'd do NIntegrate[D[tt[x,r,t],{t,2}], {r,rmin,rmax}]. $\endgroup$ – N.J.Evans Apr 23 '15 at 1:05
  • $\begingroup$ @N.J.Evans, in fact it is only an example. My function is more complex than the example. $\endgroup$ – Luis Fernando Moura Apr 23 '15 at 15:23
  • 1
    $\begingroup$ You can specify the order of the derivative in the ND function with ND[f[x,y], {x, order}, x0]. $\endgroup$ – N.J.Evans Apr 23 '15 at 17:34

Browse other questions tagged or ask your own question.