MathGroup Archive 2007

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

Search the Archive

Re: A riddle: Functions that return unevaluated when they cannot


In The Mathematical Journal Volume 7, issue 2 there is an article from Bruce Miller "A function which does not evaluate".(page 149).
Sin[x] does not evaluate because x is undefined.
f[q_?NumberQ]:= q^2 gives with f[x]: f[x] and with f[2.718] 7.38752.
Of course, again and again: Clear[f]
But, with
f[(n_?Positive)?IntegerQ]:=n!
f[n_]:= Print["f expects a positive integer argument"]
Try f[2.4]
It is the way some functions are implemented that they do not a "should" evaluate.
with friendly greetings,
P_ter


  • Prev by Date: Wald test on mathematica
  • Next by Date: Re: Animate with Slider Box Value
  • Previous by thread: Re: A riddle: Functions that return unevaluated when they cannot
  • Next by thread: Re: A riddle: Functions that return unevaluated when they cannot