MathGroup Archive 2010

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

Search the Archive

Re: Bug in PadLeft/PadRight

  • To: mathgroup at
  • Subject: [mg109066] Re: Bug in PadLeft/PadRight
  • From: David Bailey <dave at>
  • Date: Mon, 12 Apr 2010 06:54:10 -0400 (EDT)
  • References: <hpkgkn$817$>

dh wrote:
> Hello,
> hope I am not fooling myself, but there seems to be a problem with 
> padding. PadLeft/PadRight seem to work as expected when used alone. 
> However if we use them sequentially there seems to be some unwanted effects.
> Consider:
> npad = 1;
> d = d0 = {x1, x2, x3, x4};
> d = PadLeft[d, npad + Length[d], d0]
> d = PadRight[d, npad + Length[d], d0]
> For npad=1 padding on the right does not start with the first element of 
> d0, but with the second one.
> For npad=2, padding starts with the third element, e.t.c.
> If we eliminate the PadLeft, PadRight works as expected.
> cheers, Daniel
Well, I also get the wrong answer (using a fresh kernel) for:

In[1]:= PadRight[{y4, x1, x2, x3, x4}, 6, {y1, y2, y3, y4}]

Out[1]= {y4, x1, x2, x3, x4, y2}

I guess you should send that to support.

David Bailey

  • Prev by Date: Re: Retrieving orphaned code
  • Next by Date: Re: Change of function in an ODE
  • Previous by thread: Bug in PadLeft/PadRight
  • Next by thread: Re: Bug in PadLeft/PadRight