# Sesión 3

Miguel Piñar, 21/09/2011

## Gráficos

El paquete draw

load(draw);

draw2d(
       explicit(sin(x),x,0,2*%pi)
      );

draw2d(
       color="#ff0000",
       explicit(sin(x),x,0,2*%pi)
      );

draw2d(
       color="#ff0000",
       explicit(sin(x),x,0,2*%pi),
       color=blue,
       explicit(cos(x),x,0,%pi)
      );

draw2d(
       color=red,
       key="Seno",
       explicit(sin(x),x,0,2*%pi),
       color=blue,
       key="Coseno",
       explicit(cos(x),x,0,2*%pi)
      );

draw2d(
       xaxis=true,
       yaxis=true,
       xaxis_type=solid,
       xaxis_color=cyan,
       yaxis_type=solid,
       yaxis_color=cyan,
       color=red,
       key="Seno",
       explicit(sin(x),x,-%pi,%pi),
       color=blue,
       key="Coseno",
       explicit(cos(x),x,-%pi,%pi)
      );

draw2d(
       xaxis=true,
       yaxis=true,
       xaxis_type=solid,
       xaxis_color=cyan,
       yaxis_type=solid,
       yaxis_color=cyan,
       color=red,
       implicit(x^2/4+y^2/9=1, x, -3,3,y,-4,4)
      );

draw2d(file_name="elipse",
       title="Elipse",
       terminal='pdfcairo,
       xaxis=true,
       yaxis=true,
       xaxis_type=solid,
       xaxis_color=cyan,
       yaxis_type=solid,
       yaxis_color=cyan,
       color=red,
       implicit(x^2/4+y^2/9=1, x, -3,3,y,-4,4)
      )$

draw2d(
       title="Otra elipse",
       xaxis=true,
       yaxis=true,
       xaxis_type=solid,
       xaxis_color=cyan,
       yaxis_type=solid,
       yaxis_color=cyan,
       color=red,
       nticks=50,
       parametric(2*cos(t),3*sin(t),t,0,2*%pi)
      )$

draw2d(
       title="Una estrella",
       xaxis=true,
       yaxis=true,
       xaxis_type=solid,
       xaxis_color=cyan,
       yaxis_type=solid,
       yaxis_color=cyan,
       color=red,
       nticks=10,
       parametric(cos(t),sin(t),t,0,8*%pi)
      )$

draw2d(color=red,
       line_width=5,
       border=true,
       fill_color=blue,
       polygon([[2,1],[4,1],[3,5]])
)$

draw3d(
axis_3d=false,
xtics=none,
ytics=none,
ztics=none,
explicit(exp(-x^2-y^2),x,-3,3,y,-3,3))$

draw3d(
axis_3d=false,
xtics=none,
ytics=none,
ztics=none,
surface_hide=true,
explicit(exp(-x^2-y^2),x,-3,3,y,-3,3))$

draw3d(
axis_3d=false,
xtics=none,
ytics=none,
ztics=none,
surface_hide=true,
enhanced3d=true,
explicit(exp(-x^2-y^2),x,-3,3,y,-3,3))$

draw3d(
axis_3d=false,
xtics=none,
ytics=none,
ztics=none,
surface_hide=true,
enhanced3d=true,
xu_grid=80,
yv_grid=80,
explicit(exp(-x^2-y^2),x,-3,3,y,-3,3))$

draw3d(
axis_3d=false,
xtics=none,
ytics=none,
ztics=none,
surface_hide=true,
enhanced3d=true,
xu_grid=80,
yv_grid=80,
palette=[24,4,24],
explicit(exp(-x^2-y^2),x,-3,3,y,-3,3))$

# Análisis (21/09/2011)

## Sucesiones y límites

a[n]:=1/n^2;

a[1];

a[10];

a[10.5];

a[-4];

makelist(a[n],n,1,100);

limit(a[n],n,inf);

Sucesión de Fibonacci

b[0]:1$
b[1]:1$

b[n]:=b[n-1]+b[n-2];

makelist(b[n],n,0,15);

limit(b[n],n,inf);

limit(b[n]/b[n-1],n,inf);

limit(n,n,inf);

limit(1/x,x,0);

limit(1/x^2,x,0);

limit(1/(sqrt(n)-sqrt(n+1)),n,inf);

