Greetings, everyone.
I am trying to use sympy calculate a perturbation problem, which looks like:
In sympy, I think it's safe to use code like:(all elements are Matrices.)
i=Symbol("i",integer=True)
summation( (u.H*Hamil*p.col(i))*(p.col(i).H*Hamil*u) , (i,0,5))
However, it gives the error:
IndexError: Invalid index a[i]
I have calculated manually the sum, which gives the right result. SO, I guess there is some misunderstanding about summation().
Any advises about solving this would be appreciated.
Thanks.