define a new object or use the existing?
- To: mathgroup at smc.vnet.net
- Subject: [mg24360] define a new object or use the existing?
- From: Maris Tõnso <maris at tpu.ee>
- Date: Sun, 9 Jul 2000 04:53:02 -0400 (EDT)
- Organization: Institute of Cybernetics
- Sender: owner-wri-mathgroup at wolfram.com
Hi! I am trying to write a program which could handle noncommutative twisted polynomials. A noncommutative polynomial has a form p(delta) = pn**delta^n + ... + p2**delta^2 + p1**delta + p0, where ** denotes noncommutative multiplication. I can not decide, which is better way to represent an object pi**delta^i : to define additional rules for function NonCommutativeMulitply or to build a special new object on this purpose, for example Twisted[pi,i]. You will probably say that it depends on concrete circumstances or there is no difference in principle; but I still hope you can give some comments on this problem. And the other problem: If I choose to build a new object when I would like object Twisted[p, n] in StandardForm to be printed as p delta^n. One way to get it is to use Format and Postfix: Format[Twisted[p_,n_]] := Postfix[{p}, delta^n ] But this solution does not satisfy me. I would like to know if there exists a elegant way to define the formatting for the object Twisted so that Twisted[p+q, n] would printed as (p+q) delta^n (not p+q delta^n) and Twisted[1, n] would printed as delta^n (not 1 delta^n). Thanks for any advices. Maris Tonso Tallinn, Estonia
- Follow-Ups:
- Re: define a new object or use the existing?
- From: Ken Levasseur <Kenneth_Levasseur@uml.edu>
- Re: define a new object or use the existing?