Re: Mysterious Apply troubles (a bug?)

• To: mathgroup at smc.vnet.net
• Subject: [mg113684] Re: Mysterious Apply troubles (a bug?)
• From: Leonid Shifrin <lshifr at gmail.com>
• Date: Sun, 7 Nov 2010 05:13:20 -0500 (EST)

```Hi Sam,

Since you do not provide ddSA and ddSa functions, it is hard to say exactly
what is
wrong. The error you quote happens when you have supplied to a pure function
less
arguments than it expects (the number of slots used). In your case, you used
two
slots #1 and #2, but apparently supplied a single argument.

Regards,
Leonid

On Sat, Nov 6, 2010 at 1:01 PM, Sam Takoy <sam.takoy at yahoo.com> wrote:

> Hi,
>
> I can't seem to produce a working self-contained example, so I'll keep
> chipping away at it, until someone spots what's wrong. I keep getting
> different behaviors depending on whether I use := or = and here's
> another manifestation. I have
>
> TP[tensors__] := Outer[Times, tensors]
> sTP[tensors__][t_, a_] :=
>  Apply[TP, Sequence[ Map[Apply[#, {t, a}] &, {tensors}]]]
>
> The idea of sTP is that if b, c, d, e are tensor functions of (t, a), I
> can say
>
> sTP[b, c, d, e][t, a] instead of TP[b[t, a], c[t, a], d[t, a], e[t, a]]
>
> Later, I have the following code (not self-contained, since I'm not
> explaining ddSa and ddSA except that sTP is called within them):
>
> f[t_, a_] := t Cos[a]
> SurfaceLaplacian[tensor_][t_, a_] := ddSA[ddSa[tensor]][t, a];
> lapF[t_, a_] := SurfaceLaplacian[f][t, a]
> Derivative[1, 0][lapF][t, a]
>
> And I get the following error:
>
> Function::slotn: Slot number 2 in #1@@{#1,#2}& cannot be filled from
> (#1@@{#1,#2}&)[SAB].
>
> I gather that #1@@{#1,#2}&  refers to Apply[#, {t, a}]& and doesn't it
> appear that # got mixed with "t" since they are both referred to as #1.
>
> Finally, I can mention that if I use
>    SurfaceLaplacian[tensor_][t_, a_] = ddSA[ddSa[tensor]][t, a]
> that is "=" in place of ":=", the error goes away.
>
> What's going on here?
>
> Many thanks in advance,
>
> Sam
>
>

```

• Prev by Date: Re: FFT in mathematica
• Next by Date: Re: Re: MathLink and c++ compiler
• Previous by thread: Mysterious Apply troubles (a bug?)
• Next by thread: Re: How does one fix a Graphics3D display? (Solved)