Area under curve, Programming Languages

Assignment Help:

Area Under Curve

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.
The area under a curve between two points can be found by doing a definite integral between the two points.

Instructions to work with Open PBT Client:

  1. Specify the work directory path in the 'Work directory Path' field. The path should correspond to your solution Work directory.
  2. Download the support files by clicking the Get Support Files.
  3. You will find the problem directories containing:
    • problem.h file
    • problem.c file

in your project directory.

  1. Code the solution in.c file inside the problem directory
  2. All required files will be downloaded to your work directory. Creating additional files is strongly discouraged.

The Prototype of the Function is :

double getAreaUnderCurve (struct Term* equation, int noOfTerms, int limit1,int limit2)

  • Where equation represents number of Term in a equation with x_pow and coeff of X
  • Where noOfTerms is the number of terms in the equation
  • Where limit1 and limit2 are the 2 given points to find the area.
  • The function getAreaUnderCurve() return the area of type double corrected to 4 decimal places.(eg : 5.2704. )

Example 1

Input :


    Term equation = x + 3(x^2);     int noOfTerms = 2;     int limit1 = 4;     int limit2 = 8;
    where, struct Term* equation => { equation[0].exponent = 1; equation[0].coefficient = 1; equation[1].exponent = 2; equation[1].coefficient = 3; }

Output :


The function getAreaUnderCurve() returns 472.0.

 

Example 2

Input :


    Term[] equation = x;     int noOfTerms = 1;     int limit1 = 1;     int limit2 = 1;

Output :


The function getAreaUnderCurve() returns 0.0

Example 3

Input :


    Term equation = x;     int noOfTerms = 1;     int limit1 = 2;     int limit2 = 1;

Output :


The function getAreaUnderCurve() returns 1.5

For C solutions

Header File

:

areaundercurve.h

Function Name

:

double getAreaUnderCurve (struct Term* equation, int noOfTerms, int limit1,int limit2)

 

File Name

:

areaundercurve.c

 

For C++ solutions

Header File

:

areaundercurve.h

Class Name

:

AreaUnderCurve

Function Name

:

double getAreaUnderCurve (struct Term* equation, int noOfTerms, int limit1,int limit2)

FileName

:

areaundercurve.c

General Instructions

    *

The file / class names, functions, method signatures, header files are to be used as mentioned in the problem statement. Do not use your own names or change the method signatures and fields. You can add any number of additional methods.

    *

For C solutions, change the value of "C_OR_CPP" macro in header file as 1 and for C++ solutions change the value as 2.

    *

Incase of iostream.h specify as iostream only.

    *

Command line options for the main() function are not supported currently.

 


Related Discussions:- Area under curve

Assignment, Assignment for Networing&camunication

Assignment for Networing&camunication

Nature of the empirical data in pascal programming, You will soon receive i...

You will soon receive in an email a personalized assignment that tells you the nature of the "Empirical Data" you are to produce with a Pascal program for HW3. HW3 is about generat

Maze-solving, For this assignment you will use the robot/maze simulation ex...

For this assignment you will use the robot/maze simulation example introduced in mini-assignments 0625ma-0627ma to develop a maze-solving program. The program will read a file cont

Modularity, Modularity, Abstraction, and Modelling Whether proving a t...

Modularity, Abstraction, and Modelling Whether proving a theorem by creating up from lemmas to simple basic theorems to more accurate results, or designing a circuit by creati

How to write a kernel module, Overview You will write a loadable kernel...

Overview You will write a loadable kernel module. If you have an idea which you can convince me is a good idea that can not be done as a module, but only via direct modificatio

Program for tube challenge route, 1. Introduction The Tube Challenge is ...

1. Introduction The Tube Challenge is a Guinness World Records challenge that tests both the physical and mental abilities of the person trying to break it. The main components

Shell script to compare that given two files are same or not, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Matlab, i have a=[0 1 1 2 2 3 6 7 0 4 ] i want to delent elemet but keep it...

i have a=[0 1 1 2 2 3 6 7 0 4 ] i want to delent elemet but keep its position i.e a(4)=[] it gives me 0 1 1 2 3 6 7 0 4 but i need 0 1 1 [] 2 3 6 7 0 4

Triple eigenvalue with one eigenvector, Triple Eigenvalue with 1 Eigenvecto...

Triple Eigenvalue with 1 Eigenvector The eigenvalue/vector pair in this case are l and  ?h , . Since the eigenvalue is real we know as the first solution we require is, e l

Jsp, how can we get the data from data base to combo box in jsp page dynami...

how can we get the data from data base to combo box in jsp page dynamically

Write Your Message!

Captcha
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