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

  What language is recommended to learn

What language is recommended to learn for someone interested in programming?

  Implementing the tictac-toe game

A software company that develops games has just hired you! Before working on the next version of Medieval Menace they have given you the task of implementing the tictac-toe game in C++

  Computer programming techniques

Construct a program from a design and use appropriate functions

  Modify the code to change the variables

Quickly modify the code to change the variables if needed to the correct data type. Comment the code and indicate what the line or function performs

  Identify two key oo concepts and explain them as if you

1. discuss the advantages and disadvantages of both the structured and object-oriented oo paradigm in programming. why

  Explain characteristics unique to object-oriented programing

The machine language treats a message as bits while object-oriented programming language treats every message as an object. Do you agree with this statement? Why or why not? Explain the characteristics unique to object-oriented programming and how..

  Compute the area of a circle

Develop the program that will convert the temperature from degree Celsius to degree Fahrenheit. User input the temperature in Fahrenheit. The relation is 1)  Develop the program that will convert the temperature from degree Celsius to degree Fahrenhe..

  Write a function named flattens

Write a function named flattens that takes a two-dimensional array of integers with 100 rows and 200 columns and returns a vector that contains all of the array's elements.

  Program that evaluates a infix expression

Program that evaluates a infix expression using stacks terminated by an equal sign. for example: (4-2)-5)/(2+1)-2))=the expression will contain single digit and the operators +, -, *,/. Make sure to consider the operator precedence.

  Setup a class to store a book

Setup a class to store a book. The data is to include title, author, year of publication, dewey number and age.

  What is the size of int in a 64 bit compiler

Can you explain the question in detail - What is the size of int in a 64 bit compiler?

  Write program using c language to find page fault

Write program using c language to find page fault for individual processes, group of processes and system as whole using following system call int sys_pgfltstats(pid_t pid,int flag,pf_info_struct *info).

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