       Re: inert wrapping function

• To: mathgroup at smc.vnet.net
• Subject: [mg5647] [mg5629] Re: inert wrapping function
• From: daiyanh at mindspring.com (Daitaro Hagihara)
• Date: Sat, 4 Jan 1997 22:56:38 -0500
• Organization: MindSpring Enterprises
• Sender: owner-wri-mathgroup at wolfram.com

```Hello,

This fa[] looks like a good ole functional in the functional analysis.
Went thru the examples, and me too experienced infinite recursions in
your defs.  Looks like fa[] gets eval'ed everytime it's encountered as
the given pattern.  That pattern is in the def itself.  "Hold"'ing prevents
this.  I found some workaround as follows:

fa[arg_Plus]:=fa/@arg;
fa[arg_Times]:=fa/@arg;
fa[fa[arg_]]:=fa[arg];

With the init
fa[a]=a;fa[b]=b;fa[c]=c;
I get

fa[a fa[A] + b fa[B] + c fa[C] ] ==>> a fa[A] + b fa[B] + c fa[C]

and

fa[a fa[A] + b fa[
fa[ a fa[A] + b fa[B] + c fa[C] ]
]] ==>> a fa[A] + b (a fa[A] + b fa[B] + c fa[C])

One last def is needed for the last example:

fa[Power[x_,y_]]:=fa[x]^y;

fa[d]=d;fa[e]=e;fa[f]=f;fa[g]=g;fa[h]=h;fa[i]=i;fa[j]=j;fa[k]=k;fa[l]=l;

Then I get the answer to your example (allow me to cut out the whole
middle stuff):

\$?#%&@* =
a fa[fA]                b fa[fB]
{4.38333 Second, --------------------- + --------------------- +
a + b + c + d + e + f   a + b + c + d + e + f

d fa[fD]                e fa[fE]                f fa[fF]
--------------------- + --------------------- + --------------------- +
a + b + c + d + e + f   a + b + c + d + e + f   a + b + c + d + e + f

g fa[fG]                h fa[fH]
(c (--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

i fa[fI]                k fa[fK]
--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

l fa[fL]
--------------------- +
g + h + i + j + k + l

g fa[fG]                h fa[fH]
(j (--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

i fa[fI]                k fa[fK]
--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

l fa[fL]
--------------------- +
g + h + i + j + k + l

g fa[fG]                h fa[fH]
(j (--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

i fa[fI]                k fa[fK]
--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

l fa[fL]
--------------------- +
g + h + i + j + k + l

g fa[fG]                h fa[fH]
(j (--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

i fa[fI]                j fa[fJ]
--------------------- + --------------------- +
g + h + i + j + k + l   g + h + i + j + k + l

k fa[fK]                l fa[fL]
--------------------- + ---------------------)) /
g + h + i + j + k + l   g + h + i + j + k + l

(g + h + i + j + k + l))) / (g + h + i + j + k + l))) /

(g + h + i + j + k + l))) / (a + b + c + d + e + f)}

?

Note that _fa head collecting didn't work.  The above representation
happens to be more compact than the fully collected one.  Also pls
don't pay any att'n to the timing: my Mac is slow.

In the end, I believe that the explicit def's are needed for dealing
with the  coefficients.  If they are numbers, then one statement def

fa[arg_]:=arg /; NumberQ[arg]

will do.

Daitaro Hagihara

```

• Prev by Date: Re: batch mode mathematica
• Next by Date: Re: batch mode mathematica
• Previous by thread: Re: inert wrapping function
• Next by thread: Re: inert wrapping function