Skip to content

litlfred/notebooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Weierstrass β„˜ Playground

Interactive visualization of the Weierstrass β„˜ function running entirely in your browser

πŸš€ Try it now: https://litlfred.github.io/notebooks/

  • Zero Installation: Works immediately in any modern web browser
  • Powered by Pyodide: Full Python + NumPy + Matplotlib running via WebAssembly
  • Mobile Friendly: Responsive design works on phones and tablets
  • Dynamic Visualizations: Re-renders when browser is resized

Features

  • Interactive parameter controls with real-time visual feedback
  • Multiple visualization modes: Two-panel, three-panel, and five-panel layouts
  • Particle trajectory integration following z''(t) = -β„˜(z(t)) * z(t)
  • Lattice trajectory visualization option for exploring periodic structure
  • Dynamic rendering with visual indicators during re-computation
  • PNG export functionality for high-quality visualizations
  • Comprehensive help system with mathematical background

Mathematical Background

The Weierstrass β„˜ function is implemented using a truncated lattice sum:

β„˜(z) = 1/zΒ² + Ξ£[1/(z-Ο‰)Β² - 1/ω²]

where the sum runs over non-zero lattice points Ο‰ ∈ Ξ› = β„€p + β„€iq within truncation bound N.

Particle trajectories follow the second-order differential equation: z''(t) = -β„˜(z(t)) * z(t)

Integration uses RK4 method with automatic blow-up detection near poles.

Quick Start

  1. Visit https://litlfred.github.io/notebooks/
  2. Wait for Pyodide to load (~30 seconds first time)
  3. Try default settings: p=11, q=5, N=3
  4. Click "Render" to generate visualization
  5. Experiment with different particles: zβ‚€ = 5+2j, vβ‚€ = 0+1j
  6. Resize your browser window to see dynamic re-rendering

Repository Structure

This repository contains a comprehensive widget framework for interactive mathematical computing:

β”œβ”€β”€ src/weierstrass_playground/    # Main Python package
β”‚   β”œβ”€β”€ __init__.py               # Package initialization
β”‚   β”œβ”€β”€ core.py                   # Core mathematical functions
β”‚   β”œβ”€β”€ visualization.py          # Visualization and plotting
β”‚   β”œβ”€β”€ integration.py            # Trajectory integration and ODEs
β”‚   └── browser.py                # Browser-specific adaptations
β”œβ”€β”€ docs/                          # Widget framework & GitHub Pages
β”‚   β”œβ”€β”€ index.html                # Main web interface  
β”‚   β”œβ”€β”€ schema/                   # Widget Schema & JSON-LD Framework
β”‚   β”‚   β”œβ”€β”€ weierstrass/         # Weierstrass β„˜ function widgets
β”‚   β”‚   β”œβ”€β”€ pq-torus/            # Prime lattice torus widgets
β”‚   β”‚   β”œβ”€β”€ sticky-note/         # Markdown note widgets
β”‚   β”‚   β”œβ”€β”€ common/              # Shared schemas
β”‚   β”‚   β”œβ”€β”€ ontology/            # JSON-LD contexts
β”‚   β”‚   └── README.md            # Schema documentation
β”‚   β”œβ”€β”€ weierstrass-playground/   # Interactive blackboard system
β”‚   β”‚   β”œβ”€β”€ board.html           # β„˜ Weierstrass Playground interface
β”‚   β”‚   β”œβ”€β”€ widgets/             # Widget implementations
β”‚   β”‚   └── widget-schemas.json  # Widget registry
β”‚   β”œβ”€β”€ widget-framework.md      # Complete framework documentation
β”‚   β”œβ”€β”€ json-schema-specification.md  # Schema specifications
β”‚   β”œβ”€β”€ architecture-examples.md # Implementation examples
β”‚   └── migration-guide.md       # Migration strategy
β”œβ”€β”€ legacy/                      # Legacy implementations (migrated to libraries/)
β”‚   β”œβ”€β”€ weierstrass_lib.py       # β†’ libraries/pq-torus/weierstrass_math.py
β”‚   β”œβ”€β”€ weierstrass_ui.py        # β†’ modern widget system
β”‚   β”œβ”€β”€ weierstrass_preamble.py  # β†’ setup documentation
β”‚   └── weierstrass_playground.ipynb  # β†’ JSON-LD notebooks
β”œβ”€β”€ setup.py & pyproject.toml    # Package configuration
└── requirements.txt             # Dependencies

Widget Framework

The repository includes a complete production-ready widget framework for building interactive mathematical computing environments:

  • 🎯 Schema-Based Design: JSON Schema validation with named, reusable schemas hosted on GitHub Pages
  • πŸ”— JSON-LD & PROV-O Integration: Full provenance tracking for computational workflows and mathematical dependencies
  • 🧩 Visual Programming Interface: Drag-and-drop widget blackboard with dependency management between widgets
  • πŸ“Š Mathematical Focus: Specialized widgets for computational mathematics (lattice theory, complex analysis, etc.)
  • 🌐 Zero-Install Deployment: All schemas accessible via HTTPS URLs, works entirely in browser via Pyodide
  • πŸ”„ Extensible Architecture: Six-file schema pattern (input/output/widget Γ— JSON Schema/JSON-LD) for easy widget development

