8000 GitHub - mlnomadpy/VectoVerse
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mlnomadpy/VectoVerse

Repository files navigation

🌌 VectoVerse: An Atomic-Inspired N-Dimensional Vector Visualization Framework

License: AGPL v3 Lines of Code JavaScript D3.js

"Just as atoms interact through fundamental forces to create the complexity of matter, vectors in n-dimensional space exhibit resonance patterns that reveal the hidden architecture of mathematical relationships."

🔬 Philosophy: The Atomic Model of Vector Space

VectoVerse introduces a revolutionary paradigm for understanding high-dimensional vectors through the lens of atomic physics. This framework transforms abstract mathematical entities into intuitive, interactive "information atoms" that exhibit behaviors analogous to quantum mechanical systems.

🧪 The Atomic-Vector Analogy

Atomic Property Vector Analogy Mathematical Foundation Implementation Method
Electron Charge Component Polarity sign(vᵢ) where vᵢ is the i-th component getInformationQuantums()
Nuclear Stability Vector Magnitude ‖v‖ = √(Σᵢ vᵢ²) magnitude()
Electromagnetic Force Cosine Similarity cos(θ) = (u·v)/(‖u‖‖v‖) cosineSimilarity()
Resonance Frequency Harmonic Alignment R(u,v) = (u·v)²/‖u-v‖² harmonicAlignment()
Quantum Entanglement Vector Correlation ρ(u,v) = cov(u,v)/(σᵤσᵥ) quantumEntanglement()
Information Entropy Component Distribution H(v) = -Σᵢ p(vᵢ)log₂(p(vᵢ)) informationEntropy()
Nuclear Forces Electromagnetic/Gravitational F = k(u·v)/‖u-v‖² electromagneticForce(), gravitationalAttraction()
Statistical Properties Vector Statistics μ, σ, skewness, kurtosis getVectorStatistics()

📊 Project Statistics

📂 Project Structure:
├── 🎨 Frontend: 650+ lines (HTML + CSS)
├── ⚙️ Core Logic: 1400+ lines (JavaScript)
├── 🧩 Modules: 11 specialized components
├── 📐 Mathematical Models: 5 force calculation algorithms
└── 🎮 Interactive Features: 15+ user interactions

🚀 Current Features: 12 implemented
🔮 Planned Features: 8 upcoming
⭐ Educational Tools: 5 integrated

🎯 Core Features

🌟 Atomic Visualization Engine

  • Quantum-inspired Rendering: Vectors appear as glowing atomic structures with electron-like components
  • Real-time Animation: Pulsing frequencies that represent vector "energy states"
  • Interactive Selection: Click to explore individual vector properties and relationships
  • Dynamic Sizing: Vector radius reflects magnitude (nuclear mass analogy)

Resonance Force Calculator

Advanced mathematical engine implementing multiple force models:

// Resonance Force: Measures harmonic alignment between vectors
R(u,v) = (u·v)² / (‖u-v‖² + ε)

// Cosine Similarity: Measures directional alignment
cos(θ) = (u·v) / (‖u‖‖v‖)

// Euclidean Distance: Spatial separation in n-space
d(u,v) = (Σᵢ(uᵢ-vᵢ)²)

🎛️ Interactive Input System

  • Real-time Vector Editor: Modify components and see immediate effects
  • File Upload Support: Import custom vector datasets (CSV, JSON)
  • Dynamic Dimensionality: Adjust from 2D to 20D space exploration
  • Component Sliders: Intuitive value adjustment with immediate visual feedback

📈 Advanced Analytics

  • Similarity Rankings: Automatic sorting by resonance force strength
  • Statistical Properties: Magnitude, entropy, and distribution analysis
  • Force Visualization: Toggle electromagnetic-style force lines
  • Cluster Identification: Visual grouping of related vectors

🔮 Upcoming Features (v2.0)

🎯 Vector Operations Suite

// Vector arithmetic operations
add(v1, v2)           // ✅ Implemented
subtract(v1, v2)      // ✅ Implemented
scale(v, scalar)      // ✅ Implemented
normalize(v)          // ✅ Implemented

🧠 Machine Learning Integration

  • K-means Clustering: Automatic vector grouping
  • PCA Visualization: Dimensionality reduction display
  • t-SNE Projection: Non-linear embedding for complex datasets
  • Anomaly Detection: Identify outlier vectors

🎓 Educational Features

  • Interactive Tutorials: Step-by-step guided tours
  • Formula Explanations: Hover tooltips with mathematical context
  • Exercise Mode: Practice problems with instant feedback
  • Progress Tracking: Learning milestone system

🔧 Advanced Tools

  • Export System: Save configurations as JSON/CSV
  • Undo/Redo: Full action history management
  • Keyboard Shortcuts: Power-user efficiency features
  • Custom Themes: Visual customization options

🧮 Mathematical Foundation

📐 Vector Space Geometry

VectoVerse operates in the mathematical framework of Euclidean n-space (ℝⁿ), where each vector v ∈ ℝⁿ is represented as:

v = (v₁, v₂, ..., vₙ)

🔄 Force Interaction Models

1. Electromagnetic Analogy

F_em(u,v) = k · (u·v) / ‖u-v‖²

Where k is the interaction constant, mimicking Coulomb's law.

2. Quantum Resonance Model

F_res(u,v) = A · sin(2π · f(u,v) · t)
f(u,v) = |u·v| / (‖u‖ + ‖v‖)

Frequency-based interaction modeling quantum harmonic oscillators.

3. Gravitational Attraction

F_grav(u,v) = G · (‖u‖ · ‖v‖) / ‖u-v‖²

Mass-proportional attraction based on vector magnitudes.

📊 Information-Theoretic Interpretation

Each vector component can be interpreted as an "information quantum" with:

  • Positive Components (Red): Excitatory information units
  • Negative Components (Blue): Inhibitory information units
  • Near-Zero Components (Gray): Neutral/background information

The Information Entropy of a vector is calculated as:

H(v) = -Σᵢ p(vᵢ) · log₂(p(vᵢ))

Where p(vᵢ) = |vᵢ|/‖v‖₁ represents the probability distribution of component magnitudes.

🚀 Quick Start

Prerequisites

  • Modern web browser with ES6+ support
  • Local web server (recommended for file operations)

Installation

git clone https://github.com/yourusername/VectoVerse.git
cd VectoVerse
python -m http.server 8000  # or your preferred local server

Open http://localhost:8000 in your browser.

Basic Usage

  1. Generate Vectors: Use the "Generate New Vectors" button to create random n-dimensional vectors
  2. Explore Relationships: Click on any vector to see its similarity relationships with others
  3. Add Input Vector: Create a test vector and edit its components in real-time
  4. Toggle Forces: Visualize the resonance forces between vectors
  5. Upload Data: Import your own vector datasets via the file upload feature

⌨️ Keyboard Shortcuts

Space        - Generate new vectors
F            - Toggle force visualization
I            - Add input vector
R            - Randomize input vector
Esc          - Close modals
←/→          - Adjust dimensions
↑/↓          - Adjust vector count

🎨 Visual Design Philosophy

Color Coding System

  • 🔴 Positive Components: High-energy, excitatory information (red spectrum)
  • 🔵 Negative Components: Low-energy, inhibitory information (blue spectrum)
  • ⚪ Neutral Components: Balanced, neutral information (gray spectrum)
  • 🟡 Input Vectors: User-controlled test subjects (golden)
  • 🟢 Uploaded Vectors: External dataset neurons (green spectrum)

Animation Principles

  • Pulse Frequency: Proportional to vector magnitude (higher energy = faster pulse)
  • Float Motion: Input vectors exhibit Brownian-like motion to simulate thermal agitation
  • Force Visualization: Dynamic opacity and thickness represent interaction strength
  • Selection Highlight: Enhanced glow and stroke for focused vectors

🧬 Advanced Concepts

Dimensional Projection

When visualizing high-dimensional vectors in 2D space, VectoVerse employs Principal Component Analysis concepts to maintain relative relationships:

Projection Quality = λ₁ + λ₂ / Σᵢ λᵢ

Where λᵢ are the eigenvalues of the covariance matrix.

Cluster Analysis (Coming in v2.0)

The framework will automatically identify vector clusters using:

  • K-means clustering for spatial grouping
  • Hierarchical clustering for similarity trees
  • DBSCAN for density-based pattern recognition

Information Geometry

VectoVerse interprets vector spaces through the lens of information geometry, where:

  • Distance = Information divergence
  • Curvature = Statistical manifold properties
  • Geodesics = Optimal information pathways

🏗️ Architecture

Module Structure

