Answered step by step
Verified Expert Solution
Question
1 Approved Answer
. The double sum starts in the lower left corner, goes up the column 1 values, then down to the bottom of column 2 then
The double sum starts in the lower left corner, goes up the column values, then down to the bottom of column then up and so on
In theory, the result should be more accurate as n gets large. BUT as n gets very large, the error actually increases!!
Indeed, the errors for n and are listed below
Grid Sizen x n Relative Error
ne
ne
ne
neWTH
Your Job: Add up the numbers fxy in the grid in different way in order to reduce rounding error for large n
New Strategy: Introduce a new variable columnSum that is initialized as in the outer loop, but before the inner loop. Replace mySum mySum Fxy in the inner loop with columnSumcolumnSum Fxy After the inner loop, but still inside the main loop, increment mySum: mySummySumcolumnSum
Table : Errors for your revised method of adding the numbers
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