Example of diff and integrate.
MGL code:
ranges 0 1 0 1 0 1:new a 30 40 'x*y'
subplot 2 2 0:title 'a(x,y)':rotate 60 40:surf a:box
subplot 2 2 1:title 'da/dx':rotate 60 40:diff a 'x':surf a:box
subplot 2 2 2:title '\int da/dx dxdy':rotate 60 40:integrate a 'xy':surf a:box
subplot 2 2 3:title '\int {d^2}a/dxdy dx':rotate 60 40:diff2 a 'y':surf a:box
C++ code:
void smgl_dat_diff(mglGraph *gr) // differentiate
{
gr->SetRanges(0,1,0,1,0,1);
mglData a(30,40); a.Modify("x*y");
gr->SubPlot(2,2,0); gr->Title("a(x,y)"); gr->Rotate(60,40);
gr->Surf(a); gr->Box();
gr->SubPlot(2,2,1); gr->Title("da/dx"); gr->Rotate(60,40);
a.Diff("x"); gr->Surf(a); gr->Box();
gr->SubPlot(2,2,2); gr->Title("\\int da/dx dxdy"); gr->Rotate(60,40);
a.Integral("xy"); gr->Surf(a); gr->Box();
gr->SubPlot(2,2,3); gr->Title("\\int {d^2}a/dxdy dx"); gr->Rotate(60,40);
a.Diff2("y"); gr->Surf(a); gr->Box();
}