Iterated Integrals

Code

graphicsFinal[sliceLocation_]:=(
slice=If[showSlice,ParametricPlot3D[Append[xySlice[t,sliceLocation],s],{t,innerLeft,innerRight},{s,0,f@@xySlice[t,sliceLocation]},PlotStyle->Blue,Mesh->None,BoundaryStyle->Black],{}];
point=If[showInnerIntegralPlot,Graphics3D[{Blue,PointSize[0.02],Point[Append[xySlice[back,sliceLocation],NIntegrate[f@@xySlice[r,sliceLocation],{r,innerLeft,innerRight}]]]}],{}];
Show[innerIntegralPlot,innerIntegralCurve,point,surface,region,slice,Axes->Automatic,Ticks->axisTicks,AxesLabel->{x,y,z},BoxRatios->boxRatios,ViewPoint->{4,4,4},PlotRange->{{xBack,xRight},{yBack,yRight},{0,zMax}},Lighting->{{"Ambient",RGBColor[{1,1,1}]}}]
)

graphicsInitial:=(

xBack=xLeft-(xRight-xLeft)/4;
yBack=yLeft-(yRight-yLeft)/4;
back=If[innerIntegral==1,xBack,yBack];
innerLeft=If[innerIntegral==1,xLeft,yLeft];
innerRight=If[innerIntegral==1,xRight,yRight];
outerLeft=If[innerIntegral==1,yLeft,xLeft];
outerRight=If[innerIntegral==1,yRight,xRight];

filling=If[showVolumeBelow,Bottom,None];
surface=If[showSurface,Plot3D[f[x,y],{x,xLeft,xRight},{y,yLeft,yRight},MeshStyle->Red,PlotStyle->Opacity[0.5],Filling->Bottom,FillingStyle->Hue[1,1,1,.25],BoundaryStyle->Red],{}];
region=If[showRegion,Graphics3D[{Opacity[0],EdgeForm[Red],Polygon[{{xLeft,yLeft,0},{xLeft,yRight,0},{xRight,yRight,0},{xRight,yLeft,0}}]}],{}];
xySlice[inner_,outer_]:=Table[If[i==innerIntegral,inner,outer],{i,1,2,1}];

innerIntegralFunction[t_]:=Integrate[f@@xySlice[r,t],{r,innerLeft,innerRight}];

innerIntegralCurve=If[showInnerIntegralPlot,ParametricPlot3D[Append[xySlice[back,t],innerIntegralFunction[t]],{t,outerLeft,outerRight},PlotStyle->{Red,Thickness[0.008]}],{}];

innerIntegralPlot=If[showInnerIntegralPlot,ParametricPlot3D[Append[xySlice[back,t],s],{t,outerLeft,outerRight},{s,0,innerIntegralFunction[t]},PlotStyle->LightBlue,Mesh->None],{}];


)

graphics[sliceLocation_]:=(
graphicsInitial;
graphicsFinal[sliceLocation]
)

animation:=(
graphicsInitial;
Table[Image[graphicsFinal[sliceLocation]],{sliceLocation,outerLeft,outerRight,(outerRight-outerLeft)/(duration*framerate)}]
)

Graphics

Modify the functions and options below to change the graphics.
innerIntegral = 1 specifies that the inner integral of the iterated integrals should be with respect to x, and innerIntegral = 2 specifies that the inner integral is with respect to y.

f[x_,y_]:=x^3 +y^2+1;
xLeft=-1;
xRight=1;
yLeft=-2;
yRight=1;

innerIntegral = 2;

sliceLocation=-.5;
showVolumeBelow=True;
showSurface=True;
showInnerIntegralPlot=True;
showSlice = True;
showRegion=True;

(*Display parameters*)
boxRatios={2,3,4};
zMax=10;
axisTicks=Automatic;

graphics[sliceLocation]

Animation

All options except sliceLocation are taken from the Graphics section above.
It may take some time to run this command, as all frames of the animation are precomputed so that it can run smoothly.

duration=2;
framerate=16;

ListAnimate[animation,DefaultDuration->duration]