i have to right a code that will calculate the area of the function below, f 1 (
ID: 2971054 • Letter: I
Question
i have to right a code that will calculate the area of the function below,
f1(x) = 2 + AxB[2+sin(wx)]CeDx
from x1 to x2 using the Right Riemann summation
A,B,C,D,w,x1,x2 , deltax are constants and they will be entered by a user.
i just need to know how this Right Riemann summation work for this case , ( math wise not programming) please do as it a normal hw problem
like how would u solve it if u have the constants ?
lets say
a = 1
b=2
c=3
d=4
w = 6
x1=1
x2=3
delta x = 2
please show all steps because i really have no idea to do it.
i will rate you right away . and please show all steps since i have to include everything in my program .
i appreciate it
i have to right a code that will calculate the area of the function below, f1(x) = 2 + AxB[2+sin(wx)]CeDx from x1 to x2 using the Right Riemann summationExplanation / Answer
After reading A,B,C, your program should use a do/while loop to
evaluate y for scanned x in each of the above three cases. If you
scan x from the same interval again, your program should ask you
to scan x from another interval, until you scan x once from each
interval.
This is so far wt I got......
/*homework4*/
#include <stdio.h>
#include <math.h>
main()
{
double A, B, C, x, y, y_1, y_2, y_3;
int d=0, e=0, f=0;
printf("Enter (double) A, B, C: ");
scanf("%lf %lf %lf", &A, &B, &C);
do{
printf(" Enter (double) x: ");
scanf("%lf", &x);
y_1 = A*x - B*pow(x,4) - C;
y_2 = A*pow(x, 2) + B*pow(x,3) - x/4;
y_3 = A*log10(x) - B/x + 2*C;
if(x <= -1){
if(d >= 1) printf("Enter x from another interval!");
printf("Case 1 x value is = %.4f and y value is = %.5f ", x, y_1);
d++}
else if(-1 < x < 2){
if(e>=1) printf("Enter x from another interval!");
printf("Case 2 x value is = %.4f and y value is = %.5f ", x, y_2);
e++}
else if(x >= 2){
if(f>=1) printf("Enter x from another interval!");
printf("Case 3 x value is = %.4f and y value is = %.5f ", x, y_3);
f++}
}while( x!=0 );
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.