Subject: proposal for object-oriented dispatch on sign
From: Barton Willis
Date: Thu, 14 Jul 2011 09:40:31 -0500
As an experiment, I inserted a few lines into sign to look at the operators
of expressions that make it to sign that do not have a sign-function. Running the testsuite
and the share testsuite gives [[op, number times expression with op makes it to sign], ... ]
These results were done with experimental sign functions for floor, parg, and erf.
Example: sign is called 1,400 times with an expression of the form realpart(XXX), and etc.
[[qty,1610],[imagpart,1424],[realpart,1400],[f,828],[conjugate,656],[cos,568],[sin,550],[gamma_incomplete,200],[
tan,98],[mlist,92],[log,69],[atan,68],[atan2,54],[sec,44],[cosh,43],[gv,33],["!",33],[tanh,33],[matrix,31],[airy_dai,30],[
airy_bi,30],[airy_ai,24],[airy_dbi,24],[sum,22],[U,19],[bit_not,18],[sinh,16],[".",14],[bessel_y,12],[bessel_k,12],[asin,12],[
acos,12],[diff,12],[cot,8],[expintegral_si,8],[u,7],[mnotequal,6],["'",6],[gamma,6],[g,6],[asinh,6],[z,6],[set,5],[acosh,5],[f,5],
[mncexpt,4],[expintegral_ei,4],[`,4],[y,4],[elliptic_kc,3],[unit_step,2],[sech,2],[coth,2],[atanh,2],[acsch,2],[zeta,2],[binomial,
1],[hypergeometric,1],[foo,1],[inverse_jacobi_sn,1]]
If you want to experiment, try writing a sign function for one of these functions--I'd guess that
giving a sign function on either imagart, realpart, or conjugate might be a quick way to an infinite
loop :(
As an example of a sign function, look at sign-mabs. But I don't know what the special variables
minus, evens, and odds control:( I'd need to understand that better before I would append
more sign functions.
--Barton