Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2= n n i=1 n + 1 12 + 11 1. Given a list of positive real values, 21, 22, ..., Ir, the central tendency

image text in transcribedimage text in transcribedimage text in transcribed

2= n n i=1 n + 1 12 + 11 1. Given a list of positive real values, 21, 22, ..., Ir, the central tendency of the list can be measured by the arithmetic mean, the geometric mean, or the harmonic mean. These three means are defined as follows: 1 arithmetic mean (71 (21 + x2 + ... + xn) geometric mean 31.12....2 (ie. the nth root). harmonic mean + The median is the value in the list that has half of the numbers larger than it, and half of the numbers smaller than it. Two additional statistical measures of data are the variance and the standard deviation. The variance is the average of the squares of the deviations of the numbers from the mean, 1 variance (li )2 i=1 where T is the arithmetic mean. The standard deviation is the square root of the variance. The variance and standard deviation provide a description of the spread of the data. (a) Write a Fortran program to create a data file of random values between 1 and 100. The number of values contained in this file should also be random, between 10 and 100. You can use the built-in random number generation subroutines to generate the values required (see Example 4 in Lecture 12). (b) Using the data file created above as input, write a Fortran program to com- pute and display the arithmetic mean, geometric mean, harmonic mean, median, variance, and standard deviation of the values. Ask the user for the name of the data file, and have your program read to the end of the file. Your program should include a separate external function for each of the 6 measures calculated. Be sure to include an interface within your program. You can use the code from Lecture 14 as a starting point for your solution. To calculate the product for the geometric mean you may need to store a value that is larger than can be stored in a 32-bit floating point variable. To use double precision in Fortran, replace REAL in your declaration with REAL (KIND=8). To calculate the median value you will need to sort the data, for which you can make use of the subroutine contained in the sort.f08 file available with this Problem Set. This subroutine can be included in your source code file as an external subroutine. SUBROUTINE Sort(x,n) REAL, INTENT (INOUT) :: x(n) INTEGER, INTENT (IN) :: n INTEGER :: i,j DO i=1, n-1 smallest = x(i) location = i DO j=i+1, n IF (x(j)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions