Description
1 Exercices
different results are obtained if the series is summed in ascending or descending order.
(a) Why the associative property is not fulfilled?
(b) What order is more accurate?. why?
(c) Write a function called sumSeriesA with the number of terms to be taken into account as the argument. The output of the function should be the first n terms summed in ascending order.
(d) Write a function called sumSeriesD but in this cases summing terms in descending order.
(e) Write a program sumSeries in python using both functions to compare the results
(f) Find out the n value from which different results are obtained. Explain why this n value is obtained.
Hints:
(a) Print results with 20 significant digits.
(b) Plot the difference between the two values.
(c) Plot the difference between each value and the real one.
ax2 + bx + c = 0
roots of this equation are given by the following equivalent expressions:
1
(1)
(2)
In these equations the addition becomes delicate and round-off error-probe whenever b > 0 and under the condition |ac| << b2. If either a or c or both is small, then one of the roots will involve the subtraction of b from a very nearly equal quantity (the discriminant). The correct way to compute the roots is
(3)
Then the two roots are
(4)
(a) Show the equivalence between the three previous expressions
(b) Write functions quadratic1, quadratic2 y quadratic3 with parameters a, b and c as arguments and roots using the different expressions as output.
(c) Find out and example where the results are different. Explain the result.
(d) Which is the correct result?. Why?
2




Reviews
There are no reviews yet.