Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ~/tmp ❯❯❯ conda activate torch1
- (torch1) ~/tmp ❯❯❯ python
- >>> from sympy import *
- >>> x = Symbol('x')
- >>> y = Symbol('y')
- >>> (x + y)**2
- (x + y)**2
- >>> ((x + y)**2).expand()
- x**2 + 2*x*y + y**2
- >>>
- >>> from sympy.interactive import printing
- >>> printing.init_printing(use_latex=True)
- >>>
- >>>
- >>> ((x + y)**2).expand()
- 2 2
- x + 2⋅x⋅y + y
- >>> init_printing()
- >>>
- >>>
- >>> ((x + y)**2).expand()
- 2 2
- x + 2⋅x⋅y + y
- >>> a = Integral(cos(x)*exp(x), x)
- >>> Eq(a, a.doit())
- ⌠ x x
- ⎮ x ℯ ⋅sin(x) ℯ ⋅cos(x)
- ⎮ ℯ ⋅cos(x) dx = ───────── + ─────────
- ⌡ 2 2
- >>>
- >>>
- >>> (sqrt(2-x) + sqrt(2+x)).factor()
- ________ _______
- ╲╱ -x + 2 + ╲╱ x + 2
- >>> (-x) + sqrt(2+x)).factor()
- KeyboardInterrupt
- >>> (4 + 2*sqrt(2-x)*sqrt(2+x)).factor()
- ⎛ ________ _______ ⎞
- 2⋅⎝╲╱ -x + 2 ⋅╲╱ x + 2 + 2⎠
- >>> (4 - x + x + 2*sqrt(2-x)*sqrt(2+x)).factor()
- ⎛ ________ _______ ⎞
- 2⋅⎝╲╱ -x + 2 ⋅╲╱ x + 2 + 2⎠
- >>> (x**2 + 2*x + 1).factor()
- 2
- (x + 1)
- >>> (x**3 - sqrt(2-x)**3).factor()
- 3 ________ ________
- x + x⋅╲╱ -x + 2 - 2⋅╲╱ -x + 2
- >>> (x**3 - sqrt(2-x)**3).expand
- <bound method Expr.expand of x**3 - (-x + 2)**(3/2)>
- >>> (x**3 - sqrt(2-x)**3).expand()
- 3 ________ ________
- x + x⋅╲╱ -x + 2 - 2⋅╲╱ -x + 2
- >>> factor(sqrt(2-x) + sqrt(2+x))
- ________ _______
- ╲╱ -x + 2 + ╲╱ x + 2
- >>>
- >>>
- >>> (x**3 - 8*y**6).factor()
- ⎛ 2⎞ ⎛ 2 2 4⎞
- ⎝x - 2⋅y ⎠⋅⎝x + 2⋅x⋅y + 4⋅y ⎠
- >>>
- >>>
- >>> (x^4 - 1).factor()
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- AttributeError: 'Not' object has no attribute 'factor'
- >>> (x**4 - 1).factor()
- ⎛ 2 ⎞
- (x - 1)⋅(x + 1)⋅⎝x + 1⎠
- >>> (2*x**3 + x**2*y-6*x*y-3*y**2)
- 3 2 2
- 2⋅x + x ⋅y - 6⋅x⋅y - 3⋅y
- >>> (2*x**3 + x**2*y-6*x*y-3*y**2).factor()
- ⎛ 2 ⎞
- (2⋅x + y)⋅⎝x - 3⋅y⎠
- >>>
- >>>
- >>> x2 = x**2
- >>> (x2 + 6*x - 7).factor()
- (x - 1)⋅(x + 7)
- >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement