In this question you will have to test series of four numbers to verify that they follow the pattern of Fibonacci series: i.e. given the the first two numbers in the serie, the next one is the sum of the vious two previous numbers and so on. For example, if the two first numbers are 0 and 1, then the third number is 1, then 2, then 3 and then 5, 8, 13....
You will be reading in 4 numbers at a time, testing the third and forth one to check if they follow the serie's property. If they do, you should output the first 4 numbers together with the next two rs numbers that would continue that particular serie. If either the th third or the forth number is incorrect, you should indicate which number was found wrong and output, still, the 6 numbers of the serie. As soon as a number is found to be wrong, you can stop checking and l just go on and compute the rest of the serie.
You also have to keep track of how many series of numbers you treated and print out the total series treated at the end of your output. Data to be used is provided below.
Your FORTRAN program should be able to process as many lines of data as the user provides. Your output may look like this:
Series 1 : 2 5 7 12 19 31 Series 2 : Fourth number - 2 - was wrong. -2 3 1 4 5 9
Number of series treated : 2.
Stop your program by testing for an "empty" data line such as:
0 0 0 0
See that you DOCUMENT your program clearly, and identify the
following different sections:
Your program should put out a title to identify what it does. Output data should be neatly lined up, as shown in the example.
Here is the data to use - feel free to add extra series if you want to:
1 4 5 9 -3 -5 -8 13 0 -5 14 -9 0 1 1 2 1.5 3.3 4.8 8.1 0.9 -0.1 1.2 1.1
The square of the sine function can be represented by the following formula:
In the general case:
That is the sum with n going from 1 to infinity of the terms above.
Write a FORTRAN program to evaluate this series for an input value of x. Printing the results after 2, 4, 6, 8, 10, 12 and 14 terms and comparing the true solution (using the built-in function SIN(x)).
The output should have following form:
NUMBER of SERIES INTRINSIC ABSOLUTE TERMS SUMMATION FUNCTION DIFFERENCE 2 ... ... ... 4 ... ... ... 6 ... ... ... 8 ... ... ... 10 ... ... ... 12 ... ... ... 14 ... ... ...
Repeat this table for three different values of X.