implementing linear operators
- To: mathgroup at smc.vnet.net
- Subject: [mg33090] implementing linear operators
- From: Christopher Maierle <chris at chaos.Physik.uni-dortmund.de>
- Date: Fri, 1 Mar 2002 06:52:08 -0500 (EST)
- Organization: Universitaet Dortmund
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I figure this question has been covered somewhere but I can't find quite the answer I'm looking for in the archives. Here's my problem: I essentially want to implement an algebra for non-commutative linear operators. I'm pretty sure that the noncommutative algebra package can do what I want but I'd rather not use a large package that I don't understand for what I think is a small problem. So, carrying on... If I define: x[y] = I z x[z] = -I y z[y] = I x then I can calculate x acting on y by writing x @ y If I want to calculate x acting on (y + z) then the above definitions won't work because x[y+z] is not defined. This is easy to fix though if I add the rule x[o1_ + o2_] = x[o1] + x[o2] now x @ (y + z) gives what I want, namely x y + x z My problem is that I can't see how to tell mathematica that acting (x + z) on y should be x y + z y without unprotecting Plus and making the definition (o1_ + o2_)[o3_] = o1[o3]+o2[o3] Associating this definition with Plus makes me nervous but maybe there is no problem here. Is the above a bad thing to do? Is there another solution? (I could of course make the definition a little safer by making a function myopsQ and writing (o1_?myopsQ + o2_?myopsQ)[o3_?myopsQ] = o1[o3]+o2[o3]) Thanks in advance for the help chris maierle