sympyã§ããããè¨ç®ãã
è¨å·è¨ç®ãã§ããpythonã©ã¤ãã©ãªã®sympyã使ã£ã¦ã¿ãã
å æ°å解ã¨ãå¾®åã¨ããmathematica風ã®æ©è½ãpythonã§ã使ããããã«ãªãã
ã¤ã³ã¹ãã¼ã«
$ pip install sympy
æ°å¼ããããã«è¡¨ç¤ºããããã«ãipython notebookã使ãã®ããªã¹ã¹ã¡ã
from sympy import * # æ°å¼ã®è¡¨ç¤ºãããããã®ã¡ã½ãã init_printing() # 使ç¨ããå¤æ°ã®å®ç¾© x, y, z = symbols('x y z') # æ¹ç¨å¼ãã¤ãã expr = exp(x)/y + z**2 expr # å±é expand((x + y)**3) # å æ°å解 factor(x**2 + 2*x*y + y**2) # æ¹ç¨å¼ãç°¡åã«ãã sympify((x + 2*x + x**3)*4 + 3 + x + 4*x) # æ¹ç¨å¼ã解ã expr = x * y + 2/y solve(expr, x) # 極é # 1/x ã x ã«ã¤ãã¦ç¡é大ã®æ¥µéãã¨ã limit(1/x, x, oo) # å¾®å diff(sin(x), x) # ç©å integrate(cos(x), x)
åºåè²¼ãã®ããã©ãããã£ãã®ã§ããã£ã¡ã§ç¢ºèªãã¦ãã ããã
-> http://nbviewer.ipython.org/6210102
github
-> https://github.com/akiniwa/py_sympy