Created
October 14, 2016 20:10
-
-
Save Hajto/710d6e50c6ee03193f397e19aac69dbd 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 IT_COUNT 51 | |
#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; | |
} | |
double arsinh(int n, double x){ | |
if( n < 2 ) | |
return x; | |
double value = 1 - ((n-2)*(n-2)*x*x) / ((n-1)*n); | |
printf("Current value %d %f \n", n, value); | |
return value * arsinh(n-2, x); | |
} | |
int main(int argc, char *argv[]){ | |
int lp; | |
double a, b, szsin, krok, x; | |
printf("%f \n", arsinh(IT_COUNT, 1)); | |
//<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(IT_COUNT,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