Write c program for estimating adding numbers in two-d grid

Assignment Help C/C++ Programming
Reference no: EM131390747

Assignment- Coding Problems:

1. Matlab. Complete the quadratic equation solver yournameQuadEqn.m. See the comments at the top for specific directions, but the main idea is to avoid loss of significance by re-writing one of roots

r1 = {-b + √(b2 - 4ac)} / 2a, r1 = {-b - √(b2 - 4ac)} / 2a.

• The formula for the root r1 has potential loss of significance when b >0 and b2 >4ac; The second root r2 is best left as is.

• The formula for the root r2 has potential loss of significance when b <0 and b2 >4ac. The first r1 is best left as is.

2. Write a C program for estimating adding numbers in a 2D grid. See the file yournameGridSum.cto get started. This program will exhibit the effect of cumulative rounding error (caused by adding a lot small values.) Consider an N × N grid (we'll use N = 5000) dividing up the unit square into smaller squares. Therefore each subsquare has width w = 1/N. Let (xi,yj) denote the midpoint of the square in column i, row j.

Note that
xi = (i- 0.5) ∗ w

Your job is to compute the double sum

459_Double Sum.jpg

For N large, the value of S should approach 2. You will compute S in two different ways: I. Summing up the numbers 1 by 1 in a nested for loop.

PSEUDOCODE

Initialize: width=1/N; sum1=0;

for loop: row=1 to N for loop: col=1 to N x = (col -0.5)* width y = (row - 0.5)*width sum1 = sum1 + (x*x + y*y)
end of inner loop

end of outer loop finalResult1= 3*width*width*sum1

II. Sum all the number in a row, then add to overall sum.

PSEUDOCODE

Initialize: sum2=0;

for loop: row=1 to N

rowSum=0; y= (row - 0.5)*width for loop: col=1 to N x = (col -0.5)*width rowSum = rowSum + (x*x + y*y)
end of inner loop sum2=sum2+ rowSum
end of outer loop finalResult2= 3*width*width*sum2.

Reference no: EM131390747

Questions Cloud

Explain whether sears is correct in given contention : Sears contends the order is too broad, because it covers appliances other than dishwashers and includes ‘‘performance claims'' as well. Explain whether Sears is correct.
What type of rule may the cpsc issue for atvs : According to CPSC staff, children under the age of sixteen accounted for roughly half the deaths and injuries associated with this product. What type of rule, if any, may the CPSC issue for ATVs?
Explain whether colgate has engaged in unfair trade practice : Colgate defended on the ground that the consumer was merely being shown a representation of the actual test.- Explain whether Colgate has engaged in an unfair or deceptive trade practice.
Find maximum acceleration of the center of the cylinder : A 30-lb uniform cylinder can roll without sliding on a 15°-incline. A belt is attached to the rim of the cylinder, and a spring holds the cylinder at rest in the position shown.
Write c program for estimating adding numbers in two-d grid : Write a C program for estimating adding numbers in a 2D grid. See the file yournameGridSum.cto get started. This program will exhibit the effect of cumulative rounding error (caused by adding a lot small values.).
Is robert entitled to the information : Robert demands to know why the loan was rejected, but Northern refuses to divulge the information, arguing that it is privileged. Is Robert entitled to the information?
Running case study dirty pools : 1. would off-the-iob training be an appropriate and effective way to train pool operat oo? and their employees? Explain your answer.2. what off.theiob training methods would you recommend to train pool operaton and their employees? Review each of the..
How much can visa collect from thomas : Thomas does not discover that he has lost his wallet until the following day, when he promptly notifies his Visa bank. How much can Visa collect from Thomas?
Will visa prevail in given contention and why : Brown's refuses to repair or replace it or to credit Francie's account. Francie therefore refuses to pay Visa for the television. Visa brings a suit against Francie. Will Visa prevail? Why?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd