hi im a retard and i cant get this to work any of you super chaps can help would be appreciated my code is
#include<math.h>
#include<stdio.h>
double func(double x);
double deriv(double x);
double func(double x)
{
return pow(x,3)+5*pow(x,2)+x+sin(2*x);
}
double deriv(double x)
{
return 3*pow(x,2)+10*x+1+2*cos(2*x);
}
main()
{
double delta,x,y;
y=0;
printf("Insert Initial Guess\n");
scanf("%f",&x);
printf("The value of function =%f\n",func(x));
while(y!=x)
{
y=x;
delta = (-func(x)/deriv(x));
x = x + delta;
}
printf("The function equals %8.4f at x=%f\n",func(x));
}
im trying to find the roots of the function but it doesn't work, ill love you if you can help.