On 7/8/10 12:26 PM, David Sanders wrote:
Hi,

How can I manipulate objects with indices?
I need to do things like

a_i + b_i * c_{j+1}

using a TeX style notation (so that in the last term, the index is j
+1)

where i and j are symbolic.

In Mathematica this would be something like
a[i] + b[i] * c[j+1]

but something like that presumably cannot work in Sage, since [] are
reserved for other things!



Here's one way to get such expressions:

sage: a=function('a')
sage: b=function('b')
sage: c=function('c')
sage: var('j')
j
sage: a(j)*b(j)*c(j+1)
a(j)*b(j)*c(j + 1)



I then need to be able to manipulate such expressions to act on them
with functions according to the values of different indices in each
term: if there is a product a_i b_i with two equal indices then I need
to apply a different rule than if the indices are different( a_i b_j
with  j not equal to i ).

Could somebody please tell me what syntax I need (if indeed this is
possible...)?


How would you manipulate such expressions in Mathematica according to the rules you give above?


Thanks,

Jason


--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to