Created
October 14, 2016 19:41
-
-
Save Hajto/a91f8e9bcac037222fa1f698cd39fd52 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 <stdlib.h> | |
| #include <math.h> | |
| #define li 100 //liczba iteracji do szeregu | |
| //tablicowanie fcji sin w <a,b> - szereg + fcja biblioteczna | |
| //definicja funkcji szereg x - parametr formalny | |
| double szereg(double x) | |
| { | |
| double s, w; | |
| int i; | |
| int counter = 1; | |
| s=x; | |
| w=x; | |
| for(i=1;i<=li;i++) | |
| { | |
| w=1 - (x*x*counter*counter)/((counter+1)*(counter+2)); | |
| s*=w; | |
| counter += 2; | |
| } | |
| return s; | |
| } | |
| float arsinh(int n, float x){ | |
| if( n < 2 ) | |
| return x; | |
| return (1-((n-2)*x*x)/(n*n-n)) * arsinh(n-2, x); | |
| } | |
| int main(int argc, char *argv[]){ | |
| int lp; | |
| double a, b, szsin, krok, x; | |
| //<a;b> - przedzia�, lp - ilosc podprzedzia��w | |
| printf("podaj konce przedzialow i liczbe podprzedzialow\n"); | |
| scanf("%lf %lf %d",&a,&b,&lp); | |
| krok=(b-a)/lp; | |
| printf("krok=%6.2lf\n\n\n",krok); | |
| printf(" ----------------------------\n\n"); | |
| printf(" x szereg(x) sin(x)\n ----------------------------\n"); | |
| for (x=a;x<=b;x+=krok) | |
| printf("%10.2lf %7.4lf %7.4lf\n",x,arsinh(500,x),asinh(x)); | |
| printf(" ----------------------------\n\n"); | |
| system("PAUSE"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment