MathGroup Archive 2005

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

Search the Archive

Re: Q: Thread behaviour

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57958] Re: [mg57933] Q: Thread behaviour
  • From: "David Park" <djmp at earthlink.net>
  • Date: Tue, 14 Jun 2005 05:10:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dick,

It's because the k function evaluates and you are left with nothing to
Thread.

Thread[k[a + b, c d], Plus] // Trace
{{HoldForm[k[a + b, c*d]], HoldForm[
    (a + b)^2 + (c*d)^2], {HoldForm[(c*d)^2],
    HoldForm[c^2*d^2]}, HoldForm[
    (a + b)^2 + c^2*d^2]},
  HoldForm[Thread[(a + b)^2 + c^2*d^2, Plus]],
  HoldForm[(a + b)^2 + c^2*d^2]}

So try...

Thread[Unevaluated[k[a + b, c d]], Plus]
a^2 + b^2 + 2*c^2*d^2

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



From: Dick Barends [mailto:dick.barends at wxs.nl]
To: mathgroup at smc.vnet.net


Hallo,

k[x_,y_] = x^2+y^2
Thread[k[a+b,c d],Plus]
gives: (a+b)^2+c^2 d^2
I would expect: a^2 + (c d)^2 + b^2 + (c d)^2 (See below)

-----------------
When I use:
Thread[m[a+b, c d],Plus]
gives: m[a, c d] + m[b, c d]
This is what should happen.

What gives "m" a different solution than "k"????

I hoop some of you will answer:-)

greetings
Dick



  • Prev by Date: Re: Q: Thread behaviour
  • Next by Date: Re: Help with the User Interface in Mathematica 5.1.1
  • Previous by thread: Re: Q: Thread behaviour
  • Next by thread: where's DrBob's web site now?