Skip to main content

A simple way to do 2D and 3D phase portraits.

Project description

What's this?

The idea behind this project was to create a simple way to make phase portraits in 2D and 3D, as we couldn't find something similar on the internet, so we got down to work.

This idea came while taking a course in non linear dynamics and chaos, during the 3rd year of physics degree, brought by our desire of visualizing things and programming.

We want to state that we are self-taught into making this kind of stuff, and we've tried to make things as professionally as possible, any comments about improving our work are welcome!

At first, this project was made up in spanish. The spanish version can be found here.

Authors

Contributing

The code is open, everyone can download it and use it. You can also contribute if you wish. To do that, several options are offered:

  • Fork the project, add a new feature / improve the existing ones and pull a request via GitHub.
  • Contact us on our emails (shown above).

Installation

Installation via pip:

$ pip install phaseportrait

Installation via git:

Open a terminal on desired route and type the following

$ git clone https://github.com/Loracio/phase-portrait

Manual installation

Visit phase-portrait webpage on GitHub. Click on green button saying Code, and download it in zip format. Save and unzip on desired directory.

Examples of use

Examples showing how to use PhasePortrait2D class.

Examples using the slider feature from PhasePortrait2D class.

Contains examples of 3D trajectories with and without sliders.

Instructions

Using phaseportrait is easy, it has to be firstly imported, which can be done this way:

import phaseportrait
from phaseportrait import *

This will let us use the following classes:

Both of them share their first arg: a function that computes the derivative of given coordinates in a point.

dF function

def dF(x,y):
  return expressionX  ,  expressionY

Extra variables can also be passed in dictionary form. For example, we can pass ω parameter for an harmonic oscillator with default value 1 the following way:

def dFOscillator(x, y, *, ω=1):
    return y, -ω*ω*x

PhasePortrait2D

class phaseportrait.PhasePortrait2D(dF, Range, *, MeshDim=10, dF_args={}, Density=1, Polar=False, **kwargs)

Gives the option to represent a 2D phase portrait given a dF function with 2 args.

Trajectory3D

class phaseportrait.Trajectory3D(dF, *, Range=None, dF_args={}, n_points=10000, runge_kutta_step=0.01, runge_kutta_freq=1, **kwargs)

Gives the option to represent 3D trajectories given a dF function with 3 args.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

phaseportrait-0.1.0-py3-none-any.whl (10.9 kB view hashes)

Uploaded Python 3

Supported by

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