from sympy import *
x = Symbol('x')
y = Symbol('y')
integrate(x**3, (x, -1, 1))
0
integrate( 1/x )
log(x)
integrate( 1/(1 +2*x) )
log(2*x + 1)/2
integrate( 1/(1 - 2*x) )
-log(2*x - 1)/2
solve([x + 5*y - 2, -3*x + 6*y - 15], [x, y])
{x: -3, y: 1}
f, g = symbols('f g', cls=Function)
f(x).diff(x, x) + f(x)
f(x) + Derivative(f(x), x, x)
dsolve(f(x).diff(x, x) + f(x), f(x))
Eq(f(x), C1*sin(x) + C2*cos(x))
dsolve(sin(x)*cos(f(x)) + cos(x)*sin(f(x))*f(x).diff(x), f(x), hint='separable')
[Eq(f(x), -asin(sqrt(C1/(sin(x)**2 - 1) + 1)) + pi), Eq(f(x), asin(sqrt(C1/(sin(x)**2 - 1) + 1)) + pi), Eq(f(x), -asin(sqrt(C1/(sin(x)**2 - 1) + 1))), Eq(f(x), asin(sqrt(C1/(sin(x)**2 - 1) + 1)))]
diff(x, x)
1
diff(1/x, x)
-1/x**2
diff(1/(2*y), y)
-1/(2*y**2)
diff(1/x, x) - diff(1/(2*y), y)
1/(2*y**2) - 1/x**2
from __future__ import division
from sympy import *
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)
eq = (Eq(Derivative(x(t),t), 12*t*x(t) + 8*y(t)), Eq(Derivative(y(t),t), 21*x(t) + 7*t*y(t)))
eq
(Eq(Derivative(x(t), t), 12*t*x(t) + 8*y(t)), Eq(Derivative(y(t), t), 7*t*y(t) + 21*x(t)))
dsolve(eq)
[Eq(x(t), C1*x0 + C2*x0*Integral(8*exp(Integral(7*t, t))*exp(Integral(12*t, t))/x0**2, t)), Eq(y(t), C1*y0 + C2(y0*Integral(8*exp(Integral(7*t, t))*exp(Integral(12*t, t))/x0**2, t) + exp(Integral(7*t, t))*exp(Integral(12*t, t))/x0))]
eq1 = (Eq(Derivative(x(t),t), 12*t*x(t) + 8*y(t)))
eq1
Eq(Derivative(x(t), t), 12*t*x(t) + 8*y(t))
dsolve(eq1)
Eq(-4*Integral(2*y(t)*exp(-6*t**2), t) - 4*Integral(3*t*x(t)*exp(-6*t**2), t), C1)
eq1 = (Eq(Derivative(1/x,x)- Derivative((2*y)**(-1), y)))
eq1
Eq(Derivative(1/x, x) - Derivative(1/(2*y), y), 0)
dsolve(eq1)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-57-b4355e87dcda> in <module>() ----> 1 dsolve(eq1) /Users/chengjun/anaconda/lib/python2.7/site-packages/sympy/solvers/ode.py in dsolve(eq, func, hint, simplify, ics, xi, eta, x0, n, **kwargs) 623 hints = _desolve(eq, func=func, 624 hint=hint, simplify=True, xi=xi, eta=eta, type='ode', ics=ics, --> 625 x0=x0, n=n, **kwargs) 626 627 eq = hints.pop('eq', eq) /Users/chengjun/anaconda/lib/python2.7/site-packages/sympy/solvers/deutils.py in _desolve(eq, func, hint, ics, simplify, **kwargs) 173 # preprocess the equation and find func if not given 174 if prep or func is None: --> 175 eq, func = _preprocess(eq, func) 176 prep = False 177 /Users/chengjun/anaconda/lib/python2.7/site-packages/sympy/solvers/deutils.py in _preprocess(expr, func, hint) 75 if len(funcs) != 1: 76 raise ValueError('The function cannot be ' ---> 77 'automatically detected for %s.' % expr) 78 func = funcs.pop() 79 fvars = set(func.args) ValueError: The function cannot be automatically detected for Derivative(1/x, x) - Derivative(1/(2*y), y).