MathGroup Archive 2012

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

Search the Archive

Triggering on exception conditions


Assume I have a statement like
Table[ {Mod[k, h], PowerMod[k, -1, h]}, {k, 1, h - 1}] 
How can I select the elements in the table which fullfill the condition 
PowerMod::ninv: 2 is not invertible modulo xxx

I would like a statement with a form like
If[PowerMod[2, -1, h] == ninv, 1, 0]
but this does not work.

More general how to catch exceptions in calculation for each type of exception condition, eg in this case PowerMod::ninv 



  • Prev by Date: Re: Using a huge list of random numbers from random.org
  • Next by Date: color function
  • Previous by thread: Re: Using a huge list of random numbers from random.org
  • Next by thread: Re: Triggering on exception conditions