MathGroup Archive 2011

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

Search the Archive

Replace & Rationalize


Further to a question on Stack Overflow I noticed a puzzling
evaluation.  Why does the second expression generate reals?

(x \[Function] 
   If[IntegerQ[Rationalize[x]], Rationalize[x], x]) /@ {0., 1.}

{0., 1.} /. x_ /; IntegerQ[Rationalize[x]] -> Rationalize[x]






  • Prev by Date: Re: Styling initialization cells
  • Next by Date: Plotting 3D Inequality with conditions for variable
  • Previous by thread: Re: Making a function from the output of the Fit function.
  • Next by thread: Re: Replace & Rationalize