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.

  • 3
    $\begingroup$ Why not w@1 ... w@n ? $\endgroup$ Jan 2, 2013 at 18:36
  • $\begingroup$ The answer by helen to Differential geometry add-ons for Mathematica describes how Atlas 2 can handle this - but that's a commercial product and I can understand if you want to build your own version. However, maybe you can find some useful ideas in that link. $\endgroup$
    – Jens
    Jan 2, 2013 at 18:37
  • $\begingroup$ @belisarius Thanks a lot, this works fine. $\endgroup$
    – kriokamera
    Jan 2, 2013 at 18:46
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!. And please,change your userid to something easier to remember! $\endgroup$ Jan 2, 2013 at 18:56

1 Answer 1


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).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.