## Gráfico de funciones

load(draw)$

f1(x, y) := 6 - 2*x - 3*y;

draw3d(explicit(f1(x,y),x,-5,5,y,-5,5))$

draw3d(enhanced3d = true,
    xlabel="x",ylabel="y",zlabel="z",
    explicit(f1(x,y),x,-5,5,y,-5,5))$

draw3d(enhanced3d = true,
    xlabel="x",ylabel="y",zlabel="z",
    explicit(f1(x,y),x,0,5,y,0,5))$

f2(x, y) := sqrt(9 - x^2 - y^2);

draw3d(enhanced3d = true,
    xlabel="x",ylabel="y",zlabel="z",
    explicit(f2(x,y),x,-4,4,y,-4,4))$

f3(x, y) := 4 - x^2 - y^2;

draw3d(xlabel="x",ylabel="y",zlabel="z",
    color = blue,
    explicit(f3(x,y),x,-4,4,y,-4,4),
    color = green,
    explicit(0,x,-4,4,y,-4,4)
    )$

draw3d(xlabel="x",ylabel="y",zlabel="z",
    color = blue,
    explicit(f3(x,y),x,-4,4,y,-4,4),
    color = green,
    explicit(0,x,-4,4,y,-4,4),
    surface_hide = true
    )$

draw3d(xlabel="x",ylabel="y",zlabel="z",
    color = blue,
    explicit(f3(x,y),x,-4,4,y,-4,4),
    color = green,
    implicit(y = 0,x,-4,4,y,-4,4,z,-25,6),
    color = red,
    implicit(y = 3,x,-4,4,y,-4,4,z,-25,6),
    surface_hide = true
    )$

f4(x, y) := x^2 + 1;

draw3d(xlabel="x",ylabel="y",zlabel="z",
    color = blue,
    explicit(f4(x,y),x,-4,4,y,-4,4),
    color = red,
    implicit(y = -3,x,-4,4,y,-4,4,z,0,15),
    color = green,
    implicit(y = 0,x,-4,4,y,-4,4,z,0,15),
    color = yellow,
    implicit(y = 3,x,-4,4,y,-4,4,z,0,15),
    surface_hide = true
    );

## Curvas de nivel

draw3d(xlabel="x", ylabel="y", zlabel="z",
    color = green,
    explicit(f1(x, y),x,-4,4,y,-4,4),
    contour_levels = 10,
    contour        = both,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f1(x, y),x,-4,4,y,-4,4),
    contour_levels = 10,
    contour        = base,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f1(x, y),x,-4,4,y,-4,4),
    contour_levels = 10,
    contour        = surface,
    surface_hide   = true)$

draw3d(xlabel="x", ylabel="y",
    color = green,
    explicit(f1(x, y),x,-4,4,y,-4,4),
    contour_levels = 10,
    contour        = map,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f2(x, y),x,-4,4,y,-4,4),
    contour_levels = {1,1.5,2.5,2.8,3},
    contour        = both,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f2(x, y),x,-4,4,y,-4,4),
    contour_levels = {1,1.5,2.5,2.8,3},
    contour        = map,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f2(x, y),x,-3,3,y,-3,3),
    contour_levels = {2.8,2.9,2.95,2.97,2.999},
    contour        = both,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f3(x, y),x,-4,4,y,-4,4),
    contour_levels = 10,
    contour        = both,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f4(x, y),x,-4,4,y,-4,4),
    contour_levels = 10,
    contour        = both,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f4(x, y),x,-4,4,y,-4,4),
    contour_levels = {1.1,1.05,1.0005},
    contour        = both,
    surface_hide   = true)$

draw3d(color = green,
    explicit(f4(x, y),x,-4,4,y,-4,4),
    contour_levels = {1.1,1.05,1.0005},
    contour        = map,
    surface_hide   = true)$

f5(x, y, z) := x^2 + y^2 + z^2;

draw3d(enhanced3d = true,
    implicit(f5(x,y,z) = 0.1,x,-5,5,y,-5,5,z,-5,5)
    )$

draw3d(enhanced3d = true,
    implicit(f5(x,y,z) = 1,x,-5,5,y,-5,5,z,-5,5)
    )$

draw3d(enhanced3d = true,
    implicit(f5(x,y,z) = 5,x,-5,5,y,-5,5,z,-5,5)
    )$

draw3d(enhanced3d = true,
    implicit(f5(x,y,z) = 10,x,-5,5,y,-5,5,z,-5,5)
    )$

draw3d(enhanced3d = true,
    implicit(f5(x,y,z) = 20,x,-5,5,y,-5,5,z,-5,5)
    )$

draw3d(enhanced3d = true,
    implicit(f5(x,y,z) = 30,x,-5,5,y,-5,5,z,-5,5)
    )$

# Límites

f6(x, y) := 5*x*y/(x^2 + y^2);

limit(f6(x,0),x,0);
limit(f6(x,x),x,0);

draw3d(color = green,
    explicit(f6(x,y),x,-1,1,y,-1,1),
    surface_hide = true
    )$

draw3d(color = blue,
    line_width = 2,
    parametric(t,0,f6(t,0), t,-1,1),
    color = red,
    line_width = 2,
    parametric(t,t,f6(t,t), t,-1,1)
    )$

