2 import iam_sympy_example
4 from sympy
import Symbol
, Basic
5 from sample
import sample
7 def mplot2d(f
, var
, show
=True):
9 Plot a 2d function using matplotlib/Tk.
13 warnings
.filterwarnings("ignore", "Could not match \S")
18 raise ImportError("Matplotlib is required to use mplot2d.")
20 if not isinstance(f
, (tuple, list)):
24 x
, y
= sample(f_i
, var
)
31 if __name__
== "__main__":
32 from sympy
import sqrt
, sin
, log
, pi
35 #mplot2d(log(x), (x, 0, 2, 100))
36 #mplot2d([sin(x), -sin(x)], (x, float(-2*pi), float(2*pi), 50))
37 mplot2d([sqrt(x
), -sqrt(x
), sqrt(-x
), -sqrt(-x
)], (x
, -40.0, 40.0, 80))