MathGroup Archive 2011

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

Search the Archive

Re: Unwanted Recursion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120138] Re: Unwanted Recursion
  • From: Simon <simonjtyler at gmail.com>
  • Date: Sat, 9 Jul 2011 07:33:42 -0400 (EDT)
  • Reply-to: comp.soft-sys.math.mathematica at googlegroups.com

Yeah, but NonCommutativeMultiply[a] and NonCommutativeMultiply[] do not simplify like you want them to. I'm not sure how Plus and Times do it... they might use a slightly nonstandard evaluation order - maybe you could customize the evaluation of your p expressions.

The only (simple) automated solution I can think of at the moment is to use
$Post = (# /. {p[a_] :> a, p[] -> 1} &); (* order is important *)

When I implemented some fermionic algebra (arXiv:1102.3043), I actually included these types of rules in my NonCommutativeMultiply sorting algorithm. It's not perfect (like a lot of my code), but since I always needed to canonicalize my expressions and this could be considered part of the canonicalization procedure, it seemed like an acceptable compromise.


  • Prev by Date: Re: Bug 1+4/10
  • Next by Date: Calculating General Tensor Product of Gradients
  • Previous by thread: Re: Unwanted Recursion
  • Next by thread: Symbolic replacement of scalar products