VectoVerse/
├── 🎯 VectorAtomicFramework.js    # Core framework and event coordinator
├── 🧠 StateManager.js             # State management for vectors and UI
├── ⚙️ ConfigManager.js             # Handles application configuration
├── ⌨️ KeyboardShortcuts.js         # Handles keyboard shortcuts
├── 🚌 EventBus.js                 # Handles communication between modules
├── 🎨 VectorRenderer.js           # Visualization and rendering engine  
├── ⚡ ForceCalculator.js          # Mathematical force computation
├── 🎬 AnimationEngine.js          # Real-time animation system
├── 🎛️ UIController.js             # User interface and interaction
├── 📁 FileHandler.js              # Data import/export functionality
└── 📊 Constants.js                # Configuration and styling constants

Design Patterns

  • Observer Pattern: For state management and reactive updates (via EventBus)
  • Strategy Pattern: For interchangeable force calculation algorithms
  • Module Pattern: For clean separation of concerns
  • Singleton Pattern: For the core Framework, StateManager, EventBus, and ConfigManager
  • Factory Pattern: For dynamic vector generation

🎓 Educational Applications

Mathematics Education

  • Linear Algebra: Visualize dot products, cross products, and orthogonality
  • Calculus: Understand gradient vectors and directional derivatives
  • Statistics: Explore correlation, covariance, and multivariate analysis

Computer Science

  • Machine Learning: Visualize feature vectors, similarity metrics, and clustering
  • Data Science: Understand high-dimensional data relationships
  • Computer Graphics: Learn vector transformations and projections

Physics Education

  • Quantum Mechanics: Analogies to state vectors and Hilbert spaces
  • Electromagnetism: Force field visualizations and potential energy
  • Statistical Mechanics: Ensemble properties and phase space exploration

🐛 Known Issues & Limitations

Current Limitations

  • Performance: Slows with >50 vectors due to O(n²) force calculations
  • Mobile Support: Touch interactions not fully optimized
  • File Size: Large datasets (>1000 vectors) may cause memory issues
  • Browser Compatibility: Requires modern ES6+ support

Planned Fixes

  • WebGL Rendering: Hardware acceleration for large datasets
  • Progressive Loading: Chunked data processing for large files
  • Touch Gestures: Mobile-first interaction redesign
  • Fallback Support: ES5 compatibility layer

🤝 Contributing

We welcome contributions that enhance the atomic-inspired visualization paradigm! Areas of particular interest:

High Priority

  • Performance Optimization: WebGL rendering, spatial indexing
  • Mobile Experience: Touch gestures, responsive design
  • Educational Content: Interactive tutorials, guided tours
  • Export Features: Save/load configurations, data export

Medium Priority

  • New Force Models: Additional physics-inspired interactions
  • Clustering Algorithms: K-means, hierarchical, DBSCAN implementation
  • Accessibility: Screen reader support, keyboard navigation
  • Testing Suite: Unit tests, integration tests, performance benchmarks

Low Priority

  • Theme System: Custom color schemes, dark/light modes
  • Plugin Architecture: Third-party extension support
  • Advanced Analytics: Statistical analysis tools
  • Documentation: API documentation, developer guides

🧪 Testing

To run the test suite, simply open the SpecRunner.html file in your web browser. The tests will run automatically and display the results.

🔄 Version Roadmap

v1.1 (Current)

  • ✅ Core visualization engine
  • ✅ Interactive vector editing
  • ✅ Force calculations
  • ✅ File upload support

v1.2 (Next Release)

  • 🔄 Export functionality
  • 🔄 Keyboard shortcuts
  • 🔄 Performance optimizations
  • 🔄 Mobile improvements

v2.0 (Major Update)

  • 🔮 Vector operations suite
  • 🔮 Clustering visualization
  • 🔮 Educational tutorials
  • 🔮 Advanced analytics

📄 License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.

🙏 Acknowledgments

  • D3.js Community: For the powerful visualization library
  • Mathematical Physics Community: For inspiration from atomic models
  • Open Source Contributors: For feedback and improvements
  • Educational Institutions: For use cases and requirements

VectoVerse represents a fusion of mathematical rigor and intuitive understanding, transforming the abstract realm of n-dimensional vectors into a tangible, interactive universe where mathematics meets physics, and complexity emerges from simplicity.

Created with ❤️ for the mathematical community

📞 Support & Community

🎓 Mathematical Education Guide

📐 Understanding Vector Mathematics

What is a Vector?

A vector is simply a list of numbers that represents a point or direction in multi-dimensional space. Think of it like coordinates:

  • 2D: (x, y) - like a point on a map
  • 3D: (x, y, z) - like a point in a room
  • nD: (x₁, x₂, ..., xₙ) - like a point in abstract mathematical space

Why the Atomic Analogy?

Just as atoms have:

  • Protons (positive charge) → Positive vector components
  • Electrons (negative charge) → Negative vector components
  • Neutrons (neutral) → Near-zero components
  • Nuclear forcesMathematical similarities between vectors

🔬 Core Mathematical Concepts Explained

1. Vector Magnitude (Nuclear Mass)

Formula: ||v|| = √(v₁² + v₂² + ... + vₙ²)
Example: For vector (3, 4), magnitude = √(3² + 4²) = √25 = 5

Physical Meaning: The "strength" or "energy" of the vector. Like measuring how powerful a force is.

2. Dot Product (Directional Alignment)

Formula: u·v = u₁v₁ + u₂v₂ + ... + uₙvₙ
Example: (1,2)·(3,4) = 1×3 + 2×4 = 11

Physical Meaning: Measures how much two vectors point in the same direction. Positive = same direction, negative = opposite.

3. Cosine Similarity (Normalized Alignment)

Formula: cos(θ) = (u·v)/(||u|| × ||v||)
Range: -1 to +1

Physical Meaning: The angle between vectors. 1 = identical direction, 0 = perpendicular, -1 = opposite.

4. Euclidean Distance (Spatial Separation)

Formula: d(u,v) = √((u₁-v₁)² + (u₂-v₂)² + ... + (uₙ-vₙ)²)

Physical Meaning: Straight-line distance between two points in n-dimensional space.

5. Information Entropy (Randomness Measure)

Formula: H(v) = -Σ p(vᵢ) × log₂(p(vᵢ))
Where: p(vᵢ) = |vᵢ|/||v||₁

Physical Meaning: How "random" or "uniform" the vector components are. Higher = more diverse information.

6. Resonance Force (Custom Similarity)

Formula: R(u,v) = (u·v)² / (||u-v||² + ε)

Physical Meaning: Combines how aligned vectors are (numerator) with how close they are (denominator). Like harmonic resonance between tuning forks.

🧪 Force Analogies Explained

Electromagnetic Force

Formula: F_em = k × (u·v) / ||u-v||²
  • Positive dot product → Attraction (like opposite charges)
  • Negative dot product → Repulsion (like same charges)
  • Distance squared → Force weakens with distance (like Coulomb's law)

Gravitational Force

Formula: F_grav = G × (||u|| × ||v||) / ||u-v||²
  • Always attractive (gravity never repels)
  • Magnitude product → Larger vectors attract more strongly
  • Distance squared → Follows Newton's law of gravitation

📊 Statistical Measures Explained

Mean (Average)

The typical value of vector components. Shows if the vector is generally positive, negative, or balanced.

Standard Deviation (Spread)

How much components vary from the average. High = diverse values, low = similar values.

Skewness (Asymmetry)

  • Positive skew: More large positive values than negative
  • Negative skew: More large negative values than positive
  • Zero skew: Symmetric distribution

Kurtosis (Tail Heaviness)

  • Positive kurtosis: More extreme values (heavy tails)
  • Negative kurtosis: Fewer extreme values (light tails)

🎯 Practical Applications

Machine Learning

  • Feature vectors: Each dimension represents a measurable property
  • Similarity search: Find similar items using cosine similarity
  • Clustering: Group similar vectors using distance measures

Data Science

  • Customer profiles: Each dimension is a behavioral metric
  • Document analysis: Each dimension represents word frequency
  • Recommendation systems: Similar vectors suggest similar preferences

Physics & Engineering

  • Force analysis: Vectors represent forces in different directions
  • Signal processing: Vectors represent frequency components
  • Computer graphics: Vectors represent positions and orientations

🤔 Conceptual Questions for Learning

  1. What does it mean when two vectors have a cosine similarity of 0.9?

    • They point in very similar directions (only 25.8° apart)
  2. Why might a vector have high entropy?

    • Its components are diverse/uniform, containing lots of different information
  3. When would electromagnetic force be negative?

    • When vectors have negative dot product (pointing in opposite directions)
  4. What makes two vectors "quantum entangled" in our analogy?

    • High correlation - their components tend to vary together

💡 Tips for Exploration

  1. Start Simple: Begin with 2-3 dimensions to visualize concepts
  2. Compare Metrics: See how different similarity measures relate
  3. Upload Real Data: Try with your own datasets to see patterns
  4. Adjust Parameters: Change vector count and dimensions to observe effects
  5. Focus on Patterns: Look for clusters and relationships in the visualization

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0