Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Using Table and ignoring all errors and warnings?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125705] Re: Using Table and ignoring all errors and warnings?
  • From: Murta <rodrigomurtax at gmail.com>
  • Date: Thu, 29 Mar 2012 03:03:05 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jkunci$aqk$1@smc.vnet.net>

On Mar 28, 6:58 am, Mike Sheppard <mikesheppar... at gmail.com> wrote:
> I would like to use Table function, but have it ignore any errors or warnings and skip that value if one is produced.
>
> Illustrative Example:
>
> Table[1/i, {i, -3, 2}]
> Power::infy: Infinite expression 1/0 encountered. >>
> {-(1/3), -(1/2), -1, ComplexInfinity, 1, 1/2}
>
> I would like the output to just be
>
> {-(1/3), -(1/2), -1, 1, 1/2}
>
> with no errors/warnings given as messages and the index that would produce a message to just be ignored. It's not just specific to 1/0 error, but any type of error or warning I want it to ignore it and skip to the next value; with the final output being a list of valid answers according to expr.
>
> Is there a way to do that? Thanks!

Hi Mike
There is one sugestion:

Table[1/i, {i, -3, 2}] // Quiet // DeleteCases[#, ComplexInfinity] &

Quiet removes the error msg
DeleteCases remove the unwanted complex

Best Regards
Murta



  • Prev by Date: Re: Using Table and ignoring all errors and warnings?
  • Next by Date: Re: Manipulate[Plot[Evaluate[expr]]]
  • Previous by thread: Re: Using Table and ignoring all errors and warnings?
  • Next by thread: Re: Using Table and ignoring all errors and warnings?