draw3d(color = blue,
    line_width = 2,
    parametric(t,0,f6(t,0), t,-1,1),
    color = red,
    line_width = 2,
    parametric(t,t,f6(t,t), t,-1,1),
    color = green,
    explicit(f6(x,y),x,-1,1,y,-1,1),
    surface_hide = true
    )$

f7(x, y) := 5*x^2*y/(x^2 + y^2);

draw3d(color = green,
    explicit(f7(x,y),x,-2,2,y,-2,2),
    surface_hide = false,
    color = blue,
    line_width = 2,
    parametric(0,t,f7(0,t), t,-1,1),
    color = red,
    line_width = 2,
    parametric(t,t,f7(t,t), t,-1,1),
    color = yellow,
    line_width = 2,
    parametric(t,2*t,f7(t,2*t), t,-1,1),
    color = brown,
    line_width = 2,
    parametric(t,-2*t,f7(t,-2*t), t,-1,1)
    );

limit(f7(0,y),y,0);
limit(f7(x,x),x,0);
limit(f7(x,2*x),x,0);
limit(f7(x,-2*x),x,0);

f8(x, y) := x*y^2/(x^2 + y^4);

draw3d(color = green,
    explicit(f8(x,y),x,-2,2,y,-2,2),
    surface_hide = true
    )$

draw3d(color = green,
    explicit(f8(x,y),x,-2,2,y,-2,2),
    contour_levels = 10,
    contour = both,
    surface_hide = true
    )$

draw3d(color = green,
    explicit(f8(x,y),x,-1,1,y,-1,1),
    contour_levels = 10,
    contour = map,
    surface_hide = true
    )$

draw3d(color = green,
    explicit(f8(x,y),x,-2,2,y,-2,2),
    surface_hide = false,
    color = blue,
    line_width = 2,
    parametric(0,t,f8(0,t), t,-1,1),
    color = red,
    line_width = 2,
    parametric(t,t,f8(t,t), t,-1,1),
    color = yellow,
    line_width = 2,
    parametric(t,2*t,f8(t,2*t), t,-1,1),
    color = brown,
    line_width = 2,
    parametric(t,-2*t,f8(t,-2*t), t,-1,1)
    )$

draw3d(color = green,
    explicit(f8(x,y),x,-2,2,y,-2,2),
    surface_hide = false,
    color = magenta,
    line_width = 2,
    parametric(t,t^2,f8(t,t^2), t,-1,1),
    color = cyan,
    line_width = 2,
    parametric(t^2,t,f8(t^2,t), t,-1,1)
    )$

draw3d(color = green,
    explicit(f8(x,y),x,-2,2,y,-2,2),
    surface_hide = false,
    color = blue,
    line_width = 2,
    parametric(0,t,f8(0,t), t,-1,1),
    color = red,
    line_width = 2,
    parametric(t,t,f8(t,t), t,-1,1),
    color = yellow,
    line_width = 2,
    parametric(t,2*t,f8(t,2*t), t,-1,1),
    color = brown,
    line_width = 2,
    parametric(t,-2*t,f8(t,-2*t), t,-1,1),
    color = magenta,
    line_width = 2,
    parametric(t,t^2,f8(t,t^2), t,-1,1),
    color = cyan,
    line_width = 2,
    parametric(t^2,t,f8(t^2,t), t,-1,1)
    )$

draw3d(color = blue,
    line_width = 2,
    parametric(0,t,f8(0,t), t,-1,1),
    color = red,
    line_width = 2,
    parametric(t,t,f8(t,t), t,-1,1),
    color = yellow,
    line_width = 2,
    parametric(t,2*t,f8(t,2*t), t,-1,1),
    color = brown,
    line_width = 2,
    parametric(t,-2*t,f8(t,-2*t), t,-1,1),
    color = magenta,
    line_width = 2,
    parametric(t,t^2,f8(t,t^2), t,-1,1),
    color = cyan,
    line_width = 2,
    parametric(t^2,t,f8(t^2,t), t,-1,1)
    )$

f9(x, y) := (x^3 + y^3)/(x^2 + y^2);

draw3d(color = green,
    explicit(f9(x,y),x,-2,2,y,-2,2),
    surface_hide = true
    )$

draw3d(color = green,
    explicit(f9(x,y),x,-2,2,y,-2,2),
    surface_hide = false,
    color = blue,
    line_width = 2,
    parametric(0,t,f9(0,t), t,-1,1),
    color = red,
    line_width = 2,
    parametric(t,t,f9(t,t), t,-1,1),
    color = yellow,
    line_width = 2,
    parametric(t,2*t,f9(t,2*t), t,-1,1),
    color = brown,
    line_width = 2,
    parametric(t,-2*t,f9(t,-2*t), t,-1,1)
    )$

f10(x, y) := (x + y)/sqrt(x^2 + y^2);

draw3d(color = green,
    explicit(f10(x,y),x,-2,2,y,-2,2),
    surface_hide = true
    )$

draw3d(color = green,
    explicit(f10(x,y),x,-2,2,y,-2,2),
    surface_hide = false,
    color = blue,
    line_width = 2,
    parametric(t,0,f10(t,0), t,0.001,1),
    color = red,
    line_width = 2,
    parametric(t,0,f10(t,0), t,-1,-0.001)        
    )$