Due: Friday, 22 September 2017
Since we have where is defined by the equation
[For MathML impaired browsers:]
The function is called the Lambert W function. See the Citizendium page on the Lambert W function and there is even a Lambert W poster.
The plot on the left is the Lambert W function, the plot on the right is the the proportion of the population ultimately affected by an epidemic for different values of .
Read from the standard input stream and write to the standard output stream. (There is no need to open any files.)
The input will consist of several (maybe thousands of) testcases each on a line. Each testcase consists of a pair of numbers and separated by at least one space. The integer is greater than one and less than or equal to a billion. It is the number of people in the population. The real number is greater than or equal to one and less than . It is the expected number of other people a person is in close contact with.
The output is the total number of people (rounded to the nearest whole number) in the population expected to become infected. Output each answer on a line by itself.
For the input:
2345 1.45678 4283 3.2347the output would be:
1298 4088Read to the end of the standard input stream and have no output other than the numbers. Do not prompt for input. There should be one line (one number) input pair of input numbers.
Test your program. You can use Wolfram alpha (cf. Lambert W Function) to get high precision answers. Like many numeric problems, it is not easy to get accurate answers in all cases.
$ gfortran --version GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609The GNU Fortran compiler implements ISO/IEC 1539:1997 (Fortran 95). It also supports the ISO/IEC TR-15581 enhancements to allocatable arrays. GNU Fortran also has partial support for ISO/IEC 1539-1:2004 (Fortran 2003), ISO/IEC 1539-1:2010 (Fortran 2008)
Stephen J. Chapman.
Fortran 90/95 for Scientists and Engineers.
McGraw-Hill, New York, New York, 1997
Fortran 95 Language Guide.
Springer-Verlag, Berlin, Germany, 1996
Michael Metcalf and John Ker Reid.
Fortran 90/95 Explained.
Oxford University Press, Oxford, United Kingdom, 1996
You may work in groups of no more than two people. You may not work with the same person on any of the remaining projects. If in a group of two, make sure both names are in the program and turn in the assignment from just one account. By the due date, turn in your source program. At the beginning of your source file include the following header information in comments:
! Author: name1, e-mail address ! Author: name2, e-mail address ! Course: CSE 4250, Fall 2017 ! Project: Proj1, Spread of EpidemicsIf working in a group, just submit the assignment once; it does not matter who submits.
Turn in the Fortran source code for the program using the submission server. You will need a control code from the submit server in order to submit. After registering the submit server will e-mail the control code to you. Be sure to check your spam folder! The file name to submit must be epidemics.f95 and the project is proj1. Be sure your name is in comments at the beginning of your program as required in the standard header for this class. For your convenience, here is a submission form for this assignment.