Øyvind,

Here is the logic in sympy.physics.quantum that handles the
representation of abstract entities in concrete bases:

https://github.com/sympy/sympy/blob/master/sympy/physics/quantum/represent.py

I think the code the pretty general, although for now we do assume
that the representations are regular matrices (not tensors).  But I
think it could be generalized quite easily (the idea is super simple).

Cheers,

Brian

On Thu, Mar 17, 2011 at 12:01 PM, Øyvind Jensen <jensen.oyv...@gmail.com> wrote:
> to., 17.03.2011 kl. 10.35 -0700, skrev Brian Granger:
>> On Thu, Mar 17, 2011 at 1:34 AM, Øyvind Jensen <jensen.oyv...@gmail.com> 
>> wrote:
>> > ma., 14.03.2011 kl. 11.00 -0700, skrev Ondrej Certik:
>> >> On Mon, Mar 14, 2011 at 3:11 AM, Øyvind Jensen <jensen.oyv...@gmail.com> 
>> >> wrote:
>> >> > Alexander, All,
>> >> >
>> >> > How is it going with your tensor implementation?  I put together some
>> >> > code to implement variance of tensors and uploaded it to github in my
>> >> > tensor_contractions branch [0].  If you would like to build on that,
>> >> > feel free to do so.  If you have already made your own implementation,
>> >> > please just choose whatever works best for your framework.
>> >> >
>> >> > Here is how it works in the advertised branch:
>> >> >
>> >> >    >>> A = IndexedBase('A')
>> >> >    >>> i = VarIdx('i')
>> >> >    >>> A[i.up, i.down]
>> >> >    A[^i, _i]
>> >> >    >>> get_indices(A[i.up, i.down])
>> >> >    (set(), {})
>> >> >    >>> get_indices(A[i.up, j.down]*x[j.up])
>> >> >    (set([^i]), {})
>> >>
>> >> This is great! Once either of these implementations is in sympy, I'll
>> >> update the relativity example to use it.
>> >
>> > That would be very cool!  What would be a good way to connect the
>> > abstract tensor objects to its concrete representations?  Perhaps
>> > something like sympy.utilities.implemented_function could work?
>>
>> Can you say more about what you are thinking.  In the quantum stuff we
>> now have the notion of abstract objects and then concrete
>> representations (in a particular basis).  Would this type of thing
>> cary over here?
>
> Perhaps it can be applied here, I am not sure.  The current abstract
> tensor objects in my branch are nothing but symbols with other symbols
> attached to them as indices.  Otoh, it seems like the relativity example
> calculates the "content" of different tensors, much like the elements of
> a matrix or a vector.  I think that this corresponds to the
> representation in a particular basis, but I don't know exactly how.
>
> Anyway, I think it could be useful to be able to mix the perspectives,
> so that an expression can be manipulated in the abstract formulation
> before it is converted to a concrete expression based on the "content".
> Something like
>
>    >>> def concretization_handler(inds):
>        # return an expression determined from the indices
>    >>> g = IndexedBase('g', content=concretization_handler)
>    >>> g(i.up, j.down).subs({i:0, j:1})
>    # Here we should get the concrete representation of g^0_1.
>
> I am not sure how this would work, and I am also not sure yet how useful
> it would be...  How did you implement, and how do you use the abstract
> and concrete representations in the quantum module?
>
> Øyvind
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to sympy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sympy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
>
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgran...@calpoly.edu
elliso...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to