MathGroup Archive 2005

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

Search the Archive

Imposing a value for LeafCount

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61187] Imposing a value for LeafCount
  • From: kalymereau at yahoo.fr
  • Date: Wed, 12 Oct 2005 01:42:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear MathGroup

I have a complicated expression in which appears a symbol of the form
f[i] where i is an integer (i.e. f[1], f[2] ... are  found in the full
expression).

When I LeafCount the full expression I want that each f[i] is
considered as a single symbol with LeafCount=1. So I have defined

LeafCount[f[i_Integer]] ^:= 1

Then of course LeafCount[f[1]]=1 as I want, but LeafCount[2+f[1]] is 4
instead of 3 (e.g. LeafCount[2+a]=3). This is because LeafCount[2+f[1]]
is not of the form LeafCount[f[i_Integer]], so that the above
definition does not apply.

How can I force LeafCount to consider that each f[i] has a LeafCount=1
even in subexpressions ?

Thanks


  • Prev by Date: Change plot symbol in graphics 3D
  • Next by Date: Re: sqrt(x^2) = x
  • Previous by thread: RE: Change plot symbol in graphics 3D
  • Next by thread: Re: Imposing a value for LeafCount