Last active
August 29, 2015 14:18
-
-
Save rlabbe/8870c25915085194cd8d to your computer and use it in GitHub Desktop.
Plot linear equations with sympy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy.abc import x, y, z | |
from sympy.plotting import plot, plot3d | |
import sympy as sp | |
fron sympy import solve, Eq | |
def plot_line(e): | |
e = solve(e, y) | |
plot(e[0]) | |
def plot_plane(e): | |
e = solve(e, z) | |
plot3d(e[0]) | |
def plot_eq(lhs, rhs): | |
""" plots equation of form lhs = rhs. e.g to plot x+2y=3, call plot_eq(x+2*y, 3)""" | |
plot(solve(Eq(lhs, rhs), y)[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment