Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started