Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: IsExact

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80617] Re: IsExact
  • From: carlos at colorado.edu
  • Date: Sun, 26 Aug 2007 23:19:50 -0400 (EDT)
  • References: <far9j8$477$1@smc.vnet.net>

Thanks to all who replied.  Several of you gave the solution

     IsExact[expr_] := Precision[expr]===Infinity

By analogy

     Isinexact[expr_] := Precision[expr]=!=Infinity

IsExact[c6] returns True for the dubious case {N[x]} but that
seems to be OK if x is undefined.  In any case both work
fine for the intended purpose, which is checking module
arguments.  Some modules of a G&C research program
only work properly for exact inputs.  For example:

HurwitzPolynomialList[a_,r_,norm_]:=Module[{PA,PH,b,k,rep,
    n=Length[a],s,z,i,j,modname="HurwitzPolynomialList"},
    If [n<=0, Return[{}]]; rep=z->r*(s+1)/(s-1);
    If [IsInexact[a]||IsInexact[r], Print[modname,
        " error: float input"]; Return[Null]];
    k=FindLastNonzero[a]; If [k==0, Return[{0}]];
    PA=a[[1]]+Sum[a[[i+1]]*z^i,{i,1,k-1}];
    PH=Simplify[Expand[(s-1)^(k-1)*(PA/.rep)]];
    b=CoefficientList[PH,s];
    If [norm, j=FindLastNonzero[b]; If [j>0,b=b/b[[j]] ]];
    Return[b]];



  • Prev by Date: Re: Improper Integral & Mathematica
  • Next by Date: Re: problem with parsing InputForm scientific notation (eg. 3.`*^-7)
  • Previous by thread: Re: IsExact
  • Next by thread: Re: 6.0 Get Graphics Coordinates...