Skip to content

Instantly share code, notes, and snippets.

@mgnisia
Created June 4, 2019 09:21
Show Gist options
  • Save mgnisia/f1d1285dcc4d8611afde645243c692a9 to your computer and use it in GitHub Desktop.
Save mgnisia/f1d1285dcc4d8611afde645243c692a9 to your computer and use it in GitHub Desktop.
Sympy Sum Expansion Example
from sympy import *
init_printing()
i, j = symbols('i j', cls=Idx)
b = IndexedBase('b')
c = IndexedBase('c')
alpha = IndexedBase('alpha')
Sum(b[i]*alpha[i,j]*c[j], (i, 1, 3), (j, 1,3)).doit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment