Skip to content

Instantly share code, notes, and snippets.

@gabrielcesar
Last active January 17, 2017 01:09
Show Gist options
  • Save gabrielcesar/3099bd1bfd3f857f7920e5efa9941646 to your computer and use it in GitHub Desktop.
Save gabrielcesar/3099bd1bfd3f857f7920e5efa9941646 to your computer and use it in GitHub Desktop.
Aula de Cálculo I. Prof.º Augusto. BSI2016. 16/01/2017
#include <stdio.h>
#include <math.h>
double func ( double x );
double der ( double x );
int main ( void )
{
double x = 3.0;
printf ( "Sua derivada no ponto %f é %.10f\n", x, der ( x ));
return 0;
}
double func ( double x )
{
double f;
f = x * x;
return f;
}
double der ( double x )
{
double d, h = 1e-03; //0.01
d = ( func ( x + h ) - func ( x )) / h;
return d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment