Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Why not w@1 ... w@n ? – Dr. belisarius Jan 2 '13 at 18:36
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. – Jens Jan 2 '13 at 18:37
@belisarius Thanks a lot, this works fine. – kriokamera Jan 2 '13 at 18:46
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! – Dr. belisarius Jan 2 '13 at 18:56
up vote 5 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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