|
|
 |
| found 7 articles for 0.302 sec |
  |
| Much simpler is:
#1^2 + #2 & @@@ {{0, 1}, {2, 3}, {4, 5}}
{1, 7, 21}
Bobby
On Wed, 06 Jun 2007 06:33:09 -0500, Adriano Pascoletti
<adriano.pascoletti@gmail.com> wrote:
> On Jun 5, 1:39 pm, phoenix7...@gmail.com wrote:
>> I'm trying to get the following code to work:
>>
>> Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}]
>>
>> The goal is to use a pure function in order to achieve the |
|
 |
|
 |
Group: comp.softsys.math.mathematica · Group Profile · Search for Phoenix7 in comp.softsys.math.mathematica
Author: DrMajorBob
Date: Jun 7, 2007 01:17
On Jun 5, 1:39 pm, phoenix7...@gmail.com wrote: I'm trying to get the following code to work: Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}] The goal is to use a pure function in order to achieve the result: {1, 7, 21} The issue is that the evaluation involves #1^2 + #2 & [{0,1}] instead of #1^2 + #2 & [0,1] Thanks, in advance. You must access the first and the second
|
| Show full article (0.79Kb) · Show article thread |
| On Jun 5, 4:39 am, phoenix7...@gmail.com wrote:
I did this:
(#[[1]]^2 + #[[2]]) & /@ {{0, 1}, {2, 3}, {4, 5}}
It looks like what you want.
Regards..
> I'm trying to get the following code to work:
>
> Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}]
>
> The goal is to use a pure function in order to achieve the result:
> {1, 7, 21}
>
> The issue is that the evaluation involves #1^2 |
|
 |
|
 |
Group: comp.softsys.math.mathematica · Group Profile · Search for Phoenix7 in comp.softsys.math.mathematica
Author: Adriano Pascoletti
Date: Jun 6, 2007 05:24
On 5 Cze, 13:39, phoenix7...@gmail.com wrote: I'm trying to get the following code to work: Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}] The goal is to use a pure function in order to achieve the result: {1, 7, 21} The issue is that the evaluation involves #1^2 + #2 & [{0,1}] instead of #1^2 + #2 & [0,1] Thanks, in advance. MapThread[#1^2 + #2 &, {{0, 1}, {2, 3}
|
| Show full article (0.54Kb) · Show article thread |
|
| So, in effect you are wanting a functoin of one variable that you
take Parts of. This should do the trick:
> Map[#[[1]]^2 + #[[2]] &, {{0, 1}, {2, 3}, {4, 5}}]
--David
http://scientificarts.com/worklife
Now Mathematica 6 compatible....
On Jun 5, 7:39 am, phoenix7...@gmail.com wrote:
> I'm trying to get the following code to work:
>
> Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}]
|
|
 |
|
 |
Group: comp.softsys.math.mathematica · Group Profile · Search for Phoenix7 in comp.softsys.math.mathematica
Author: dbsearch04
Date: Jun 6, 2007 04:54
Trying one of the followings... In[209]:= o = {{0, 1}, {2, 3}, {4, 5}} Apply[Plus[#1^2 + #2] & , o, {1}] (Plus[#1[[1]]^2 + #1[[2]]] & ) /@ o o /. {(x_)?NumberQ, (y_)?NumberQ} -> x^2 + y MapThread[#1^2 + #2 & , Transpose[o]] Out[209]= {{0, 1}, {2, 3}, {4, 5}} Out[210]= {1, 7, 21} Out[211]= {1, 7, 21} Out[212]= {1, 7, 21} Out[213]= {1, 7, 21} Dimitris phoenix7...@gmail
|
| Show full article (0.47Kb) · Show article thread |
| On Jun 5, 7:39 pm, phoenix7...@gmail.com wrote:
> I'm trying to get the following code to work:
>
> Map[#1^2 + #2 &, {{0, 1}, {2, 3}, {4, 5}}]
>
> The goal is to use a pure function in order to achieve the result:
> {1, 7, 21}
>
> The issue is that the evaluation involves #1^2 + #2 & [{0,1}]
> instead of #1^2 + #2 & [0,1]
>
> Thanks, in advance.
Use the following instead.
Apply |
|
 |
|
 |
Group: comp.softsys.math.mathematica · Group Profile · Search for Phoenix7 in comp.softsys.math.mathematica
Author: Arkadiusz.Majka
Date: Jun 6, 2007 04:16
|
| Show full article (0.41Kb) · Show article thread |
|
 |
|
|