Second quantization substitution

58 views
Skip to first unread message

Matt Chan

unread,
Aug 28, 2015, 2:22:51 PM8/28/15
to sympy
Hi Sympy-users,

I'm trying to figure out if it's possible to evaluate an expression from the quantum physics module. I'm fairly new at Sympy but I have some python experience. I thought I would ask before I dived into the source code.

Say for example I have something like the code in examples/intermediate/coupled_cluster.py. It derives the energy and amplitude equations in second quantization, but it needs to be solved.

The energy equation after cleanup is here: 

E = AntiSymmetricTensor(f, (_k,), (_c,))*AntiSymmetricTensor(t, (_c,), (_k,)) + AntiSymmetricTensor(t, (_c,), (_l,))*AntiSymmetricTensor(t, (_d,), (_k,))*AntiSymmetricTensor(v, (_k, _l), (_d, _c))/2

Can I provide some values for AntiSymmetricTensor(t, (_c,), (_k,)) to be substituted with evalf or lambdify? 

Thanks in advance for your help!
Matt

Francesco Bonazzi

unread,
Aug 28, 2015, 6:57:12 PM8/28/15
to sympy
Hi!

I believe the sympy quantum code is currently not maintained, as the original authors don't have time for the project anymore.

Francesco Bonazzi

unread,
Aug 29, 2015, 5:24:07 AM8/29/15
to sympy
By the way, by providing values do you mean data components?

If so, have you tried to substitute the expression with matrices?

Matt Chan

unread,
Aug 29, 2015, 9:07:50 AM8/29/15
to sympy
Ahh. Thanks for letting me know about the author.

I haven't tried matrices. It shouldn't be enough though. It's fairly common to have high rank tensors in these equations too. Something like the numpy arrays are necessary I think.

I'll start digging through the source tonight.

Francesco Bonazzi

unread,
Aug 29, 2015, 6:44:45 PM8/29/15
to sympy
Have a look at this if it may be helpful:
http://docs.sympy.org/latest/modules/tensor/tensor.html#sympy.tensor.tensor.TensorHead

Unfortunately that module needs some rewriting (possibly API changes), but it is already able to manage polynomial tensor expressions.

Francesco Bonazzi

unread,
Aug 29, 2015, 6:47:16 PM8/29/15
to sympy


On Sunday, 30 August 2015 00:44:45 UTC+2, Francesco Bonazzi wrote:

P.S. it uses numpy ndarrays.

Furtheremore, there is a pending PR on github to introduce nD-arrays to sympy:
https://github.com/sympy/sympy/pull/9112
Reply all
Reply to author
Forward
0 new messages