on function ax^2+bx+c ,Create the table on set of set of input x = [-4,-3,-2,-1,0,1,2,3,4]
2. Plot the graph i.e., parabola using the table created in part(i) .
3. Calculate the first derivative of the function .
4. Find the first derivative of the function and use that to evaluate the extreme value .
5. Using the second derivative , tell that the extreme value calculated is minima or maxima.
#include <cmath.h>
#include <stdio.h>
double a, b, c;
double f(double x) {
return a * x*x + b * x + c;
}
double derivative(double x) {
return (f(x + 1e-6) - f(x - 1e-6)) / 2e-6;
}
int main() {
printf("Enter coefficients of quad-equation: ");
scanf("%d%d%d", &a, &b, &c);
printf("First derivative x=1: %.2f", derivative(1));
}
Comments
Leave a comment