       Re: Questions on Apply function

• To: mathgroup at smc.vnet.net
• Subject: [mg62908] Re: Questions on Apply function
• From: "dkr" <dkrjeg at adelphia.net>
• Date: Thu, 8 Dec 2005 00:05:08 -0500 (EST)
• References: <dn5ogd\$nks\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Out and Out are consistent. In the second argument of In, you
are adding b to b1, while in In you are adding b to a1.  The problem
seems to be that your pure function is a function of one variable, but
you are evaluating it with 2 arguments, which means the second argument
will be ignored.  After evaluating Apply, In becomes

{#+{-6750,6435}&[6945,-4545],#+{-6750,6435}&[6945, -4545]}.

Now look at the second argument of the outermost list:  # will assume
the value 6945, the value -4545 will be ignored, and you end up with
the result 6945+{-6750,6435}.  Thus Mathematica will add 6945 to each
number in the list, yielding {195,13380}.

Your comment regarding In suggests that what you really want to do
is:

In:=
Apply[({#1,#2}+{a,b})&,{{a1,b1},{a2,b2},{a3,b3}},{1}]

Out=
{{a+a1,b+b1},{a+a2,b+b2},{a+a3,b+b3}}

```

• Prev by Date: General--tracing the solver
• Next by Date: Re: Questions on Apply function
• Previous by thread: Re: Questions on Apply function
• Next by thread: Re: Questions on Apply function