Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Github repo cloud-examples: https://github.com/sagemath/cloud-examples

Views: 7978
License: MIT

Sympy

Cells are evaluated in Sage, hence there are a few differences.

  • Raw Python integer numbers are entered by appending an r, like 42r.
  • The ^ symbol automatically expands to **.
%auto from __future__ import division import sympy as sy from sympy import symbols, log, pi, oo, pprint, Function, limit x, y, z, t = symbols('x y z t') k, m, n = symbols('k m n', integer=True) f, g, h = symbols('f g h', cls=Function)
ex = x * log(2*x) / log(x) simplify(ex)
x + x*log(2)/log(x)
ex.subs({x : 2*pi})
2*pi*log(4*pi)/log(2*pi)
limit((x-3*x^2)/(1-x-2 * x^2), x, oo)
3/2
expr = (x^2 - 1)/(x - 1) print expr print expr.cancel()
(x**2 - 1)/(x - 1) x + 1
expr2 = log(expr).integrate(x) pprint(expr2, use_unicode=True)
⎛ 2 ⎞ ⎛ 2 ⎞ ⎜ x 1 ⎟ ⎜ x 1 ⎟ x⋅log⎜───── - ─────⎟ - x + log⎜───── - ─────⎟ ⎝x - 1 x - 1⎠ ⎝x - 1 x - 1⎠
@interact def diffit(i = slider(range(7), default = 3)): expr = sin(i * x) ^ (i * x) pprint(expr, use_unicode=True) print dexpr = expr.diff(x, i) pprint(dexpr, use_unicode=True)
Interact: please open in CoCalc