• HOME
  • PUBLICATIONS
  • RESEARCH INTERESTS
  • CONTACTS
  • Teaching
  • RANDOM WORDS
  • FORTRAN .... OF COURSE!
  • Contents (Fortran)

Simple I/O instructions in Fortran

26/7/2017

0 Comments

 
Picture
Creative Commons License
This Picture by www.giuseppeforte.me is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
(Please, check the content section if interested in Fortran-related topics and maybe subscribe to the newsletter ;-) )
Hey there!
This is Giuseppe. In this post I am going to give you some advices on how to use the basic Input/Output (I/O) operations in Fortran. Stay tuned if you are interested in other programming languages, because I just started my journey  in Scientific Communication. Why communicating programming languages to the general public?  The reply to this question is actually easy. The first step towards a deep Scientific development cannot put the coding abilities away. Nowadays, coding means having a trusty tool to better understand Scientific results. That said, coding must be considered as something to bring to the general attention of the public. In my posts, you will find arguments related to Fortran, Matlab, Mathematica, R, C++ and much more...just give me the time. Divulgative posts on Science will also be discussed here...again: give me the time :-) 
So....let's start!
 
Using a high level programming language requires experience. However, some basic facts can be actually learned relatively fast. Such basic syntactic structures represent the foundations of any code, regardless the particular application.
Specific applications in Scientific programming (and also non scientific programming) require necessarily the knowledge of the most common Input/Output (I/O) operations: tell to your machine something, allow the machine to communicate you the result and...hope that your machine will not realize that it can solve problems faster and better than you :-) (that would make the machine equivalent to Skynet :-) ).
In this post, I am going to tell you about the basic I/O operations, using a high level programming language known as Fortran. 
Before starting working with Fortran or any other programming language, you might want to know how to edit, compile and run a Fortran code. Some info about all these processes are deeply described here.
In general, like any other programming language, the I/O operations you are allowed to perform using Fortran, could be summarized in four steps
  • Print data on the screen
  • Read data from the keyboard
  • Print on an external (user defined) file
  • Read data from an external (user defined) file 
​By making use of a simple example (the monte-carlo evaluation of Greek Pi ), I introduce all the above basic operations for the case of the Fortran language.  Two words about such technique are in order now. The evaluation of Greek Pi using a monte-carlo technique implies that we randomly throw N balls on a square with unitary side (here N is an integer much more greater than one). At this point, we just count all the balls fallen inside the circular sector of unitary radius (black balls in the picture) and we multiply such number by 4 and, at the same time, we divide the result by N. It is possible to show that the final number we obtain in this way is an approximation for Greek Pi. I hope you will enjoy the note.
Please, feel free to leave here any kind of comment. I will be really glad to reply to all your questions.

The material about the I/O operations can be found here. Have fun !!!!! :-)    
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Author

    Personal blog: http://www.giuseppeforte.me/

    Archives

    July 2017

  • HOME
  • PUBLICATIONS
  • RESEARCH INTERESTS
  • CONTACTS
  • Teaching
  • RANDOM WORDS
  • FORTRAN .... OF COURSE!
  • Contents (Fortran)