Calculates the exact integral over the interval

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

Mathematical background:

Exact area under the curve created by function f(x) in interval [a,b] is given by:

Excat area = ab f(x)dx

For an interval divided into n equally spaced trapezoids, a = x1 < x2 < ... < xn+1 = b, where the grid spacing is h = (b-a)/n, the trapezoidal rule approximation to the integral becomes

approximate area = ab f(x)dx ≈ h/2 i=1Σn (f(xi+1)+ f(xi))

As the number of trapezoids increases the approximate result converges to the exact result.

Write a program which:

1. Prints out all of the required information for all assignments (see style sheet in D2L)

2. Which gets an interval from the user (i.e., values for a and for b). And gets the number n of trapezoids.

3. Has a function that calculates the exact integral over the interval ab for the cosine function

4. Has a function that calculates the area of a trapezoid given x1,y1 and x2,y2 (the other two points on the trapezoid can be assumed to be x1,0 and x2,0).

5. Has a function that calculates the area under the curve for the given interval of the cosine function using n trapezoids

6. Write your program so that it outputs the interval entered, the exact solution, the approximation, the number of trapezoids and the difference between the exact and approximate solutions.

7. Extra credit (up to an extra 2 points (where the rest of the assignment is worth 10 points) Your program should open a graphics window (629 x 201), fill it with white, draw the exact area in red and each trapezoid's borders in green, and then draw in the axes: Draw the x axis at y=100, draw the y axis at x=314, in black. Each pixel should represent 0.01. The graphics will be limited to an interval of no greater than -π to π. Note that instructors will give no assistance or advice on the extra credit until a working basic assignment is demonstrated to the instructor.


Attachment:- hw5 .rar

Reference no: EM13845466

Questions Cloud

Evaluate the contemporary role of psychology professionals : Evaluate the contemporary role of psychology professionals and elaborate on the relationship between self-care and the issue of maintaining ethical principles and professional standards
Audio amplifier project : This is a group project which will require working with another student. The project is a design project using Multisim with the requirements given below. The project is due on the last day of the term.
What makes the national government of the usa : What makes the national Government of the USA so different compared to other countries. Are the Bill of Limits relevant to you, if so how, if not why not
Compute the transfer function : 1. Set θd (t) = 0. Compute the transfer function h(t)/r(t) = T(s). 2. Set r(t) = 0. Compute the transfer function h(t)/θd(t) = Td(s)
Calculates the exact integral over the interval : Write your program so that it outputs the interval entered, the exact solution, the approximation, the number of trapezoids and the difference between the exact and approximate solutions - trapezoids increases the approximate result converges to th..
Calculate the density of the metal : A chunk of metal weighing 15.45 g is added to 21.27 mLof water in a graduated cylinder. The water rises to 24.78 mL. Calculate the density of the metal.
Tendency is called clustering : Companies sometimes like to locate, somewhat surprisingly, near competitors. You can see gas stations of different brands located really close to each other and a CVS next to a Walgreen. This tendency is called clustering. Please justify this type of..
Is the process capable based on the value and why : The specification for a plastic liner for concrete highway projects calls for a thickness of 3.0 mm 0.2 mm. The standard deviation of the process is estimated to be 0.02 mm. The process is known to operate at a mean thickness of 3.0 mm. Is the proces..
What is the reliability of the process : The manufacture of a product requires five sequential steps. The reliability of each of the steps is 0.97, 0.88, 0.95, 0.94 and 0.99, respectively. What is the reliability of the process?

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