Skip to content

Instantly share code, notes, and snippets.

@limingzju
Created January 26, 2016 08:19
Show Gist options
  • Save limingzju/7f4237a352203d1d24a8 to your computer and use it in GitHub Desktop.
Save limingzju/7f4237a352203d1d24a8 to your computer and use it in GitHub Desktop.
from sympy import *
n, y, u = symbols('n y u')
M = Matrix([[-1*n*y, n*y], [u, -u-(n-1)*y]])
Mt = M.transpose()
X=Matrix([[1,1]])
Y=Matrix([1,0])
m = -X.multiply(Mt.inv()).multiply(Y)
r = m[0]
print r
print r.simplify()
print r.together().simplify()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment