Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3522

Re: Unwanted Recursion

From Kambis Veschgini <k.veschgini@thphys.uni-heidelberg.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Unwanted Recursion
Date 2011-07-07 11:29 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iv45a9$erk$1@smc.vnet.net> (permalink)
References <iv1a95$sjl$1@smc.vnet.net>

Show all headers | View raw


On 2011-07-06 11:35:33 +0200, Casorati said:

> I'm trying to define an anti-commutative algebra in Mathematica.
> Here I will show only a minimal example to demonstrate my point.
> The product of two elements a^b should be give by p[a,b] so I
> make p flat:
> 
> SetAttributes[p, {Flat}]
> 
> But now I want p[a] to reduce to a.
> Such a  rule would make other rules much simpler but when I define
> 
> p[a_] := a
> 
> the expression p[a] causes an infinite recursion. I get the message
> 
> $IterationLimit::itlim: Iteration limit of 4096 exceeded.
> 
> I have similar problems with p[]:=1 which makes mathematica puts
> ones into the p : p[a]=p[a,a]=p[1,1,...,a] .
> 
> How can I solve this problem?

I found out that if SetAttributes is called after the rules are defined 
the recursion does not happen but I don't know why. Can someone explain 
this behavior?

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Unwanted Recursion Casorati <casorati@f-m.fm> - 2011-07-06 09:35 +0000
  Re: Unwanted Recursion Kambis Veschgini <k.veschgini@thphys.uni-heidelberg.de> - 2011-07-07 11:29 +0000
  Re: Unwanted Recursion David Bailey <dave@removedbailey.co.uk> - 2011-07-07 11:39 +0000
    Re: Unwanted Recursion Kambis Veschgini <k.veschgini@thphys.uni-heidelberg.de> - 2011-07-08 09:01 +0000
    Re: Unwanted Recursion David Bailey <dave@removedbailey.co.uk> - 2011-07-08 09:01 +0000

csiph-web