Skip to main content

A simple Python project for solving and eventually plotting numerically obtained solutions for ODEs

Project description

odesolver

A simple tool to solve ODEs numerically and plot the solution.

Features

- Solve ODEs with the Euler method 
- Solve ODEs with the RK4 method

Installation

You can install the package via PyPI or from source.

Install from PyPI

    pip install odesolver

Install from Source (GitHub)

    git clone https://github.com/patrikj-info/odesolver.git
    cd odesolver
    pip install .

Usage

Creating ODE

    # load homogenous ODE
    ode = ODE.readHomogenousODE("4.0x'' + 0.1x' + 2.0x")

    import numpy as np

    def funct(t,x):
        return np.cos(t)

    # load inhomogenous ODE
    ode = ODE.readODE("4.0x'' + 0.1x' + 2.0x", inhom=funct)

Solving using Euler's Method

    # find solution using Euler's method
    sol = ODESolver.solveODE(ode=ode, method="euler", initial_conditions=[1.0, 0.0], t0=0, t_final=10, h=0.01)

Solving using Runge-Kutta Order 4

    # find solution using Runge-Kutta 4
    sol = ODESolver.solveODE(ode=ode, method="rk4", initial_conditions=[1.0, 0.0], t0=0, t_final=10, h=0.01)

Plotting Solution

    # plot solution
    ODESolver.plotSolution(sol, phase_space=True, save=True, filename="harm_oscillator_euler.png", fileformat="png")

Creating Animated Graphs

    # plot solution
    # NOTE: the creation of the graph may take a relatively long time. Changing the fps may prove useful.
    ODESolver.plotSolution(sol, phase_space=False, save=True, filename="harm_oscillator_euler.gif", fileformat="gif", fps=500)

Project details


Download files

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

Source Distribution

jp_odesolver-0.0.3.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jp_odesolver-0.0.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file jp_odesolver-0.0.3.tar.gz.

File metadata

  • Download URL: jp_odesolver-0.0.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for jp_odesolver-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d6fe535761b61a7883e1d19a85bdc6e9b584b88bac88d4d7da059052bd783a95
MD5 b6158ffd6ea85b9bf87b4ea1d3620d57
BLAKE2b-256 83003cc61cf6dfc74671a585081cc322d75eb3a9488d68a5bf71b308c2488ab8

See more details on using hashes here.

File details

Details for the file jp_odesolver-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: jp_odesolver-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for jp_odesolver-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bc2ad524539e16f2fce1d5df74026ab8e89779fa3b3c4752d7fb3a57fa3f8a75
MD5 09c4bef699ffadd63001e5a1f77519cf
BLAKE2b-256 e61e4b474b77038c242b0653a59725e5c2b114fa43361cb96fd54583f53bf6b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page