CSharpNumerics Library

website·Indexed 31 days ago

https://csnumerics.com

An open-source library for numerical analysis, statistics, machine learning, and physics simulations. It features modular simulation engines for quantum circuits, multiphysics PDEs, atmospheric gas dispersion (Geo Engine), and exoplanet transit detection. The library provides comprehensive tools for linear algebra, complex analysis, Monte Carlo integration, and a wide array of physics models covering quantum mechanics, solid mechanics, and astrophysics.

Tokens
75.1K
Snippets
368
Records
451
Agent score
59%

What's inside CSharpNumerics

  1. Overview of CSharpNumerics.Statistics modules

    The CSharpNumerics.Statistics namespace provides a comprehensive suite of tools for data analysis and statistical computing. It is organized into the following functional modules:

    • Descriptive: Summary statistics, moments, percentiles, skewness, and kurtosis.
    • Inferential: Regression, correlation, estimation, and inferential analysis.
    • Hypothesis Testing: Parametric and non-parametric tests, ANOVA, and significance workflows.
    • Random: Seedable random-number generation and advanced sampling methods.
    • Distributions: Probability distributions, density functions, and shared distribution interfaces.
    • Monte Carlo: General-purpose Monte Carlo simulation and stochastic estimation.
    • Robust: Outlier-resistant statistical methods.
    • Curve Fitting: Curve fitting, residual analysis, goodness-of-fit, and parameter estimation.
    • Time Series Analysis: Periodic signal detection, detrending, phase folding, peak fitting, and Holt–Winters forecasting.
    • State Estimation: Kalman filter, extended Kalman filter, and Rauch–Tung–Striebel smoother.
    • Data: Indexed datasets, time-series structures, and statistical data containers.
  2. Overview of CsharpNumerics capabilities

    CsharpNumerics is a lightweight, pure C# .NET library designed for scientific computing, machine learning, physics, and simulation engines. It provides modular building blocks for the following domains:

    • Numerical Analysis: Linear algebra, transforms, ordinary differential equations (ODEs), vector fields, numerical integration, and advanced computational methods.
    • Statistics: Descriptive and inferential statistics, probability distributions, stochastic processes, and Monte Carlo simulation.
    • Machine Learning: Supervised, unsupervised, and reinforcement learning, automated model selection, cross-validation, clustering, and model stability analysis.
    • Physics: Classical mechanics, electromagnetics, heat transfer, environmental modeling, quantum computing, and astrophysics.
  3. Overview of CSharpNumerics.Numerics numerical analysis modules

    The CSharpNumerics.Numerics namespace provides a comprehensive set of tools for numerical analysis built on Matrix and Vector primitives. Available modules include:

    • Numeric: Core utilities, constants, and helper functions.
    • Interpolation: Polynomial, spline, and piecewise interpolation.
    • Calculus: Derivatives, limits, series, and differential calculus.
    • Linear Algebra: Matrix operations, decompositions, eigenproblems, and solvers.
    • Integrals: Numerical quadrature, integration rules, and accumulation.
    • Differential Equations: ODE solvers and time-stepping methods.
    • Fields: Scalar, vector, and tensor fields with differential operators.
    • Finite Difference: Discretization, grids, operators, and boundary conditions.
    • Finite Element: 1D primitives for bar and Euler-Bernoulli beam analysis.
    • Complex Analysis: Complex numbers, analytic functions, and contour-based tools.
    • Transforms: Fourier, Laplace, digital filters, and wavelet transforms.
    • Optimization: Gradient methods, schedules, Pareto optimisation, and NSGA-II.
  4. Overview of the CSharpNumerics Machine Learning Framework

    CSharpNumerics provides a lightweight, fully numerical machine learning framework located in the CSharpNumerics.ML namespace. It is designed specifically for research, experimentation, and educational use, prioritizing mathematical clarity, transparency, and pipeline-based model evaluation over black-box automation.
  5. Overview of CSharpNumerics Sequence Models

    Sequence-specific deep-learning models are located under CSharpNumerics.ML.Sequence. These models implement the IModel contract and interpret each Matrix row as a flattened (timesteps x features) sample. Available models include classifiers and regressors for CNN1D, LSTM, Bi-LSTM, and TCN.
  6. Overview of CSharpNumerics Simulation Engine modules

    The CSharpNumerics.Engines namespace provides several modular computational engines for integration with visualization and analysis platforms:

    • Game Engine: Handles collision detection, constraints, rigid-body interactions, flight dynamics, rocket launch simulation, and gameplay simulation.
    • Audio Engine: Provides audio synthesis, signal processing, effects, and spectral analysis.
    • Geo Engine: Used for dispersion modelling, GIS analysis, wildfire spread, probability mapping, and spatial export.
    • Quantum Engine: Supports quantum circuits, core algorithms, noisy simulation, and error correction.
    • Multiphysics Engine: Features multiphysics PDE solvers, materials-aware workflows, export pipelines, and Monte Carlo/ML integration.
    • Exoplanet Engine: Focuses on transit detection, light-curve validation, feature extraction, and ML-assisted exoplanet classification.
  7. Overview of CSharpNumerics Probability Distributions

    The CSharpNumerics.Statistics.Distributions namespace provides a set of probability distributions that implement the IDistribution interface. All distributions expose the following common members:

    • Mean: The expected value of the distribution.
    • Variance: The variance of the distribution.
    • StandardDeviation: The standard deviation of the distribution.
    • Pdf(x): Probability Density Function (or Probability Mass Function for discrete distributions).
    • Cdf(x): Cumulative Distribution Function.
    • Sample(rng): Generates a single random sample using a provided random number generator.
    • Samples(rng, count): Generates an array of random samples.
    using CSharpNumerics.Statistics.Distributions;
    using CSharpNumerics.Statistics.Random;
  8. Overview of CSharpNumerics.Physics modules

    The CSharpNumerics.Physics namespace provides mathematical tools and models for classical and computational physics. It is organized into the following specialized modules:

    • Mechanics: Kinematics, dynamics, rigid-body motion, forces, energy, collisions, and oscillators.
    • Optics: Geometric optics (rays, lenses, mirrors, prisms, apertures, sensors, and ray tracing).
    • Waves: Wave equations, superposition, wave packets, and Fourier analysis.
    • Solid Mechanics: Euler-Bernoulli beams, Hooke's law, second moments of area, flexure, and beam deflections.
    • Fluid Dynamics: Navier-Stokes flow, Bernoulli relations, continuity, vorticity, drag, lift, and hydrostatics.
    • Thermodynamics: Conduction, convection, radiation, heat equations, dimensionless numbers, and lumped models.
    • Electromagnetism: Coulomb forces, Lorentz forces, Maxwell equations, potentials, and Biot-Savart fields.
    • Environmental: Plume and puff dispersion, diffusion, advection-diffusion, and Rothermel fire spread.
    • Materials Science: Isotopes, decay chains, radiation dose, chemical hazards, engineering materials, and fuel models.
    • Quantum Mechanics: Quantum gates, Bloch vectors, fidelity metrics, noise models, error-correction codes, and the Schrödinger-equation toolkit.
    • Astrophysics: Astronomical coordinate systems and related spatial transformations.
  9. Build Reinforcement Learning agents with CSharpNumerics.ML.ReinforcementLearning

    CSharpNumerics provides a full RL framework supporting tabular, value-based (deep), and policy gradient agents, along with various environments and exploration policies.
    // Tabular Agents
    QLearning, SARSA, MonteCarloControl
    
    // Deep RL Agents
    DQN, DoubleDQN, DuelingDQN
    
    // Policy Gradient Agents
    REINFORCE, ActorCritic (A2C), PPO
    
    // Continuous Control
    DDPG
    
    // Environments
    GridWorld, CartPole, MountainCar, Pendulum
    
    // Exploration
    EpsilonGreedy, SoftmaxPolicy, GaussianNoise, OrnsteinUhlenbeck
  10. Implement quantum algorithms using CSharpNumerics

    CSharpNumerics provides built-in implementations of several fundamental quantum algorithms.
    ShorAlgorithm // Integer factorization
    GroverSearch // Unstructured search
    QFT / InverseQFT // Quantum Fourier Transform
    QPE // Quantum Phase Estimation
  11. Perform numerical optimization with CSharpNumerics.Numerics.Optimization

    The optimization module provides tools for both single-objective and multi-objective numerical optimization.
    // Single-Objective
    GradientDescent, Adam, CoordinateDescent, Minimizer
    
    // Multi-Objective
    NSGA2 (Non-dominated Sorting Genetic Algorithm II), ParetoFront
    
    // Convergence
    EarlyStopping, LearningRateSchedule, MaxIterationsOrTolerance
  12. IWaveField Interface Overview

    The IWaveField interface is the base for all wave field classes in the CSharpNumerics.Physics.Waves namespace. It provides a standard set of methods for managing simulation time, energy tracking, stepping the simulation forward, and capturing snapshots of the field.
    public interface IWaveField
    {
        double Time { get; }
        double TotalEnergy { get; }
        void Step(double dt);
        void Reset();
        List<Serie> Snapshot();
    }