Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
program suma Implicit none Integer a,b,c,sum1 sum1=0 do a=1,100 sum1=sum1+a write(*,*) a,sum1 enddo end b) La estructura del programa para realizar es la siguiente: program suma Implicit none Integer a,b,c,sum1 sum1=0 do a=1,100 sum1=sum1+a**2 write(*,*) a,sum1 enddo end c) La estructura del programa para realizar 10! Es la siguiente: program factorial Implicit none Integer a,b,c,sum1 sum1=1 do a=1,10 sum1=sum1*a write(*,*) a,sum1 enddo end 2_ Calculo de derivadas, raices y graficos de funciones a) Para f(x)= X2-3 la estructura del programa es: program derivada Implicit none Integer a,b,nt real x,xi,xf,dx,f,der,yi,yf xi=-3
xf=3 dx=0.001 nt=( xf-xi)/dx write (*,*) nt x=xi do a=1, nt yi=x**2-3 x=x+dx yf= (x)**2-3 der=(yf-yi)/dx If (yf*yi.le.0) Then write (*,*) x endif enddo end El resultado de la raz de la funcin fue :
b) Para f(x)= X2-X-2 la estructura del programa es: Program derivada 2 Implicit none Integer a,b,nt real x,xi,xf,dx,f,der,yi,yf xi=-3 xf=3 dx=0.001 nt=( xf-xi)/dx write (*,*) nt x=xi do a=1, nt yi=x**2-3 x=x+dx yf= (x)**2-x-2 der=(yf-yi)/dx If (yf*yi.le.0) Then write (*,*) x endif enddo El resultado de la raz de la funcin fue :
-2.5
-2
-1.5
-1
-0.5
5 4 3 2 1 0 -1 0 -2 -3 -4 -5 -6
0.5
1.5
2.5
Series 1
c) Para f(x)= X4-18X3-111X2-262X+168 la estructura del programa es: program derivada Implicit none Integer a,b,nt real x,xi,xf,dx,f,der,yi,yf xi=-1 xf=10 dx=0.001 nt=( xf-xi)/dx write (*,*) nt x=xi do a=1, nt yi=(x*x*x*x)-18*(x*x*x)+111*(x**2) -262*x+168 x=x+dx yf= (x*x*x*x)-18*(x*x*x)+111*(x**2) -262*x+168 der=(yf-yi)/dx If (yf*yi.le.0) Then write (*,*) x endif enddo El resultado de la raz de la funcin fue :
800 600 400 200 0 -2 -200 -400 -600 -800 0 2 4 6 8 10 12 Seri es1
2.5 2 1.5 1 0.5 0 -1 -0.5 -1 -1.5 1 3 5 7 9 11 13 15 Series1 Series2 Series3 Series4 Series5