plotting a 3d double integral



El vie, 18-12-2009 a las 18:05 -0800, Doug Edmunds (gmail) escribi?:
> I've been looking at Kahn Academy videos at
> www.khanacademy.org.
> 
> In the Calculus videos on Double Integrals
> (videos 5 and 6),
> he works a problem for the area under a surface
> where the surface z = x*y^2 and y = x^2.
> 
> He solves the area under z two ways, essentially:
> 
> integrate(integrate(x*y^2,y,0,x^2),x,0,1);
>  > 1/24
> 
> integrate(integrate(x*y^2,x,y^(1/2),1),y,0,1);
> (Maxima can't do it this way)
> 
> Is it possible to plot this problem using plot3d
> or something else?


Domines for 3d explicit surfaces must be rectangles, but it is possible
to play with lines to get a visual idea of the volume. Here is a simple
program, which can give you some ideas.



load(draw) $

double_integral_draw (z, x, x0, x1, y, y0, y1) :=
  block([xval, yval, cur, lin1, lin2, opt1, opt2, opt3, u, n: 50],

    cur: makelist(
           (yval: float(k/n)*(y1-y0) + y0,
            parametric(u, yval, subst([x=u, y=yval], z),
                       u, subst(y=yval, x0), subst(y=yval, x1))),
           k, 1, n),

    lin1: makelist(
            (yval: float(k/n)*(y1-y0) + y0,
             xval: subst(y=yval, x0),
             points([[xval, yval, 0],
                     [xval, yval, subst([x=xval, y=yval], z)]])),
            k, 1, n),

    lin2: makelist(
            (yval: float(k/n)*(y1-y0) + y0,
             xval: subst(y=yval, x1),
             points([[xval,yval,0],
                     [xval,yval,subst([x=xval, y=yval], z)]])),
            k, 1, n),

    opt1: [xlabel="x",ylabel="y",color=blue, xyplane=0],
    opt2: [points_joined=true, point_size=0,color=red],
    opt3: [color=green] ,

    apply(draw3d, append(opt1, cur, opt2, lin1, opt3, lin2))  ) $




x and y are the variables used in the definition of z. x0 and x1 are the
bounds for x, which can depend on y. You can change the number of lines
varying the default value for n.

Here are some calls to function double_integral_draw:




double_integral_draw (x*y^2, x, sqrt(y), 1, y, 0, 1) $

double_integral_draw (x*y^2, x, 0, y^(1/6), y, 0, 1) $

double_integral_draw (x*y^2, x, sqrt(y), y^(1/6), y, 0, 1) $

double_integral_draw (exp(-x^2-y^2), 
                      x, -sqrt(1-y^2), sqrt(1-y^2),
                      y, -1, 1) $

double_integral_draw (x^2+y^2,
                      x, sin(y)-1, cos(y)+1,
                      y, -3, 2) $




But remember, your are drawing lines, not surfaces.

Thanks for your question; it is an interesting plotting problem.

-- 
Mario