FUNCTION
Zeta
Evaluates the Riemann Zeta function.
You're viewing an older version of this page (#282). View the current version.
Interface
This component estimates the Riemann Zeta function, which is defined by the series
$$\zeta(p) = \sum_{k=1}^{\infty} \frac{1}{k^p} \qquad p > 1$$
(1)
A graph for various values of the argument is displayed below.

For integral values of p up to 20, a precomputed value of the function is returned, otherwise the infinite sum is used to approximate the result. In the following example, arguments from the [3, 4] interval are used, with step equal to 0.2, to evaluate the Zeta function.
Example 1
#include <codecogs/maths/special/zeta.h>
#include <iostream>
#include <iomanip>
int main()
{
std::cout << std::setprecision(10);
for (double x = 3; x < 5; x += 0.2)
{
std::cout << "Zeta(" << x << ") = ";
std::cout << Maths::Special::zeta(x) << std::endl;
}
return 0;
}Output
Zeta(3) = 1.202056903
Zeta(3.2) = 1.166773371
Zeta(3.4) = 1.138663776
Zeta(3.6) = 1.115989079
Zeta(3.8) = 1.097510576
Zeta(4) = 1.082323234
Zeta(4.2) = 1.069751477
Zeta(4.4) = 1.059281726
Zeta(4.6) = 1.050517383
Zeta(4.8) = 1.043148013Reference
John Burkardt's library of statistical C++ routines, http://www.csit.fsu.edu/~burkardt/cpp_src/prob/prob.html
Parameters
p
the power to which the fractions are raised
Returns
An approximation of the Riemann Zeta function with the given parameter.
Interactive Calculator
p
Result
Computing…
Set a range above first to export a graph.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.