MathGroup Archive 2001

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

Search the Archive

Re: Map

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29715] Re: Map
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 4 Jul 2001 03:08:41 -0400 (EDT)
  • References: <9hs1bt$bsd$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Benedetto,

You need the full form Map[f, expr, level specification].

a={{1,5,10},{25,0,2000},{55,5,2001}

Map[If[#<10,(StringJoin[ToString[0],ToString[#]]),#]&,a,{2}]

{{01,05,10},{25,00,2000},{55,05,2001}}

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

<bbongiorno at attglobal.net> wrote in message
news:9hs1bt$bsd$1 at smc.vnet.net...
> I have not been successful in converting the following If Do routine,
> to a routine using the If Map function.
>
> Matrix
> a={{1,5,10},{25,0,2000},{55,5,2001}}
>
> If Do Routine that works
> y=0;
> Do[y=y+1;x=0;
>   Do[x=x+1;
>    a[[x,y]]=
>
If[a[[x,y]]<10,(StringJoin[ToString[0],ToString[a[[x,y]]]]),a[[x,y]]],
>    {Length[a]}],
>   {Length[Transpose[a]]}]
>
> If Map Routine that does not work
>
> If[# < 10, (StringJoin[ToString[0], ToString[#]]), # ] & /@ a
>
> Please help.
> Thanks,
>
> Benedetto Bongiorno
>
>




  • Prev by Date: RE: a problem with differentiation
  • Next by Date: Re: Problem with Inequalities
  • Previous by thread: Re: Map
  • Next by thread: Re:Map