5

I work with an exterior algebra over $R^n$. I have the basis $\{1,\omega_i\}_{i=1}^n$ in this algebra, and my differential operator is defined as

$$d\omega_k=\sum_{i>j>0,i+j=k} (i-j)w_i\wedge w_j.$$

As you see, my sum depends directly on the indexes of the elements of the basis. I surely can define the wedge and the differential operator in Mathematica, and they will calculate the derivative for any polynome I want. My problem is to find a good way to describe the elements of the basis, which will permit me use these formulas easily. It can not be just the integers $1, .. n$ for every element $\omega_1, .. \omega_n$, because Mathematica will multiply them as normal numbers, not treating them as elements of the exterior algebra; it cannot be just symbols such as w1, w2, ... because I cannot easily extract the numbers from them to calculate the derivatives (or I just don't know how).

I tried to represent them with {1}, {2}, and so on. I also used noncommutative multiplication with additional relations as the exterior multiplication. Example of what my notebook can calculate:

In[30]:= d[{5} ** {4}]
Out[30]= {4} ** {3} ** {2} + 2 {5} ** {3} ** {1}

That's nice. I defined multiplication and differentiation without problems, except for one small thing -- multiplying by a scalar. For example, consider the expression $2\omega_4+\omega_5$. In this notation it appears as 2 {4} + {5}. Mathematica proceeds to {8} + {5} and then to {13}, which is completely wrong.

In[31]:= 2 {4} + {5}
Out[31]= {13}  

This only happens when working with dimension 1. For higher grades everything's fine because Mathematica's multiplication doesn't misbehave when working with non-commutative elements:

In[32]:= 2 {4} ** {3} + 6 {5} ** {2}
Out[32]= 2 {4} ** {3} + 6 {5} ** {2}

In[33]:= (2 {4} ** {3} + 6 {5} ** {2}) ** {3}
Out[33]= -6 {5} ** {3} ** {2}  

But this is still not what I want -- lower dimensions are important to me, so my question is: how do I represent the basis elements without these problems? I can try to partially clear Times, but I don't think this is best way, as the multiplication of lists may be vital later in the code.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
kriokamera
  • 53
  • 4

1 Answers1

5

Just do

lst = w /@ Range[10]
(*{w[1], w[2], w[3], w[4], w[5], w[6], w[7], w[8], w[9], w[10]}*)

You can extract indices like this

lst /. w[n_] :> n
(*{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}*)

(this works on each element, so eg w[3] /. w[n_] :> n evaluates to 3 and so on).

acl
  • 19,834
  • 3
  • 66
  • 91