limit(((n-2)/(n-3))^(2*n),n,inf);

limit((-1)^n,n,inf);

limit(sin(x)/x,x,0);

limit(1/(x-1)^2,x,1);

limit(1/x,x,0);

limit(1/x,x,0,minus);

limit(1/x,x,0,plus);

limit(abs(x)/x,x,0);

limit(abs(x)/x,x,0,minus);

limit(abs(x)/x,x,0,plus);

limit(sin(x),x,inf);

## Definición de funciones

f(x):=exp(x)+x^2;

f(1);

f(1.0);

f(r);

load(draw);

draw2d(explicit(f(x),x,-3,3));

g(x):=if x<0 then sin(x) else f(x);

g(1);

g(-1);

g(0);

draw2d(explicit(g(x),x,-3,3));

limit(g(x),x,0);

limit(g(x),x,0,minus);

limit(g(x),x,0,plus);

## Derivadas e integrales

f(x);

diff(f(x),x);

diff(f(x),x,2);

diff(g(x),x);

h(x):=abs(x);

diff(h(x),x,1);

f1(x):=x/(x^2+2);

diff(f1(x),x);

diff(f1(x),x,2);

ratsimp(%);

'diff(y,x);

diff(y,x);

diff(y(x),x);

'diff(y,x,2);

'diff(y,x,2)+2*'diff(y,x)+y=3*exp(x);

diff(y,x,2)+2*diff(y,x)+y=3*exp(x);

Función derivada

f3(x):=x^3*exp(k*x)*sin(w*x);

diff(f3(x),x);

df3(x):=diff(f3(x),x);

df3(x);

df3(2);

kill(df3);

df3(x):=subst(x,y,diff(f3(y),y));

df3(x);

df3(2);

diff(f3(x),x,2);

diff(df3(x),x);

diff(f3(x),x,2)-diff(df3(x),x);

k:3$w:2$

draw2d(
    color=red,
    explicit(f3(x),x,0,2),
    color=blue,
    explicit(df3(x),x,0,2) );

f(x);

integrate(f(x), x);

integrate(f(x), x, 0, 10);

'integrate(f(x), x, 0, 10);

f4(x):=1/(x^2+1);

diff(f4(x),x);

integrate(f4(x),x);

'integrate(%e**sqrt(a*y),y,0,4);

integrate(%e**sqrt(a*y),y,0,4);

changevar(%i89,y-z^2/a,z,y);

assume(a>0);

integrate(%e**sqrt(a*y),y,0,4);

integrate(x^b*exp(-x),x,0,inf);

integrate(x^b*exp(-x),x,0,inf);

integrate(x^b*exp(-x),x,0,inf);

integrate(x^c*exp(-x),x,0,inf);

integrate(x^4*exp(-x),x,0,inf);

integrate(sin(x)/x, x);

integrate(sin(x)/x, x, 0, 1);

romberg(sin(x)/x, x, 0.01, 1);

quad_qags(sin(x)/x, x, 0.01, 1);

? quad_qags;

## Series de Taylor

f5(x):=(%e^x-1)/x;

taylor(f5(x),x,0,8);

? taylor;

f6(x):=f5(x)/sinh(x)^3;

taylor(f6(x),x,0,7);

taylor(f6(x),x,1,7);

## Ecuaciones diferenciales

diff(y,x);

'diff(y,x);

ode2('diff(y,x)=y,y,x);

ode2('diff(y,x,2)-3*'diff(y,x)+5*y=4*x^3-2*x,y,x);

ode2('diff(y,x,2)^2-3*'diff(y,x)+5*y=4*x^3-2*x,y,x);

ode2('diff(y,x,2)=4*x^3,y,x);

## Ejercicios

1)Dibuje y calcule los extremos relativos de f(x)=x^3-x.
2)Defina una función g(x). Dibuje, calcule los extremos relativos,
y determine las asíntotas de g(x) si existen.
3) Determine el área encerrada entre las curvas f(x) y g(x) y las rectas
x=0 y x=2.
4)Resuelva los siguientes problemas de valores iniciales 
    4.1)y'' - 2y' + 2y=0; y(pi/2)=0; y'(pi/2)=-1
    4.2)y'' - y = x + 3sen(x); y(0)=2; y'(0)=3