|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
PLEASE HELP...I have to write a program which calculates the integral
Write a program which calculates the integral of the function
f(x)=g(x)/(2*m)! , where g(x)=A*sin^m(x) on the interval from a to b (a<b). In the main program, scanf a non-negative integer value of m and double values of A, a, and b. Call the function Integral() to evaluate the integral. Your main program should be followed by four functions: double Integral(int m, double A, double a, double b) double funcf(double x, int m, double A) to evaluate f(x) double funcg(double x, int m, double A) to evaluate g(x) double m2fact(int m) to evaluate (2*m)! When writing the function Intgral(), use the program w5-10.c or the program from part B of your hw5, appropriately modified to integrate an arbitrary function f(x) from a to b (letting the program ask you for n_trap only once). Within the Integral() function call another function funcf() to specify f(x). Within the function funcf(), to evaluate (2*m)! call the function m2fact(), and to to evaluate g(x) call the function funcg(). .................................................. .............. Your output should look like this: a.out Enter the non-negative integer m: 3 Enter the coefficient A in g(x): 150. Enter the bounds for the integration interval, a < b : -1.5 3.2 Integrate f(x) on [a,b] Enter the number of trapezoids: 1000 The value of the integral is 0.153601 . I HAVE TROUBLE WITH THE FACTORIALS ISSUES AND I'M NOT EXACTLY SURE WHERE TO START ON THIS THING. ![]() |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > PLEASE HELP...I have to write a program which calculates the integral |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|