Available Widgets

The framework provides several specialized mathematical widgets:

  • πŸ“ Sticky Note: Markdown content widgets with LaTeX support for mathematical annotations
  • πŸ”΄ PQ-Torus: Prime lattice torus definition widgets (T = β„‚ / L where L = β„€p + β„€qi) for complex analysis
  • ∞ Weierstrass Functions: β„˜(z) visualization and analysis widgets for elliptic function theory
  • 🐍 Python Code: Interactive code execution widgets with full NumPy/Matplotlib support
  • πŸ“Š Data Visualization: Advanced plotting and data generation widgets with real-time updates

Widget Architecture & Dependencies

The framework supports sophisticated mathematical workflows through widget dependencies and provenance tracking:

graph LR
    A[PQ-Torus Widget] --> B[Weierstrass Widget]
    B --> C[Visualization Widget]
    D[Sticky Note] --> B
    B --> E[Python Code Widget]
Loading

Example Mathematical Pipeline:

  1. PQ-Torus Widget: Define prime lattice parameters (p=11, q=5)
  2. Weierstrass Widget: Use parameters for β„˜-function computation with lattice Ξ› = β„€p + β„€qi
  3. Visualization Widget: Generate complex plane visualizations with particle trajectories
  4. Python Code Widget: Custom analysis or parameter exploration

Each widget interaction is tracked via PROV-O provenance graphs, enabling reproducible mathematical workflows.

πŸš€ Try the widget framework: https://litlfred.github.io/notebooks/weierstrass-playground/board.html

Architecture Overview

This repository implements a dual-system architecture combining traditional Jupyter notebooks with an advanced widget framework:

1. Interactive Notebooks πŸ““

Four-File Pattern: Each notebook follows a modular architecture for maintainability and reusability:

notebook_name.ipynb          # MINIMAL notebook (imports + UI display only)
notebook_name_lib.py         # Mathematical/computational logic  
notebook_name_ui.py          # UI widgets and layout code
notebook_name_preamble.py    # Documentation and setup (optional)

Key Benefits:

  • Separation of Concerns: Math logic separated from UI code
  • Reusable Components: Library functions can be imported by other notebooks
  • Clean Notebooks: Jupyter files contain only essential display code
  • Testable Code: Mathematical functions can be unit tested independently

2. Widget Framework 🧩

Schema-Driven Architecture: Production-ready system for building complex mathematical workflows:

docs/schema/{widget-name}/
β”œβ”€β”€ input.schema.json        # JSON Schema for input validation
β”œβ”€β”€ input.jsonld            # JSON-LD context for semantic web
β”œβ”€β”€ output.schema.json      # JSON Schema for output validation  
β”œβ”€β”€ output.jsonld           # JSON-LD context for provenance
β”œβ”€β”€ widget.schema.json      # Widget instance configuration
└── widget.jsonld           # Widget semantic definition

Key Features:

  • GitHub Pages Integration: All schemas served as HTTPS URLs
  • PROV-O Compliance: Full provenance tracking for computational workflows
  • Dependency Management: Widgets can consume outputs from other widgets
  • Type Safety: JSON Schema validation for all inputs and outputs

Integration

Both systems work together seamlessly:

  • Notebooks provide exploratory mathematical environments
  • Widget Framework enables building reusable, shareable mathematical tools
  • Shared Libraries: Common mathematical functions used by both systems
  • Browser Deployment: Both run entirely in browser via Pyodide + WebAssembly

Package Installation

Install the Python package locally:

# Development installation
pip install -e .

# Or install from PyPI (when published)
pip install weierstrass-playground

Python Usage

import weierstrass_playground as wp

# Basic function evaluation
z = 2.0 + 1.5j
p, q, N = 11.0, 5.0, 3
wp_val = wp.wp_rect(z, p, q, N)

# Create visualization
fig = wp.browser.create_complete_visualization(
    mode='two_panel', p=p, q=q, N=N, 
    nx=100, ny=100, particles=[(5+0j, 0+1j)], 
    # ... other parameters
)

Development

Getting Started

For local development and contributions:

# Clone repository
git clone https://github.com/litlfred/notebooks.git
cd notebooks

# Install dependencies
pip install -r requirements.txt

# Run local development server
cd docs
python -m http.server 8000
# Visit http://localhost:8000

Documentation and Contribution Guidelines

Repository Structure

For detailed technical information, see the comprehensive documentation linked above. The repository maintains high code quality standards with extensive testing, modular architecture, and clear separation between mathematical logic, UI components, and configuration.

About

random python notebooks

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •