Skip to content

Java program that approximates π using the Leibniz series. Enter the number of terms via JOptionPane, and the program calculates and displays the result. Includes error handling for invalid inputs and performance limits.

Notifications You must be signed in to change notification settings

ArantxaAngulo/leibniz-series

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Leibniz Series Approximation


This Java project approximates the value of π (Pi) using the Leibniz series. The program takes user input to determine the number of terms (operands) for the approximation and calculates the result using a simple loop.

Features:

  • Uses the Leibniz formula to approximate π:
    [\pi \approx 4 \times \sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1}]
  • User-friendly input via JOptionPane for entering the number of terms.
  • Error handling to ensure valid numeric input.
  • Prevents program execution with excessively large input values, maintaining performance.
  • Displays the approximation result in a graphical message dialog.

Project Structure:

  • Main.java: Core logic for input handling, Leibniz series calculation, and result display.

Contributing:

Feedback and suggestions are welcome! <3


About

Java program that approximates π using the Leibniz series. Enter the number of terms via JOptionPane, and the program calculates and displays the result. Includes error handling for invalid inputs and performance limits.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages