sympy/sympy — pull request #7915 by kaushik94 (2014-08-25 06:49:22+00:00)
Title: Element wise

Hi I have been a little busy all the while. I have just compleated the code for Element wise matrix functions. The PR I have submitted earlier was very confusing and was unable to rebase it, so I am writing a new one.

>>> from sympy import MatrixSymbol, Lambda, Symbol, symbols, cos, ElemWise
>>> A = MatrixSymbol('X', 3, 3)
>>> B = MatrixSymbol('Y', 3, 4)
>>> x = symbols('x')
>>> z = Symbol('z', real=True)
>>> f = Lambda(x, z*x)
>>> g = Lambda(x, cos(z*x)**2)
>>> L = ElemWise(ElemWise(A*B, f), f).evaluate()
>>> O = ElemWise(ElemWise(A, g), f).evaluate()
>>> T = ElemWise(ElemWise(A, f), g).evaluate()
>>> L[1, 1]
z**2*(X[1, 0]*Y[0, 1] + X[1, 1]*Y[1, 1] + X[1, 2]*Y[2, 1])
>>> O
ElemWise(X, z*cos(x*z)**2)
>>> T
ElemWise(X, cos(x*z**2)**2)