Está en la página 1de 3

PROGRAMACION DE INTEGRALES CON PSEINT

(Prof. Benjamin Sarmiento)

Ejemplo 1:

Funcion funcion1 <- f ( x )


funcion1<- sen(x)
Fin Funcion

Algoritmo RECTANGULOS

Escribir "Ingrese a";


Leer a;
Escribir "Ingrese b";
Leer b;
Escribir "Ingrese n";
Leer n;

h<- (b-a)/n;

area<-0;

Para k<-1 Hasta n Con Paso 1 Hacer


x1<-a+(k-1)*h;
x2<-a+k*h;
vx<-(x1+x2)/2;
area<-area+h*f(vx);
Fin Para

Escribir "";
Escribir "El area entre a = ",a," y b = ",b,"
es : ",area;

FinAlgoritmo
Ejemplo 2:

Funcion funcion1 <- f ( x )


funcion1<- sen(x)
Fin Funcion

Algoritmo TRAPECIOS

Escribir "Ingrese a";


Leer a;
Escribir "Ingrese b";
Leer b;
Escribir "Ingrese n";
Leer n;

h<- (b-a)/n;

area<-0;
svf<-0;
Para k<-1 Hasta n-1 Con Paso 1 Hacer
svf<-svf+f(a+k*h);
Fin Para

area<- (h/2)*(f(a)+f(b)+2*svf);

Escribir "";
Escribir "El area entre a = ",a," y b = ",b,"
es : ",area;

FinAlgoritmo
Ejemplo 3:

Funcion funcion1 <- f ( x )


funcion1<- 2+0.25*(x-3)^2
Fin Funcion

Algoritmo SIMPSON

Escribir "Ingrese a";


Leer a;
Escribir "Ingrese b";
Leer b;
Escribir "Ingrese n";
Leer n;

h<- (b-a)/n;
area<-0;
sfi<-0;
sfp<-0;
Para k<-1 Hasta n-1 Con Paso 2 Hacer
sfi<-sfi+f(a+k*h);
Fin Para

Para k<-2 Hasta n-1 Con Paso 2 Hacer


sfp<-sfp+f(a+k*h);
Fin Para

area<- (h/3)*(f(a)+f(b)+2*sfp + 4*sfi);

Escribir "";
Escribir "El area entre a = ",a," y b = ",b,"
es : ",area;

FinAlgoritmo

También podría gustarte