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

  Linear programming feasible region

Enumerate all points in the linear programming feasible region in which both x1 and x2 are integers, and show that the feasible solution obtained in (c) is not optimal and that in fact the optimal integer is not obtained by any form of rounding.

  What is normalization and what is functional dependency

How does Tuple-oriented relational calculus differ from domain-oriented relational calculus. What is normalization? What is Functional Dependency?

  Calculation of mortgage interest rates

Instruction of pointers and the calculation of mortgage interest rates.

  Write a declaration for s structure named car

Write a declaration for s structure named cars. The fields in the record should include make, model, year and cost. Include a constructor to initialize the value in the structure.

  What are the operations done on tupples

What are tuples in c++? What are the operations done on tupples?

  Extend the definition of the class clocktype by overloading

a. Extend the definition of the class clockType by overloading the post-increment operator function as a member of the class clockType

  Convert infix to postfix expression

For every postfix expression there exists a corresponding and uniquely defined infix expression that evaluates to the same number.

  Implement the simplified expression using and

Find the complement of F(A,B,C) = AB + (BC' * A) and reduce it. Show your work for the reduction using the axioms of Boolean Algebra. Then, implement the simplified expression using AND, OR, and NOT gates.

  Determining the advanced programming techniques

Joe has joined FIT technologies recently as a software developer. He is a fresher and does not know advanced programming techniques. To include him in the team that is developing the application, Damien, the Project Manager, decides to conduct a t..

  Creates a string concat primes of given length

creates a string concat primes of length 1000 from the first k prime numbers by concatenating them as strings. (You have to decide on the value of k).

  Problem regarding the relational algebra

A database records information about tutorials in a particular unit offering (such as ICT285 this semester). A student is supposed to attend only one of several available tutorials, each of which is taken by a tutor at a particular day and time. A..

  Write a function to print the data of a student

Write a function to print names of all students who joined in a particular year. Write a function to print the data of a student whose roll number is given.

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