# Create a MSWord or NOTEPAD file that describes a step by step process for each of the scenarios give

Create a MSWord or NOTEPAD file that describes a step by step process for each of the

scenarios given below.

1. Many properties in engineering and science can be analyzed by trying to fit a straight line which uses x as the independent variable and y as the dependent variable. Suppose you have an array of x values and a corresponding array of y values. Write the process to fit a straight line to the data. Using the scenario y = mx + b, where m is the slope and b is the y intercept, m can be calculated by the formula

2. In numerical analysis the average and standard deviation is often calculated. The average or mean is given by the formula

Average = Sx/n

where n is the number of x values.

The standard deviation is a measure of scatter and is given by the formula

Standard deviation = ((S(x – x) is the average x, and n is the number of x values.

Suppose you have an array of x values write the process to calculate the average and standard deviation for these values.

3. The area under a curve can represent stored energy or other important properties. The area under a curve may be approximated by dividing the area into trapezoids, calculating the area of each trapezoid, and then summing those smaller areas. For example, using the diagram below, the area under the curve for the region from a to b could be approximated by dividing the region into 5 smaller areas. The first area can be defined by a, f(a), x

4). The total area under the curve from a to b would be the sum of the 5 trapezoids.

In many engineering /science applications you may collect digital x-y data and you may

not know the actual function for a line connecting these points. However, you can still use the theory presented above to integrate under a curve generated by the x-y data sets. The first trapezoid can be formed from the first x-y set and the second x-y set, (the difference in the x values would be the base and the y values would be the heights). Then the second trapezoid would use the second x-y set and the third x-y set. The third trapezoid would use the third x-y set and the fourth x-y set, and so on.

Suppose you have an array of x values and another array of corresponding y values. Write the algorithm to calculate the area under the curve for these values.