Question: In Python Please In Python Please CompensatedSum (list or array x) 1.n = length of x 2.c = 0 3.s = x 0 4. for

In Python Please

In Python Please In Python Please CompensatedSum (list or array x) 1.n

In Python Please

CompensatedSum (list or array x)

1.n = length of x

2.c = 0

3.s = x0

4.for i =1 to n1 do

5.y = c + xi

6.t = s + y

7.c = (s t) + y

8.s = t

9.end-for

10.return s

Programming exercise: Compensated Sum (also knowns a Kahan sum). Write a function to calculate the compensated sum of a sequence of numbers. Mod- ify the algorithm to keep track of the largest absolute value of the compensated error term Provide a driver program that reads all of the numbers (real values, whitespace separated) from standard input, computes the compensated sum of the numbers, and writes to standard output the sum and the largest absolute value of the compensated error term

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!