Skip to content

Add Streamlit demo: calculate pi from a geometric series - #1

Draft
telboth wants to merge 1 commit into
mainfrom
claude/streamlit-pi-calculator-n08zyv
Draft

Add Streamlit demo: calculate pi from a geometric series#1
telboth wants to merge 1 commit into
mainfrom
claude/streamlit-pi-calculator-n08zyv

Conversation

@telboth

@telboth telboth commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a standalone Streamlit demo under pi_calculator_demo/ that estimates π using the geometric series 1/(1+x²) = 1 - x² + x⁴ - x⁶ + ... (ratio -x²), integrated to give the Leibniz series π/4 = 1 - 1/3 + 1/5 - 1/7 + ...
  • Sidebar slider controls the number of series terms N
  • Live metrics show the current π estimate, the exact value, and the error
  • Two Plotly charts visualize (1) convergence of the estimate toward π as N grows, and (2) the geometric series itself — the partial-sum curve vs. the exact 1/(1+x²) curve, where the area under each corresponds to π/4

This is a self-contained demo (own app.py, requirements.txt, README.md) and does not touch the existing bug-tracker app in this repo.

Test plan

  • Verified the series math numerically (estimate converges to π with expected error order)
  • Ran streamlit run app.py headlessly and confirmed it serves (HTTP 200) with no runtime errors
  • Manually exercise the slider in a browser to confirm the charts update interactively

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mf7j8zybAMpC7WPPuQ9DeU


Generated by Claude Code

Interactive app with a slider for the number of series terms, live
metrics (estimate, exact pi, error), and two plots showing convergence
toward pi and the underlying geometric series area.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mf7j8zybAMpC7WPPuQ9DeU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants