Skip to content

Instantly share code, notes, and snippets.

@Hajto
Created October 22, 2016 18:10
Show Gist options
  • Save Hajto/b07569dd2cff9c69e8639ea70753ea8c to your computer and use it in GitHub Desktop.
Save Hajto/b07569dd2cff9c69e8639ea70753ea8c to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define IT_COUNT 1001
//tablicowanie fcji sin w <a,b> - szereg + fcja biblioteczna
//definicja funkcji szereg x - parametr formalny
double szereg_rek(double x, double it){
if( it >= IT_COUNT)
return x;
else
return 1 - (((it-2)*(it-2)*x*x) / ((it-1)*it)*szereg_rek(x,it+2));
}
double szereg_reks(double x){
return x*szereg_rek(x, 3);
}
int main(int argc, char *argv[]){
int lp;
double a, b, szsin, krok, x;
//Stdin | poczatek koniec liczba_przedzialow
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) asinh(x)\n ----------------------------\n");
for (x=a;x<=b;x+=krok)
printf("%10.2lf %7.4lf %7.4lf\n",x,szereg_reks(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