Created
December 13, 2017 07:19
-
-
Save pureexe/80b2b7c1810b49c3c7f3065d042d58ef to your computer and use it in GitHub Desktop.
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> | |
| double f(double x,double h){ | |
| return (sin(x+h)-sin(x))/h; | |
| } | |
| int main(){ | |
| double h = 1 / pow(2,16); | |
| double a1 = (4*f(1,h) - f(1,2*h))/3; | |
| printf("cos(1) = %.12f \nd/dx sin(1) = %.12f",cos(1),a1); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment