Re: representing the dihedral group {1,r,r^2...s,sr^2...}
- To: mathgroup at smc.vnet.net
- Subject: [mg98861] Re: representing the dihedral group {1,r,r^2...s,sr^2...}
- From: dh <dh at metrohm.com>
- Date: Mon, 20 Apr 2009 19:09:44 -0400 (EDT)
- References: <gsh100$gr$1@smc.vnet.net>
Hi, it calls for troubles changing the rules for built in functions. Instead assigne the rule to your symbols. E.g.: s /: s^2 = 1; s /: s^n_ := s s^(n - 1) /. n > 2; r /: r^4 = 1; r /: r^n_ := r r^(n - 1) /; n > 4; Daniel obott0 at gmail.com wrote: > Hi, I'm trying to represent the dihedral group {1,r,r^2...s,sr^2...} > in mathematica so I can do for example: > > s^3 > > and get s. > > I tried this code: > > Unprotect[Times, Power]; > n = 4; > ClearAll[r, s, Times, Power]; > SetAttributes[Times, {Flat}] > s^2 = 1; > r^n = 1; > Protect[Times, Power]; > > But this doesn't work for, for example, s^3. It is not able to > simplify it. > > Thanks a lot! > > Otto >