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...
R-S-P Requirement: - write one C++ program that mimics the Rock-Scissor-Paper game. This program will ask...
R-S-P Requirement: - write one C++ program that mimics the Rock-Scissor-Paper game. This program will ask user to enter an input (out of R-S-P), and the computer will randomly pick one and print out the result (user wins / computer wins). - User's input along with computer's random pick will be encoded in the following format: -- user's rock: 10 -- user's scissor:          20 -- user's paper:            30 -- comp's rock:            1 -- comp's scissor:        2 -- comp's...
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 <-...
Python programming Write a program that prompts the user to input the three coefficients a, b,...
Python programming Write a program that prompts the user to input the three coefficients a, b, and c of a quadratic equationax2+bx+c= 0.The program should display the solutions of this equation, in the following manner: 1. If the equation has one solution, display ONE SOLUTION:, followed by the solution, displayed with4 digits printed out after the decimal place. 2. If the equation has two real solutions, display TWO REAL SOLUTIONS:, followed by the two solutions, each displayed with4 digits printed...
Your assignment is to implement a computer program in C++ to implement the below application. According...
Your assignment is to implement a computer program in C++ to implement the below application. According to Dummies.com the following algorithm determines the amount of paint you need to paint the walls of a four-sided room: 1. Add together the length of each wall. (For example, if each of the four walls are 14, 20, 14, 20 feet respectively then the total length is 14 + 20 + 14 + 20 = 68 feet) 2. Multiply the sum by the...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT