📄 zeta.c
字号:
/*---------------------------------------------------------------------- File : zeta.c Contents: compute Riemann's zeta-function Author : Christian Borgelt History : 20.10.1998 file created----------------------------------------------------------------------*/#include <math.h>#include "zeta.h"/*---------------------------------------------------------------------- Functions----------------------------------------------------------------------*/double zeta (double x){ /* --- compute Riemann's zeta-function */ double t = 1, z = 0; /* term to add and result */ double base = 2; /* base for terms */ do { /* compute the sum */ z += t; /* zeta(x) = \sum_{n=1}^\infty n^{-x} */ t = pow(base++, -x); /* by successively adding terms */ } while (z +t > z); /* until a terms gets zero */ return z; /* return the function value */} /* zeta() */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -