Implement the trapezoidal rule for integrating a function

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

Implement the Trapezoidal Rule for integrating a function. Use the following function:

double trap(double (*pf)(double x), double a, double b, int n) Here, pf points to the function f that is to be integrated, a and b bracket the interval [a, b] over which f is to be integrated, and n is the number of subintervals to use. For example, the call trap(square,1,2,100) would return 1.41421. The Trapezoidal Rule returns the sum of the areas of the n trapezoids that would approximate the area under the graph of f. For example, if n = 5, then it would return the following, where h = (b-a)/5, the width of each trapezoid.

h---[ f( a) + 2f(a + h ) + 2f(a + 2h ) + 2f(a + 3h ) + 2f( a + 4h) + f(b )] 2.

Reference no: EM13893118

Questions Cloud

What foods are good sources of epa and dha : Explain why different fats behave differently at room temperature. Why does olive oil remain liquid at room temperature and butter and shortening remain a solid?
Discuss the principles of holistic care : Discuss the principles of holistic care and the four principles of the holistic caring process
Implement the bisection method for solving given equations : Implement the Bisection Method for solving equations. Use the following function: double root(double (*pf)(double x), double a, double b, int n).
Compare and contrast one health benefit : Explain why is it advantageous (to you the consumer and the producer of the product) to include the sugar substitute instead of natural sugar in the food products you identified.
Implement the trapezoidal rule for integrating a function : Implement the Trapezoidal Rule for integrating a function. Use the following function: double trap(double (*pf)(double x), double a, double b, int n) Here, pf points to the function f that is to be integrated.
Analyze the factors that contributed to the public health : Analyze the factors that contributed to the public health issue
Create a table of probabilities for each sum possibility : A game is proposed to you using two six-sided dice and one roll per turn. Two points are scored when the sum of the two dice equal a 'predetermined number' of your choice. One point is scored when at least one of the die equal half of the same 'prede..
Describe the biomolecule : Describe the biomolecule that you think is most important for the cell and why?
A relationship between eye color : Perform a hypothesis test to determine if there is a relationship between eye color and height based on this sample. Include all steps and written conclusion description with application use

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