MathGroup Archive 2007

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

Search the Archive

Re: Plus sets in mathematica..?


Hi,

A = {1, 2, 3};
B = {40, 50, 60, 70};

f[a_, b_] := Flatten[a + # & /@ b]

and

f[A, B]
gives

{41, 42, 43, 51, 52, 53, 61, 62, 63, 71, 72, 73}

Regards
   Jens

changbo wrote:
> I want to make a function "f", its domain is every thinkable two sets, and the result is  {a+b | aâ??A,bâ??B} 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
> 


  • Prev by Date: 2D Convolution
  • Next by Date: Re: Plus sets in mathematica..?
  • Previous by thread: Re: Plus sets in mathematica..?
  • Next by thread: Re: Plus sets in mathematica..?