from __future__ import division, print_function # Python 3 from sympy import init_printing init_printing(use_latex='mathjax',use_unicode=False) # Affichage des résultats %matplotlib inline from sympy import plot from sympy import sin from sympy.abc import x plot(sin(x)) plot(sin(x)/x, (x,-100,100)) plot(x**2+x-6, (x,-5,5), line_color='red', title='Youpi') plot(x, x**2, x**3, (x, -2, 2), ylim=(-2,2)) p1 = plot(x, (x, -1, 1), show=False, line_color='b') p2 = plot(x**2, (x, -1, 1), show=False, line_color='r') p3 = plot(x**3, (x, -1, 1), show=False, line_color='g') p1.extend(p2) p1.extend(p3) print(p1) p1.show() from sympy.plotting import plot3d from sympy.abc import x,y plot3d(x**2+y**2) plot3d(sin(x*10)*cos(y*4), (x, -1, 1), (y, -1, 1)) from sympy import sin, cos from sympy.abc import u, v from sympy.plotting import plot_parametric plot_parametric(cos(3*u), sin(2*u), (u, -5, 5)) from sympy.plotting import plot3d_parametric_line plot3d_parametric_line(cos(u), sin(u), u, (u, -15, 15)) from sympy.plotting import plot3d_parametric_surface X = cos(u)*(5+2*cos(v)) Y = sin(u)*(5+2*cos(v)) Z = 2*sin(v) plot3d_parametric_surface(X, Y, Z, (u, -.5, 4), (v, -5, 5)) from sympy import plot_implicit, Eq from sympy.abc import x, y eq = Eq(x**2+y**2+x*y-2*x, 5) eq plot_implicit(eq) plot_implicit(eq, (x,-2,5), (y,-5,3)) plot_implicit(y > 2*x+1) from sympy import And plot_implicit(And(y>2*x+1, y<5*x, x+y<5)) from sympy import mpmath # Sympy (installation normale) import mpmath # SageMath %matplotlib inline mpmath.cplot(lambda z: z, [-10, 10], [-10, 10]) I = complex(0,1) # le nombre complexe I de Python mpmath.cplot(lambda z: I*z, [-10, 10], [-10, 10]) mpmath.cplot(lambda z: z**5-1, [-2, 2], [-2, 2]) from mpmath import zeta mpmath.cplot(zeta, [-10, 10], [-50, 50])