# Tema 4   Sucesiones numéricas

04-1. Definición de sucesiones. 
          Operaciones con sucesiones

kill(all)$

## Definición de sucesiones

s01[n]:=(2*n-1)/(3*n+2);

s01[1];     s01[10];        s01[20];

makelist(s01[n], n, 1, 10);

makelist(s01[n], n, 1, 5),numer;

s02[n]:=sin(1/n);

makelist(s02[n], n, 1,5);

s03[n]:=sin(n);

makelist(s03[n], n, 1, 5);

s04[n]:=(-1)^n;

makelist(s04[n], n, 1, 5);

s05[n]:=(-1)^n/n;

makelist(s05[n], n, 1, 5);

s06[n]:=n^2;

makelist(s06[n], n, 1, 5);

s07[n]:=-n^2+3;

makelist(s07[n], n, 1, 5);

s08[n]:=1+(-1)^n/n;

 makelist(s08[n], n, 1, 5);

## Sucesiones recurrentes

s10[1]:3$           s10[n]:=sqrt(2+s10[n-1]);

makelist(s10[n], n, 1, 5);

s12[1]:3$           s12[n]:=(1/2)*(s12[n-1]+3/s12[n-1]);

makelist(s12[n], n, 1, 5);

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

makelist(FIB[n], n, 1, 10);

## Operaciones con sucesiones

s20[n]:=s01[n]+s03[n];

makelist(s20[n], n, 1, 5);

s21[n]:=s01[n]-s03[n];

makelist(s21[n], n, 1, 5);

s22[n]:=2*s01[n]+3*n*s02[n];

makelist(s22[n], n, 1, 5);

s23[n]:=s02[n]*s03[n];

makelist(s23[n], n, 1, 5);

s24[n]:=s05[n]/s06[n];

makelist(s24[n], n, 1, 5);

## Representación gráfica de sucesiones

N[n]:=n$          
List_0:makelist(N[n], n, 1, 40)$

List_1:makelist(s01[n], n, 1, 40)$
wxplot2d([discrete,List_0,List_1], [style, [points, 2,1,1]] , [xlabel, ""] , [ylabel, ""]  )$

List_2:makelist(s03[n], n, 1, 40)$
wxplot2d([discrete,List_0,List_2], [style, [points, 2,2,2]] , [xlabel, ""] , [ylabel, ""] )$

List_3:makelist(s06[n], n, 1, 40)$
wxplot2d([discrete,List_0,List_3], [style,[points, 2,3,3]] , [xlabel, ""] , [ylabel, ""] )$

List_4:makelist(s07[n], n, 1, 40)$
wxplot2d([discrete,List_0,List_4], [style, [points, 2,4,4]] , [xlabel, ""] , [ylabel, ""] )$

List_5:makelist(s08[n], n, 1, 40)$
wxplot2d([discrete,List_0,List_5], [style, [points, 2,3,4]] , [xlabel, ""] , [ylabel, ""] )$

## Término general variable

a[n]:=sum(1/sqrt(n^2+3*k), k, 1, n);
a[1];     a[3];     a[5];

a[10];

a[20];