MathGroup Archive 2007

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

Search the Archive

Re: fast way of appending x zeros to a list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79158] Re: fast way of appending x zeros to a list?
  • From: sashap <pavlyk at gmail.com>
  • Date: Fri, 20 Jul 2007 03:18:55 -0400 (EDT)
  • References: <f7ke8n$508$1@smc.vnet.net>

Join[ data, Table[0,{numberOfZeros}] ] ?


On Jul 18, 2:08 am, kristoph <kristophs.p... at web.de> wrote:
> Dear all,
>
> I'm looking for a fast way to append 0's to a list. Unfortunately, I
> append a variable number of 0's to a list which is generated by a
> For[...]-loop. Therefore, PadLeft[...] is not variable enough to
> append exactly x zeros to the list.
>
> At the moment I use: Do[PrependTo[data,0],{K}] where the K depends on
> certain factors.
>
> In case you have an idea to append exactly x zeros to the left quickly
> I would be more that happy since I heard that the PrependTo[...] and
> AppendTo[...] functions are very slow.
>
> Thanks a lot.




  • Prev by Date: Mathematica to .NET compiler
  • Next by Date: graphing frequency & amplitude?
  • Previous by thread: Re: fast way of appending x zeros to a list?
  • Next by thread: Coding an inverse permutation