Fortran 2003 Book Pdf
Program xarray! Demonstrate array constructor and intrinsic functions implicit none integer, parameter:: n = 3 integer:: vec ( n ) vec = ( / 9, 4, 1 / )! Set vec(1) to 9, vec(2) to 4, vec(3) to 1 write (.,. ) 'vec = ', vec! Print each element of vec write (.,. ) 'vec(1) = ', vec ( 1 ), ', vec(3) =', vec ( 3 )!
Fortran: shall we start? You know already one computer langage? You understand the very basic concepts: – What is a variable, an assignment, function call, etc.? – Why do I have to compile my code? – What is an executable? You (may) already know some Fortran? You are curious about what comes next? How to proceed from old Fortran, to much more modern.
Print the 1st and 3rd elements write (.,. ) 'size(vec), sum(vec), product(vec) = ', & size ( vec ), sum ( vec ), product ( vec ) write (.,. ) 'minval(vec), maxval(vec) = ', minval ( vec ), maxval ( vec ) vec = vec + 2!
Add 2 to each element of vec write (.,. ) 'vec = ', vec! Print each element of vec vec = vec.
2! Square each element of vec write (.,.
For precision work, pick up the pressure-sensitive pen to draw, sketch, edit photos, and add handwritten elements to your creations.wacomdriver.com provides complete information about driver and software for Wacom Bamboo Fun to make installation. Download Wacom Bamboo Fun Driver For Windows 10/8/7 And Mac Digital drawing And Graphics tablet Free. Wacom bamboo one cte 660 driver for mac. Bamboo Fun lets you get hands-on with your creative projects, giving you the benefits of Multi-Touch along with the comfort and precision of Wacom’s ergonomically-designed pen. With Multi-Touch, you can navigate, scroll, and work with simple gestures in an area larger than on mobile devices or laptop trackpads.
) 'vec = ', vec! Print each element of vec end program xarrayoutput:vec = 9 4 1vec(1) = 9, vec(3) = 1size(vec), sum(vec), product(vec) = 3 14 36minval(vec), maxval(vec) = 1 9vec = 11 6 3vec = 121 36 9loops Fortran uses do loops for iteration. For example, the program. Program xloop implicit none integer:: i do i = 1, 3 write (.,. ) i, i.
2 end do write (.,. ) 'i=', i do i = 1, 4, 2 write (.,. ) i end do write (.,.
) 'i=', i end program xloopgives output1 12 43 9i= 413i= 5because within the first loop, variable i takes on values between 1 and 3 with step size of 1, and in the second loop the step size is 2. After completing the loop the value of i is its last value before leaving the loop plus the step size.comparison operators Fortran has the comparison operators = , where /= means 'not equal' and the other operators have the usual meanings. Program xfibonacci! Print Fibonacci numbers up to maxfib implicit none integer, parameter:: maxfib = 10 integer:: i, fib, fib1, fib2 i = 0 fib = 0 fib1 = 0 fib2 = 0 write (.,. ) 'Fibonacci numbers maxfib ) exit write (.,. ) fib i = i + 1 if ( i 1 ) then fib = fib1 + fib2 else fib = 1 end if fib2 = fib1 fib1 = fib end do end program xfibonacciDeclaring maxfib a parameter means that its value cannot be changed in the rest of the program.nested loops Loops can be nested, as shown in the following program. Module convertmod implicit none contains subroutine celsfromfahr ( degreesfahr, degreescels ) real, intent ( in ):: degreesfahr real, intent ( out ):: degreescels degreescels = ( degreesfahr - 32 ) / 1.8 end subroutine celsfromfahr end module convertmod program xtemperature use convertmod, only: celsfromfahr real:: degf, degc integer:: i write (., '(2a10)' ) 'degreesF', 'degreesC' do i = 12, 100, 20 degf = real ( i ) call celsfromfahr ( degf, degc ) write (., '(2f10.1)' ) degf, degc end do end program xtemperature See Also.
Guide to Fortran 2003 Programming by Walter S. BrainerdEnglish July 1, 2009 ISBN: 357 pages PDF 4.63 MbFortran has been the premier language for scientific computing since its introduction in 1957. Fortran originally was designed to allow programmers to evaluate for- las―FORmula TRANslation―easily on large computers.
Fortran compilers are now available on all sizes of machines, from small desktop computers to huge multiproc- sors. The Guide to Fortran 2003 Programming is an informal, tutorial introduction to the most important features of Fortran 2003 (also known as Fortran 03), the latest standard version of Fortran. Fortran has many modern features that will assist the programmer in writing efficient, portable, and maintainable programs that are useful for everything from “hard science” to text processing. Target Audience This book is intended for anyone who wants to learn Fortran 03, including those fam- iar with programming language concepts but unfamiliar with Fortran. Experienced Fortran 95 programmers will be able to use this volume to assimilate quickly those f- tures in Fortran 03 that are not in Fortran 95 (Fortran 03 contains all of the features of Fortran 95). This guide is not a complete reference work for the entire Fortran l- guage; it covers the basic features needed to be a good Fortran programmer and an - troduction to the important new features of Fortran 03. Many older error-prone features have been omitted and some of the more esoteric features that are new to F- tran 03 also are not discussed.