Pi from the Wallis Product
Approximate π by 2∏(k=1…m)4k²/(4k²−1), using the empty product value two when m=0 and a 1,000,000-term resource limit.
Description
The Wallis product approaches π through rational factors slightly larger than one.
The Wallis product approaches π through rational factors slightly larger than one. A finite product provides an approximation whose accuracy depends on the number of factors.1
The tool returns value. The indexing and output conventions below determine how to read these values.
When to use Pi from the Wallis Product
Use this for the following task: Approximate π by 2∏(k=1…m)4k²/(4k²−1), using the empty product value two when m=0 and a 1,000,000-term resource limit. Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Pi from the Wallis Product and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter terms according to the field table, then run the tool.
- Read value. Use the stated units, indexing and interpretation of the numerical result.
- Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| terms | Product term count (resource limit 1000000) | integer; minimum 0; maximum 1000000 | Required |
Start at two and multiply each factor as 1+1/((2k−1)(2k+1)), using ordinary floating-point arithmetic. Zero terms returns the empty-product value two.
π approximation = 2×Π[k=1..terms](4k²/(4k²−1)) The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| value | Wallis product approximation | number |
{
"input": {
"terms": 1
},
"output": {
"value": 2.6666666666666665
}
} Limitations and assumptions
At most one million terms are accepted. Convergence is slow and no certified error bound or arbitrary-precision result is returned.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Pi from Viète’s Product when you need its operation: Approximate π by 2∏(j=1…m)2/a_j with a₁=√2 and a_(j+1)=√(2+a_j), including the empty product two and a 10,000-term resource limit. Choose Pi from the Leibniz Series for the complementary operation: Approximate π with the requested terms of 4Σ(−1)^k/(2k+1), grouping adjacent terms to reduce cancellation; computation is capped at 100,000 terms.
Background reference: Digital Library of Mathematical Functions, §4.22.
References
-
Digital Library of Mathematical Functions, §4.22 — National Institute of Standards and Technology
Similar or alternative tools
- Pi from Viète’s Product
Approximate π by 2∏(j=1…m)2/a_j with a₁=√2 and a_(j+1)=√(2+a_j), including the empty product two and a 10,000-term resource limit.
- Pi from the Leibniz Series
Approximate π with the requested terms of 4Σ(−1)^k/(2k+1), grouping adjacent terms to reduce cancellation; computation is capped at 100,000 terms.