MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Algebra in Mathematica

  • To: mathgroup at
  • Subject: [mg56033] Re: Algebra in Mathematica
  • From: dh <dh at>
  • Date: Thu, 14 Apr 2005 08:54:25 -0400 (EDT)
  • References: <d3ibcu$9qt$>
  • Sender: owner-wri-mathgroup at

Hi Jamie,

First specify your operators and pick a symbol for it. Note that in your 
example you have Dot and Plus. Therefore, your algebra has more 
structure than a group (groups have only one operation), maybe you meant 
a ring.

Second define how to implement your elements. As an example lets set up 
an algebra that has the structure of the Integers mod 3. We define our 
elements e.g. by the Head: MyNumber and we have three elements:
MyNumber[0], MyNumber[1],MyNumber[2]
we could have taken any name, but by using integers hidden inside we 
make the implementation of this example rather simple.

Next we must specify the effect of the operators (group table). Because 
you want to use predefined protected symbols, we must first Unprotect them:

Unprotect[Dot, Plus];
Dot[a_MyNum, b_MyNum] := MyNum[Mod[First[a]First[b], 3]];
Plus[a_MyNum, b_MyNum] := MyNum[Mod[First[a] + First[b], 3]];

In general you will have to specify all the qualities like 
e.g.associativity, distributivity etc. of your operators. But because we 
based the inner working of MyNum on Integers mod 3 we get this all for 
free. A further note, it may be more efficient to associate the rules 
not with Dot and Plus, but with MyNum (this is called UpValues). This is 
done by preceding the definition of Dot and Plus by: MyNum/:

We are now ready for calculations with MyNum Dot and Plus. E.g.

a = MyNum[1];
b = MyNum[2];

b.b gives MyNum[0]
a+a gives MyNum[2]
a.a + b.b gives MyNum[2]

Sincerely, Daniel

jamievicary at wrote:
> Dear all,
>     I am trying to implement an algebra in mathematica, but I don't
> want to use a matrix representation for it. So, I've got elements like
> A, B and C, and I want to tell Mathematica, for example, that A.B==-C,
> along with other identities. I then want to put some complicated
> expression in, like A.B.B.C.B-B.C.A+A.B.C.B.A and have Mathematica
> simplify it using the rules of the algebra. What's the best easiest way
> to implement this? The elements of my algebra form a group; are there
> group-theory capabilities in Mathematica that I can use to do what I
> want? What if I change my algebra so that it stops being a group (for
> example, make it nonassociative) --- would this then make things much
> harder?
>             Thanks very much!
>                 Jamie.

  • Prev by Date: Re: Mathlink
  • Next by Date: Re: Infinite sum of gaussians
  • Previous by thread: Re: Algebra in Mathematica
  • Next by thread: Re: Algebra in Mathematica