MathGroup Archive 2001

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

Search the Archive

Re: Searching for embedded zeros in list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32143] Re: Searching for embedded zeros in list
  • From: "Steve Gray" <stevebg at adelphia.net>
  • Date: Sat, 29 Dec 2001 03:57:33 -0500 (EST)
  • References: <a0jlsc$31m$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Coleman, Mark" <mark.coleman at dri-wefa.com> wrote in message
news:a0jlsc$31m$1 at smc.vnet.net...
> Greetings,
>
> Can anyone suggest an efficient/elegant way of checking a list for
> 'embedded' zeros. By embedded I mean the occurence of one or more zeros
> between two non-zero elements (note: zeros at the ends of the list are
> not relevant). For instance, the following lists all contain embedded
> zeros:
>
>    a={0.98,0.87,0.0,0.5,0.25}
>    b={0.9,0.0,0.0,0.0,0.0,0.0,0.05}
>    c={0.75,0.42,0.10,0.0,0.03}
>
> while this list does not d={0.0,0.90,0.75,0.42,0.25,0.0}
>
    I was going to suggest using the built-in function Position[yourlist,0]
but that probably makes the solution a little harder and slower. But
my suggestion is still valuable because it tells you one of the things
NOT to try. :) Besides you probably thought of it right away.



  • Prev by Date: Re: Front end problems!
  • Next by Date: Re: Solve[] for equations?
  • Previous by thread: Searching for embedded zeros in list
  • Next by thread: Re: Searching for embedded zeros in list