Question
need to solve the following equation using C programming: The following is the part of the code that is the relevant to the finding the
need to solve the following equation using C programming:
The following is the part of the code that is the relevant to the finding the equation (if you need the rest of the code just ask i will provide it , it is kinda lengthy hence why i'm not posting it now)
/*---------------------------------------------------------- Function: calculateAreaTrapazoid Parameters: sPtr - reference to SHAPE structure variable. Members used num_steps - number of steps for determining h aStart - starting value for a aEnd 0 ending value of a inc - incrementation value for dimension a n - number of elements used in time/area arrays a - array for saving values of a areaTrap - array for saving area values Description: Fills in the arrays with n points of a/area values using the Trapezoidal rule for the distance. -------------------------------------------------------------*/ void calculateAreaTrapazoid(SHAPE *sPtr) { double time; // time value int i; // increment number double i_ti; // for computing i(ti) double fti, ftiM1; // compute f(ti), f(ti-1) // Initialise values at time 0 time = sPtr->aStart; sPtr->a[0] = time; i_ti = 0.0; sPtr->areaTrap[0] = 0; for(i = 1; i n; i = i +1) { sPtr->a[i] = time; time = time + sPtr->inc ; ftiM1 = computeFa(sPtr->a[i-1], sPtr->num_steps); fti = computeFa(sPtr->a[i] , sPtr->num_steps); i_ti = i_ti + (sPtr->num_steps/2)*(ftiM1 + fti); // note that in the expression, i_ti is I(ti-1) sPtr->areaTrap[i] = i_ti/12.5;
}
}
/*---------------------------------------------------------- Function: computeFa Parameters: a - Dimension a of the scrapper num_steps - number of steps for determining h Description: Computes the value of fA(a) for the dimension a by applying the Trapezoidal rule for integrating f(x) from -a to +a. -------------------------------------------------------------*/ double computeFa(double a, int num_steps) { int i; double fx = 0;
for(i=-a ; i
}
return(fx);
}
The dimension a defines the size of the part and the area surface area fa(a) is given by the following integral sar where f(x) is the function that represents the form of the upper edge of the part. From the figure we can see that the part extends from x =-a to x +a. The top edge of the part has the shape defined by f(x) = (a2-re-xlaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started