Skip to content

Instantly share code, notes, and snippets.

@pureexe
Created December 13, 2017 06:49
Show Gist options
  • Select an option

  • Save pureexe/39100fb244c024254472bcc398d306ad to your computer and use it in GitHub Desktop.

Select an option

Save pureexe/39100fb244c024254472bcc398d306ad to your computer and use it in GitHub Desktop.
Numerical differential with 2 point
#include<stdio.h>
#include<math.h>
int main(){
double h = 1 / pow(2,16);
double df = (sin(1+h) - sin(1)) / h;
printf("cos(1) = %.6f \nd/dx sin(1) = %.6f",cos(1),df);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment