Created
December 13, 2017 07:03
-
-
Save pureexe/f7b859d3744a7634b89b13df4b9a28ff to your computer and use it in GitHub Desktop.
Numerical differential with 3 point
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<math.h> | |
| int main(){ | |
| double h = 1 / pow(2,16); | |
| double df = (2*sin(1+h) + 3*sin(1) - 6*sin(1-h) + sin(1 - 2*h) )/(6*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