Question

Use C++ to design a program: Your program will use three different 5-point numerical quadrature methods...

Use C++ to design a program:
Your program will use three different 5-point numerical quadrature methods
(Closed Newton Cotes, Gaussian Quadrature, and Lobatto Quadrature)

You will employ each of these methods to solve each of the following three problems to find the area under the respective curves over the interval (-1, 1).

The following is a plot of the first function f(x) = 1 - sin(1 - x)   

The true area under the curve is (to 20 digits) 0.58385316345285761300.
             

The following is a plot of the second function f(x) = sqrt(x + 1) + 1

The true area under the curve is (to 20 digits) 3.8856180831641267317


The following is a plot of the third function f(x) = tanh(x+1)
The true area under the above curve is (to 20 digits) 1.3250027473578644309

First, print out the values of the weights and the nodes for each quadrature formula,
Then for each function (or curve), print out your approximation to the area under the curve
,
the true value of the area, and the error in the approximation for each of the three quadrature formulae.

Note: For Lobatto quadrature, the nodes are x[1] = -1, x[2] = -sqrt(3/7), x[3] = 0, x[4] = sqrt(3/7), and x[5] = 1.
The weights are w[1] = 1/10, w[2] = 49/90, w[3] = 32/45, w[4] = 49/90, and w[5] = 1/10
.

Homework Answers

Answer #1
  • The following is a plot of the first function f(x) = 1 - sin(1 - x)
  • The true area under the above curve is (to 20 digits) 0.58385316345285761300

  • The following is a plot of the second function f(x) = sqrt(x + 1) + 1

The true area under the above curve is (to 20 digits) 3.8856180831641267317

  • The following is a plot of the third function f(x) = tanh(x+1)
  • The true area under the above curve is (to 20 digits) 1.3250027473578644309
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Use a weighted score model to choose between three different financing methods (A,B,C) for a project....
Use a weighted score model to choose between three different financing methods (A,B,C) for a project. The relative weights for each criterion are shown in the following table, as are the scores for each, the higher the value, the more favourable the score. Project Characteristics Weigh A B C Consulting Cost 20 1 2 3 Acquisition period 10 2 3 1 Disruption 10 2 1 3 Project risk 10 3 3 2 Required infrastructure 20 1 2 2 required equipment...
Use the rectangles to approximate the area of the region. (Round your answer to three decimal...
Use the rectangles to approximate the area of the region. (Round your answer to three decimal places.) The x y-coordinate plane is given. There is 1 curve, a shaded region, and 4 rectangles on the graph. The curve enters the window in the first quadrant, goes down and right becoming less steep, passes through the point (1, 5), passes through the point (5, 1), and exits the window almost horizontally above the x-axis. The region below the curve, above the...
This is in java and you are not allowed to use Java API classes for queues,...
This is in java and you are not allowed to use Java API classes for queues, stacks, arrays, arraylists and linkedlists. You have to write your own implementations for them. You should construct a BST by inserting node values starting with a null tree. You can re-use the code for the insert method given in the sample code from the textbook. -insert method is provided below Your code should have a menu driven user interface at the command line with...
Write a C++ program to demonstrate thread synchronization. Your main function should first create a file...
Write a C++ program to demonstrate thread synchronization. Your main function should first create a file called synch.txt. Then it will create two separate threads, Thread-A and Thread-B. Both threads will open synch.txt and write to it. Thread-A will write the numbers 1 - 26 twenty times in nested for loops then exit. In other words, print 1 - 26 over and over again on separate lines for at least 20 times. Thread-B will write the letters A - Z...
ONLY NEED VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to show...
ONLY NEED VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to show that the power method can be used to calculate the largest eigenvalue and corresponding eigenvector of a covariance matrix. A. Generate the data: x <- rnorm(100000) dim(x) <- c(500,200) x <- x* 1:9 x[,1] <- x[,1]*2+ x[,3] + x[,20] x[,5] <- x[,5]*3+ x[,3] +2* x[,20] B.Calculate the covariance matrix and its powers vx <- var(x) vx2 <- vx%*%vx vx4 <- vx2%*%vx2 vx8 <- vx4%*%vx4...
ONLY NEED OUTPUT VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to...
ONLY NEED OUTPUT VALUES FOR C AND D. PLUS FINAL PLOT Use the following code to show that the power method can be used to calculate the largest eigenvalue and corresponding eigenvector of a covariance matrix. A. Generate the data: x <- rnorm(1000) dim(x) <- c(50,20) x <- x* 1:9 x[,1] <- x[,1]*2+ x[,3] + x[,20] x[,5] <- x[,5]*3+ x[,3] +2* x[,20] B.Calculate the covariance matrix and its powers vx <- var(x) vx2 <- vx%*%vx vx4 <- vx2%*%vx2 vx8 <-...
A study of reading comprehension in children compared three methods of instruction. The three methods of...
A study of reading comprehension in children compared three methods of instruction. The three methods of instruction are called Basal, DRTA, and Strategies. As is common in such studies, two pretest variables were measured before any instruction was given. One purpose of the pretest was to see if the three groups of children were similar in their comprehension skills prior to the start of the study. The READING data set described in the Data Appendix gives two pretest measures that...
1) Derive the quotient rule ( f g ) ′ = (f ′ ⋅ g −...
1) Derive the quotient rule ( f g ) ′ = (f ′ ⋅ g − f ⋅ g ′ )/g 2 using the product rule and the chain rule. I was able to get this with product rule(i think) but unsure how to use chain rule 2) Identify a rate of accumulation (or decay) in your life that changes over time. Be creative. a) Describe it in a sentence or two: the rate of accumulation of pages read this...
Java code Problem 1. Create a Point class to hold x and y values for a...
Java code Problem 1. Create a Point class to hold x and y values for a point. Create methods show(), add() and subtract() to display the Point x and y values, and add and subtract point coordinates. Tip: Keep x and y separate in the calculation. Create another class Shape, which will form the basis of a set of shapes. The Shape class will contain default functions to calculate area and circumference of the shape, and provide the coordinates (Points)...
1. (5pts.) Compute the derivative dy/dx for y = 7√ 9π + x ^5 /6 +...
1. (5pts.) Compute the derivative dy/dx for y = 7√ 9π + x ^5 /6 + 27e^x . 3. (5pts.) Write the equation of the tangent line to the graph of y = 3 + 8 ln x at the point where x = 1. 4. (5pts.) Determine the slope of the tangent line to the curve 2x^3 + y^3 + 2xy = 14 at the point (1, 2). 5. (5pts.) Compute the derivative dw/dz of the function w =...