Skip to main content

NumSolve

Package to solve various equations using Numerical Methods

List of Methods Implemented

  • Euler Forward method

  • Newton Raphson Method 1D

  • Euler Backward method

  • Modified Euler method

  • Euler Cauchy Method/Hune Method

  • Ranga Kutta method of thita

  • General 2nd Order method

  • Nystrom 3rd order method

  • Hune 3rd order method

  • Classical 3rd Order method

  • Nearly optimal 3rd Order method

  • Kutta Method 4th order method

  • Classical 4th Order method

  • General Explicit Ranga Kutta method

  • Newton Raphson Method for solving for y for a given x in F(x,y) = 0

  • Implicit RK Method of order 2

  • Implicit RK Method of order 4

  • Forward Difference operator

  • Backward Difference operator

  • Adam Bashford method

  • Adam Moulton method

  • Newton Raphson Method for solving for y for a given x in y-coeff* F(x,y) = intercept

  • Milne Simpson method

  • Adams Bashforth Moulton PC method

  • Milne PC method

  • Euler PC method

  • Thomas Algorithm for solving tridiagonal system

  • Finite Difference Method to solve general 2nd order BVP

Further scope

  • Methods to solve PDEs

Examples

import the package


>>> import numsolve as ns

define the functions needed for the equation


>>> # function

>>> def h(x,y):

...     return -2*x*y*y

...

>>> # partial derivative wrt y

>>> def dhy(x,y):

...     return -4*x*y

...

>>> # partial derivative wrt x

>>> def dhx(x,y):

...     return -2*y*y

check the doc strings and run the methods


>>> help(ns.ECM)

Help on function ECM in module numsolve:



ECM(n, F, y_init, limit=[0, 1])

    Euler Cauchy Method or Hune Method for solution of

    y' = F(x,y)



    n : number of steps

    F : F(x,y) takes 2 input as x and y then outputs the value for this equation

    y_init = initial value at point x=a

    limit : [a,b], region on x to solve the equation for



>>> ns.ECM(5,F=h,y_init=1)

[1, 0.96, 0.86029775536128, 0.7350425008089037, 0.6115716703493418]


>>> help(ns.General_Explicit)

Help on function General_Explicit in module numsolve:



General_Explicit(order, W, A, n, F, y_init, limit=[0, 1], C=None)

    General Explicit Ranga Kutta method for solution of

    y' = F(x,y)



    order : order of method say m

    W = weight numpy Array for, y_n+1 = y_n + ( w1*k1 + w2*k2.....+ wm*km ), here W = [w1,w2..,wm]

    A = weight numpy matrix Matrix for, ki = h*F(x_n + ci*h,y_n + ( a_{i,i}*k1 + a_{i,2}*k2 + ...+ a_{i,i-1}*k_i-1 )) for i = 0...m, h is step size = (b-a/n)

        note values beyound i-1 are all supposed to be zero for Explicit method

    n : number of steps

    F : F(x,y) takes 2 input as x and y then outputs the value for this equation

    y_init = initial value at point x=a

    limit : [a,b], region on x to solve the equation for

    C : weight numpy Array [c1,c2...c], usually ci = a_{i,1}+ a_{i,2}+..+  a_{i,i-1}

        this can be changed with help of this input



>>>

>>> ns.General_Explicit(3,[0.5,0.3,0.2],[[0,0,0],[1,0,0],[0.5,0.2,0]],5,F=h,y_init=1)

[1, 0.9651555328, 0.8676644565853738, 0.7409120390270509, 0.6143029355673265]

Metadata

Release files for numsolve 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numsolve 0.0.3
File Size Uploaded
numsolve-0.0.3.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for numsolve 0.0.3
File Interpreter ABI Platform
numsolve-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / numsolve-0.0.3.tar.gz

Download URL numsolve-0.0.3.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1c30a1cfb6e318ad45c4a0f3a259fabdac3c7a5abb3b268f1f8021e1f3276a6a
BLAKE2b-256 checksum
How to use checksums
6bd7a56020f44560fd4594ab2fb177eb8f36d460bddc525e64553499aec3cb14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.4

Release files / numsolve-0.0.3-py3-none-any.whl

Download URL numsolve-0.0.3-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28248b3658a1fd07ee60a1b75e65222077ea88fa3d04529ee769b988883b189a
BLAKE2b-256 checksum
How to use checksums
edb5a7bbc2dff1c37af210810b24fd72ec9691adf599be067ea765e6ac98d881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page