First Step to Computer Programming With FORTRAN 90

June 1, 2016 | Author: Omed Ghareb | Category: Types, School Work, Essays & Theses
Share Embed Donate


Short Description

Some simple programs in Fortran 90 for first stage of Physics Department, in College of Science, at University of Sulaim...

Description

Kurdistan Iraqi Region Ministry of Higher Education University of Sulaimani College of Science Physics Department

First step to Computer Programming With FORTRAN 90 First stage Dr. Dlear R. Saber Dr. Omed Gh. Abdullah Mr. Ary A. Abdulrahman Mr. Shaho Osman

2009 - 2010

Problem (1): Write a Fortran program to calculate the value of function 𝒇𝒇(𝒙𝒙); where x= [-5, 0, 5]: (𝐱𝐱 > 0) 𝐭𝐭𝐭𝐭𝐭𝐭−𝟏𝟏 (𝐱𝐱) + 𝐞𝐞𝐱𝐱 (𝐱𝐱 = 𝟎𝟎) 𝐟𝐟(𝐱𝐱) = � 𝟎𝟎 Solution: read*, x if(x>0) then y=Atan(x) +exp(x) print*, x, y elseif(x0) goto 50 z=(x+y)**3/(x+z) w=x**2+2*z goto 70 50 z=abs (x)+(x+y) w=z/abs(x+z) 70 print*, z,w read*, choice if (choice==0) exit enddo end

(𝐱𝐱 + 𝐲𝐲)𝟑𝟑 (𝐱𝐱 + 𝐳𝐳) 𝐱𝐱 � 𝐱𝐱 < 0 𝐰𝐰 = 𝐱𝐱 𝟐𝟐 + 𝟐𝟐𝟐𝟐

𝐳𝐳 =

#################################################################################

2

Problem (3): Write a Fortran program to calculate exponential of (1) from library function (𝑬𝑬𝑬𝑬𝑬𝑬) and from the following series up to (15): 𝐱𝐱 𝟐𝟐 𝐱𝐱 𝟑𝟑 𝐱𝐱 𝟒𝟒 𝐱𝐱 𝐞𝐞 = 𝟏𝟏 + 𝐱𝐱 + + + + ⋯ 𝟐𝟐! 𝟑𝟑! 𝟒𝟒! Solution: x=1 s=1 do i=1,15 f=1 do j=1,i f=f*j enddo s=s+x**i/f enddo print*,s,exp(x) end ################################################################################# Problem (4): Write a Fortran program to calculate exponential of (1) from library function (𝑬𝑬𝑬𝑬𝑬𝑬) and from the following series up to (15), [without using do-loops]: 𝐱𝐱 𝟐𝟐 𝐱𝐱 𝟑𝟑 𝐱𝐱 𝟒𝟒 𝐞𝐞𝐱𝐱 = 𝟏𝟏 + 𝐱𝐱 + + + + ⋯ 𝟐𝟐! 𝟑𝟑! 𝟒𝟒! Solution: x=1 b=1 n=0 s=1 10 n=n+1 if (n
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF