Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Tools for numerical math calculations

Project description

Tools for numerical math calculations

Build Status Codacy Badge Codacy Badge

This repository contains tools for math numerical computation such as numerical integration and interpolation. The current implementation contains:

  • numerical integration using Gauss formula

    import numpy as np
    from numerical.integration import gauss
    
    def f(x):
        return np.power(x[0], 2)
    
    gauss.integrate(f, 0., 1.)  # 0.3333333
    
  • spline functions and theirs derivatives

    import numpy as np
    from numerical import splines
    import matplotlib.pyplot as plt
    
    x = np.arange(0, 4., 0.05)
    y = splines.schoenberg(x)
    yd1 = splines.schoenberg.deriv(x, order=1)  # first derivative
    yd2 = splines.schoenberg.deriv(x, order=2)  # second derivative
    # visualize results
    plt.plot(x, y)
    plt.plot(x, yd1)
    plt.plot(x, yd2)
    plt.show()
    

spline_derivs

  • function interpolation

    import numpy as np
    from numerical import interpolate
    import matplotlib.pyplot as plt
    
    def fun(x):
        return 1 - np.power(x[0] - 0.5, 2)
    
    grid = np.array([np.arange(0, 1.0001, 0.25)])
    values = fun(grid)
    itp_fun = interpolate(values, grid)
    
    x = np.arange(0., 1.00001, 0.001).reshape(1, -1)
    y_intp = itp_fun(x)
    y_true = fun(x)
    
    plt.plot(x[0], y_intp)
    plt.plot(x[0], y_true)
    plt.show()
    

linear_interpolation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
scikit_numerical-0.1.1-py3-none-any.whl (13.4 kB) Copy SHA256 hash SHA256 Wheel py3
scikit-numerical-0.1.1.tar.gz (8.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page