Re: Plus sets in mathematica..?
- To: mathgroup at smc.vnet.net
- Subject: [mg75955] Re: [mg75927] Plus sets in mathematica..?
- From: "Adriano Pascoletti" <adriano.pascoletti at dimi.uniud.it>
- Date: Mon, 14 May 2007 03:32:43 -0400 (EDT)
- References: <200705130954.FAA04136@smc.vnet.net>
There are several solutions...
In[1]:=A = {1, 2, 3}; B = {40, 50, 60, 70};
Join @@ (#1 + A & ) /@ B
Out[1]={41, 42, 43, 51, 52, 53, 61, 62, 63, 71, 72, 73}
In[2]:=Join @@ Outer[Plus, B, A]
Out[2]={41, 42, 43, 51, 52, 53, 61, 62, 63, 71, 72, 73}
In[3]:=Flatten[Outer[Plus, B, A]]
Out[3]={41, 42, 43, 51, 52, 53, 61, 62, 63, 71, 72, 73}
Adriano Pascoletti
On 5/13/07, changbo <e-changbo at hanmail.net> wrote:
>
> I want to make a function "f", its domain is every thinkable two sets, and
> the result is {a+b | a=E2=88=88A,b=E2=88=88B} for A,B.
>
> ex) A={1,2,3}, B={40,50,60,70},
> then I have f[A,B] as
> {41,42,43,51,52,53,61,62,63,71,72,73}.
>
> How can I construct function "f"? Let me know the source.. Thank you very
> much
>
>
- References:
- Plus sets in mathematica..?
- From: changbo <e-changbo@hanmail.net>
- Plus sets in mathematica..?