Giter VIP home page Giter VIP logo

plotcp's Introduction

PlotComplexPlane

Python library for plotting complex functions transformations

It can...

  • plot complex planes (both transformed and original)
  • plot transformations of specific areas (both transformed and original)
  • plot lines parallel to real or imaginary axis (both transformed and original)

Usage

plotcp

To plot f(z) = (z+1)/z with x bound from -4 to 4 and y bound from -4 to 4

from plotcp import plotcp


def f(z: complex) -> complex: # Define function to plot
    return (z+1)/z


# Call plotcp
# Second and third arguments define limits of a plot
ax = plotcp(f, (-4, 4), (-4, 4))

For full parameters list check help(plotcp.plotcp)

plot_complex_points

from cmath import sin

import matplotlib.pyplot as plt
import numpy as np

from plotcp import plot_complex_points

def f(z: compex) -> complex: # Define function to plot
    return sin(z)


# Define area to be plotted
top = [x + 2 * 1j for x in np.linspace(1, 2, 5)]
bottom = [x + 1 * 1j for x in np.linspace(1, 2, 5)]
left = [1 + y * 1j for y in np.linspace(1, 2, 5)]
right = [2 + y * 1j for y in np.linspace(1, 2, 5)]

# Plot original area
ax = plot_complex_points(top)
ax = plot_complex_points(bottom, ax=ax)
ax = plot_complex_points(left, ax=ax)
ax = plot_complex_points(right, ax=ax)


# Apply function to area and plot it on a new plot
ax2 = plot_complex_points([f(z) for z in top])
ax2 = plot_complex_points([f(z) for z in bottom], ax=ax2)
ax2 = plot_complex_points([f(z) for z in left], ax=ax2)
ax2 = plot_complex_points([f(z) for z in right], ax=ax2)

plt.show()

For full parameters list check help(plotcp.plot_complex_points)

plotcp's People

Contributors

koolmonke avatar zettzet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.