In [59]: h_x
Out[59]:
2 3
(x + 1) ⋅(x + 2)⋅(x + 3) + (x + 4)
In [60]: latex(h_x)
Out[60]: '\\left(x + 1\\right)^{2} \\left(x + 2\\right) \\left(x + 3\\right) + \\left(x + 4\\right)^{3}'
In [50]: f_x
Out[50]:
2
(x + 1) ⋅(x + 2)⋅(x + 3)
In [51]: expand(f_x)
Out[51]:
4 3 2
x + 7⋅x + 17⋅x + 17⋅x + 6
In [21]: g_x = x**2 + 2*x + 1
In [22]: factor(g_x,x)
Out[22]:
2
(x + 1)
In [21]: g_x = x**2 + 2*x + 1
In [22]: factor(g_x,x)
Out[22]:
2
(x + 1)
In [23]: factor_list(g_x,x)
Out[23]: (1, [(x + 1, 2)])
http://docs.sympy.org/latest/modules/polys/reference.html?highlight=factor_list#sympy.polys.polytools.factor_list
In [35]: f_x
Out[35]:
-2⋅x
ℯ ⋅sin(2⋅x)
In [39]: f_x.args
Out[39]:
⎛ -2⋅x ⎞
⎝ℯ , sin(2⋅x)⎠
In [25]: f
Out[25]: x**2 + 4/x**2
In [26]: g = (x + 2/x)**2
In [27]: div(g, f)
Out[27]: (1, 4)
In [28]: q,r = div(g,f)
In [29]: h = q * f + r
In [30]: h
Out[30]: x**2 + 4 + 4/x**2
In [31]: g == h
Out[31]: False
In [32]: g.expand() == h
Out[32]: True
In [45]: f_x
Out[45]:
⎛ π⎞
sin⎜x + ─⎟
⎝ 4⎠
In [46]: f_x.rewrite(cos)
Out[46]:
⎛ π⎞
cos⎜x - ─⎟
⎝ 4⎠
In [47]: f_x.rewrite(tan)
Out[47]:
⎛x π⎞
2⋅tan⎜─ + ─⎟
⎝2 8⎠
───────────────
2⎛x π⎞
tan ⎜─ + ─⎟ + 1
⎝2 8⎠
In [48]: f_x.rewrite(exp)
Out[48]:
⎛ ⎛ π⎞ ⎛ π⎞⎞
⎜ ⅈ⋅⎜-x - ─⎟ ⅈ⋅⎜x + ─⎟⎟
⎜ ⎝ 4⎠ ⎝ 4⎠⎟
-ⅈ⋅⎝- ℯ + ℯ ⎠
────────────────────────────────
2
Es scheint eine Möglichkeit zu geben, es in einer Matrix anzuzeigen, aber kann es im Bereich der Mathematik an der High School mit "Point" verwaltet werden?
In [64]: Point([3,4])
Out[64]: Point2D(3, 4)
In der Skala können Sie den Koeffizienten angeben, der für jede Variable multipliziert werden soll.
In [65]: a = Point([2,-3])
In [70]: a.scale(3)
Out[70]: Point2D(6, -3)
In [71]: a.scale(3,3)
Out[71]: Point2D(6, -9)
In [104]: a
Out[104]: Point2D(2, -3)
In [105]: a.origin
Out[105]: Point2D(0, 0)
In [106]: a.distance(a.origin)
Out[106]: √13
In [92]: a
Out[92]: Point2D(2, -3)
In [93]: c
Out[93]: Point2D(4, 4)
In [94]: a.dot(c)
Out[94]: -4
In [108]: a
Out[108]: Point2D(2, -3)
In [109]: a.orthogonal_direction
Out[109]: Point2D(3, 2)
In [110]: a.dot(a.orthogonal_direction)
Out[110]: 0
In [1]: from sympy.stats import P, E, Die
In [2]: X = Die('X',6)
In [3]: X
Out[3]: X
In [4]: P(X>3)
Out[4]: 1/2
In [5]: E(X)
Out[5]: 7/2
In [6]: Y = Die('Y',6)
In [7]: E(X+Y)
Out[7]: 7
In [8]: P(X+Y>10)
Out[8]: 1/12
Außerdem ist die Wahrscheinlichkeitsverteilung des Münzwurfs, der gleichmäßigen Verteilung usw. nahezu vollständig.
http://docs.sympy.org/latest/modules/stats.html