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.

Description

The Leibniz series approximates π by alternating reciprocals of odd integers.

The Leibniz series approximates π by alternating reciprocals of odd integers. Its alternating-series remainder gives a truncation bound, although convergence is slow.1

The tool returns value, truncationBound. The indexing and output conventions below determine how to read these values.

When to use Pi from the Leibniz Series

Use this for the following task: Approximate π with the requested terms of 4Σ(−1)^k/(2k+1), grouping adjacent terms to reduce cancellation; computation is capped at 100,000 terms. Use the input and output conventions below to reproduce the intended mathematical quantity.

How to use Pi from the Leibniz Series and understand its results

  1. Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
  2. Enter terms according to the field table, then run the tool.
  3. Read value, truncationBound. Use the stated units, indexing and interpretation of the numerical result.
  4. Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
Input fieldMeaningValue type and boundsRequirement
termsNumber of terms (resource limit 100000)integer; minimum 1; maximum 100000Required

Combine neighboring positive and negative terms into positive paired contributions and accumulate them with compensation. Add the last positive term for an odd term count.

approximation = 4×Σ[k=0..terms−1](−1)^k/(2k+1); truncation bound = 4/(2×terms+1)

The symbols and boundary conditions refer to the supplied fields and the implementation described above.

Output fieldMeaningValue type
valueLeibniz series approximationnumber
truncationBoundAlternating-series truncation bound (excludes floating-point rounding)number
json
{
  "input": {
    "terms": 2
  },
  "output": {
    "value": 2.6666666666666665,
    "truncationBound": 0.8
  }
}

Limitations and assumptions

Accept 1..100000 terms. The reported bound addresses mathematical truncation, not a separate proof of total floating-point rounding error.

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 the Wallis Product when you need its operation: 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. Choose Pi from Viète’s Product for the complementary 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.

Background reference: Digital Library of Mathematical Functions, §4.24.

References

  1. Digital Library of Mathematical Functions, §4.24 — National Institute of Standards and Technology

Similar or alternative tools

  • 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.

  • 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.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies