Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 0.12 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
%guiref -> A brief reference about the graphical user interface.
In [1]: 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)
...:
In [2]: %load_ext sympyprt
In [3]: (1/cos(x)).series(x, 0, 10)
Out[3]:
In [4]: pi**2
Out[4]:
In [5]: oo+1
Out[5]:
In [6]: 1/( (x+2)*(x+1) )
Out[6]:
In [7]: diff(sin(x), x)
Out[7]:
In [8]: e = 1/(x + y)
...: s = e.series(x, 0, 5)
...:
In [9]: e
Out[9]:
In [10]: s
Out[10]:
In [11]: integrate(exp(-x**2)*erf(x), x)
Out[11]:
In [11]:
In [12]: exp(I*x).expand(complex=True)
Out[12]:
In [13]: from sympy.abc import theta, phi
...: Ylm(2, 1, theta, phi)
...:
Out[13]:
In [14]: factorial(x)
Out[14]:
In [15]: gamma(x + 1).series(x, 0, 3)
Out[15]:
In [16]: assoc_legendre(2, 1, x)
Out[16]:
In [17]: f(x).diff(x, x) + f(x)
Out[17]:
In [18]: dsolve(f(x).diff(x, x) + f(x), f(x))
Out[18]:
In [19]: from sympy import Matrix
...: A = Matrix([[1,x], [y,1]])
...:
In [20]: A
Out[20]:
In [21]: A**2
Out[21]:
In [22]: Integral(x**2, x)
Out[22]:
In [23]: N(sqrt(2)*pi, 50)
Out[23]:
In [24]: Abs(-x)
Out[24]:
In [25]: binomial(x,y)
Out[25]:
⎛x⎞
⎜ ⎟
⎝y⎠
In [26]: g = meijerg([1], [2], [3], [4], x)
In [27]: g
Out[27]:
In [28]: integrate(x**2 * exp(x) * cos(x), x)
Out[28]:
In [29]: y | (x & y)
Out[29]:
In [30]: x >> y
Out[30]:
In [31]: Matrix(3, 4, lambda i,j: 1 - (i+j) % 2)
Out[31]:
In [32]: M = Matrix(([1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]))
In [33]: M
Out[33]:
In [34]: M**4
Out[34]:
In [35]: A = Matrix([[1,1,1],[1,1,3],[2,3,4]])
...: Q, R = A.QRdecomposition()
...:
In [36]: Q
Out[36]:
In [37]: x, y, t, x0, y0, C1= symbols('x,y,t,x0,y0,C1')
...: P, Q, F= map(Function, ['P', 'Q', 'F'])
...: Eq(Eq(F(x, y), Integral(P(t, y), (t, x0, x)) + Integral(Q(x0, t), (t, y0, y))), C1)
...:
Out[37]:
In [38]: dsolve(2*x*f(x) + (x**2 + f(x)**2)*f(x).diff(x), f(x),hint='1st_homogeneous_coeff_best')
Out[38]:
In [39]: n=Symbol('n')
...: f, P, Q = map(Function, ['f', 'P', 'Q'])
...: genform = Eq(f(x).diff(x) + P(x)*f(x), Q(x)*f(x)**n)
...:
In [40]: genform
Out[40]:
In [41]: dsolve(genform, f(x), hint='Bernoulli_Integral')
Out[41]:
In [42]: from sympy.tensor import IndexedBase, Idx
In [43]: M = IndexedBase('M')
...: i, j = map(Idx, ['i', 'j'])
...:
In [44]: M[i, j]
Out[44]:
In [45]: %sympyprt help
Usage: %<magicname> on | off | help | use <m> | <p> <v>
<m> : method
simple ...... use IPython's latex_to_png (no options)
mplib ....... use matplotlib (options: fontsize, textcolor, resolution)
latex ....... use LaTeX (required). Options are: fontsize, textcolor,
resolution, imagesize, backcolor and offset.
<p> : parameter, <v> : value
fontsize .... set the fontsize (unit: pt), <v> = Integer
resolution .. set the resolution (unit: dpi), <v> = Integer
imagesize ... set the image size. <v> may be tight, bbox or
a comma separated dimension pair: e.g. 4cm,2cm
(No whitespace between characters!)
textcolor.... set the foreground color. <v> = colorname, e.g. Red, Blue
backcolor ... set the background color. <v> = colorname, e.g. Yellow
offset ...... offset for image content. <v> = a comma separated dimension
pair: e.g. -1cm,-2cm (No whitespace between characters!)
mode ........ <v> = inline, equation, equation*
matrix ...... matrix type: <v> = p,v,b,V,B,small (as in LaTeX: <v>matrix)
breqn ....... use the breqn package: <v> = on/off
reset ....... <v> = config|cache; config: reset the cfg to factory settings
cache: clear the cache and remove the png files from temp.
*EOI*
In [46]: %sympyprt textcolor Red
In [47]: g #cached
Out[47]:
In [48]: (1/cos(x)).series(x, 0, 10) #cached
Out[48]:
In [49]: x**n # not cached
Out[49]:
In [50]: %sympyprt reset cache
In [51]: g
Out[51]:
In [52]: (1/cos(x)).series(x, 0, 10) #after cache reset
Out[52]:
In [53]: (1/cos(x)).series(x, 0, 20) # without breqn
Out[53]:
In [54]: %sympyprt breqn on
In [55]: (1/cos(x)).series(x, 0, 21) # with breqn on
Out[55]:
In [56]: