Mysterious Apply troubles (a bug?)
- To: mathgroup at smc.vnet.net
- Subject: [mg113661] Mysterious Apply troubles (a bug?)
- From: Sam Takoy <sam.takoy at yahoo.com>
- Date: Sat, 6 Nov 2010 05:01:25 -0500 (EST)
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