Why NumericQ[MinkowskiQuestionMark[Pi]] returns False? Is it defined only for algebraics? Numerical evaluation gives some number, but a bit surprising: N[MinkowskiQuestionMark[Pi],64] (* 3.015624761581420898437500000000000000000000000000000000000000000 *). Is it correct?


1 Answer 1


The answer can be found in the documentation of NumericQ:

An expression is considered a numeric quantity if it is either an explicit number or a mathematical constant such as Pi, or is a function that has attribute NumericFunction and all of whose arguments are numeric quantities.

(* {Listable, Protected, ReadProtected} *)

As for the correctness, you can quickly check yourself. The sum that gives the Minkowski question mark function can be found in the Details section. Using this and the coefficients for the continued fraction, you can do:

a = ContinuedFraction[Pi, 100];
ar = Rest[a];
mqm = a[[1]] + 
  2 Sum[(-1)^(n + 1)/2^Total[Take[ar, n]], {n, 1, Length[ar]}]

N[mqm, 30]
(* 3.01562476158142089843750000000 *)
  • $\begingroup$ Thank you, I missed it. But why MinkowskiQuestionMark has no NumericFunction attribute? Same for CantorStaircase. $\endgroup$ Feb 16, 2018 at 19:30
  • 4
    $\begingroup$ @AndrzejOdrzywolek The usage statement for NumericFunction is NumericFunction is an attribute that can be assigned to a symbol f to indicate that f[arg_1, arg_2, ...] should be considered a numeric quantity whenever all the arg_i are numeric quantities. Since MinkowskiQuestionMark is only defined over the real line, entering a numeric quantity, i.e. a complex one, won't always yield a numeric result. $\endgroup$
    – Greg Hurst
    Feb 16, 2018 at 19:33
  • $\begingroup$ @Chip Interesting point. So basically NumericFunction is function defined on complex plane? Except some singularities, cuts, etc. $\endgroup$ Feb 16, 2018 at 19:49
  • $\begingroup$ @AndrzejOdrzywolek Yes, it seems that way. I just scraped the documentation for Symbols containing the phrase "Mathematical function, suitable for both symbolic and numerical manipulation." that do not have the NumericFunction attribute. They are {BellB, BellY, BernoulliB, BernsteinBasis, CantorStaircase, DirichletL, EulerE, Fibonorial, MinkowskiQuestionMark, NorlundB, ProductLog, StieltjesGamma, WeierstrassHalfPeriods, WeierstrassInvariants, ZernikeR}. All make sense to me, i.e. have at least one argument that can't be complex, except for ZernikeR it seems. $\endgroup$
    – Greg Hurst
    Feb 16, 2018 at 20:16
  • $\begingroup$ @Chip Exceptions are new functions: RealAbs, RealSign. How exactly have you produced above list of functions? $\endgroup$ Feb 16, 2018 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.