Original Issue Report
axiom
digamma 2
Type: Expression(Integer)
Has to return digamma(2) (EXPR INT)
Analysis
The statement of the issue is to terse and vague to be sure
what the author had in mind, but assuming that s/he expected
the result to be of type EXPR INT, here is how to see what is
going on. Use the option )set message selection on
to trace
how Axiom finds the signature of the appropriate digamma
function:
axiom
)set message selection on
digamma 2
Function Selection for digamma
Arguments: PI
[1] signature: EXPR(INT) -> EXPR(INT)
implemented: slot $$ from EXPR(INT)
[2] signature: DFLOAT -> DFLOAT
implemented: slot (DoubleFloat)(DoubleFloat) from DFSFUN
[3] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT)
implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN
Type: Expression(Integer)
Axiom finds 3 possible signatures and applies the first one
because 2 can be coerced to DoubleFloat?. But we can ask Axiom
to take the third option by either specifically treating the
type of the input 2 as EXPR INT or by asking for something of
type EXPR INT as the result.
axiom
digamma(2::EXPR INT)
Function Selection for digamma
Arguments: EXPR(INT)
[1] signature: EXPR(INT) -> EXPR(INT)
implemented: slot $$ from EXPR(INT)
Type: Expression(Integer)
axiom
digamma(2)@(EXPR INT)
Function Selection for digamma
Arguments: EXPR(INT)
Target type: EXPR(INT)
-> no appropriate digamma found in Integer
[1] signature: EXPR(INT) -> EXPR(INT)
implemented: slot $$ from EXPR(INT)
Type: Expression(Integer)
Of course as something of type EXPR INT this expression has
no simplier representation.
Status: open => rejected
Sorry to respond to this but in Axiom, all trigonometric, transcendental etc.. functions
is returned in EXPR INT if there is no integer functions. I think that Axiom has to return digamma(2)
and digamma(2.0) the SF result. This permit to work directly on expression.
You can test some other symbolic CAS.But may be I'm wrong.
Please do
not be "sorry to respond" -
that is the purpose of this website!
By the way, I think it would be polite (but it is not necessary)
for you identify yourself by clicking on
preferences
rather than remaining anonymous.
What I think you mean is this: Why is the mode selection for the
following pairs of expressions different?
axiom
)set message selection on
sin(2)
Function Selection for sin
Arguments: PI
-> no appropriate sin found in PositiveInteger
-> no appropriate sin found in Integer
-> no appropriate sin found in PositiveInteger
-> no appropriate sin found in Integer
Modemaps from Associated Packages
no modemaps
Remaining General Modemaps
[1] D -> D from D if D has TRIGCAT
[1] signature: EXPR(INT) -> EXPR(INT)
implemented: slot $$ from EXPR(INT)
Type: Expression(Integer)
axiom
digamma(2)
Function Selection for digamma
Arguments: PI
[1] signature: EXPR(INT) -> EXPR(INT)
implemented: slot $$ from EXPR(INT)
[2] signature: DFLOAT -> DFLOAT
implemented: slot (DoubleFloat)(DoubleFloat) from DFSFUN
[3] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT)
implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN
Type: Expression(Integer)
and
axiom
sin(2.0)
Function Selection for float
Arguments: (INT,INT,PI)
Target type: FLOAT
From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT
implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for sin
Arguments: FLOAT
[1] signature: FLOAT -> FLOAT
implemented: slot $$ from FLOAT
Type: Float
axiom
digamma(2.0)
Function Selection for float
Arguments: (INT,INT,PI)
Target type: FLOAT
From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT
implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for digamma
Arguments: FLOAT
-> no appropriate digamma found in Float
-> no appropriate digamma found in Float
Modemaps from Associated Packages
[1] Complex(DoubleFloat) -> Complex(DoubleFloat)
from DoubleFloatSpecialFunctions
[2] DoubleFloat -> DoubleFloat from DoubleFloatSpecialFunctions
[1] signature: DFLOAT -> DFLOAT
implemented: slot (DoubleFloat)(DoubleFloat) from DFSFUN
[2] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT)
implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN
Since sin is defined in DoubleFloat? and digamma is defined in
DoubleFloatSpecialFunctions? one should expect similar treatment.
axiom
)show DoubleFloat
DoubleFloat is a domain constructor
Abbreviation for DoubleFloat is DFLOAT
This constructor is exposed in this frame.
------------------------------- Operations --------------------------------
?*? : (Fraction(Integer),%) -> % ?*? : (%,Fraction(Integer)) -> %
?*? : (%,%) -> % ?*? : (Integer,%) -> %
?*? : (PositiveInteger,%) -> % ?+? : (%,%) -> %
?-? : (%,%) -> % -? : % -> %
?/? : (%,Integer) -> % ?/? : (%,%) -> %
?<? : (%,%) -> Boolean ?<=? : (%,%) -> Boolean
?=? : (%,%) -> Boolean ?>? : (%,%) -> Boolean
?>=? : (%,%) -> Boolean Beta : (%,%) -> %
D : % -> % D : (%,NonNegativeInteger) -> %
Gamma : (%,%) -> % Gamma : % -> %
OMwrite : (%,Boolean) -> String OMwrite : % -> String
1 : () -> % 0 : () -> %
?^? : (%,%) -> % ?^? : (%,Fraction(Integer)) -> %
?^? : (%,Integer) -> % ?^? : (%,PositiveInteger) -> %
abs : % -> % acos : % -> %
acosh : % -> % acot : % -> %
acoth : % -> % acsc : % -> %
acsch : % -> % airyAi : % -> %
airyAiPrime : % -> % airyBi : % -> %
airyBiPrime : % -> % angerJ : (%,%) -> %
asec : % -> % asech : % -> %
asin : % -> % asinh : % -> %
associates? : (%,%) -> Boolean atan : (%,%) -> %
atan : % -> % atanh : % -> %
base : () -> PositiveInteger besselI : (%,%) -> %
besselJ : (%,%) -> % besselK : (%,%) -> %
besselY : (%,%) -> % bits : () -> PositiveInteger
ceiling : % -> % coerce : Fraction(Integer) -> %
coerce : Integer -> % coerce : Fraction(Integer) -> %
coerce : % -> % coerce : Integer -> %
coerce : % -> OutputForm convert : % -> InputForm
convert : % -> Pattern(Float) convert : % -> DoubleFloat
convert : % -> Float cos : % -> %
cosh : % -> % cot : % -> %
coth : % -> % csc : % -> %
csch : % -> % differentiate : % -> %
digamma : % -> % digits : () -> PositiveInteger
ellipticE : (%,%) -> % ellipticE : % -> %
ellipticF : (%,%) -> % ellipticK : % -> %
ellipticPi : (%,%,%) -> % exp : % -> %
exp1 : () -> % exponent : % -> Integer
factor : % -> Factored(%) float : (Integer,Integer) -> %
floor : % -> % fractionPart : % -> %
gcd : List(%) -> % gcd : (%,%) -> %
hankelH1 : (%,%) -> % hankelH2 : (%,%) -> %
hash : % -> Integer hash : % -> SingleInteger
inv : % -> % jacobiCn : (%,%) -> %
jacobiDn : (%,%) -> % jacobiSn : (%,%) -> %
jacobiTheta : (%,%) -> % kelvinBei : (%,%) -> %
kelvinBer : (%,%) -> % kelvinKei : (%,%) -> %
kelvinKer : (%,%) -> % kummerM : (%,%,%) -> %
kummerU : (%,%,%) -> % lambertW : % -> %
latex : % -> String lcm : List(%) -> %
lcm : (%,%) -> % legendreP : (%,%,%) -> %
legendreQ : (%,%,%) -> % lerchPhi : (%,%,%) -> %
log : % -> % log10 : % -> %
log2 : % -> % lommelS1 : (%,%,%) -> %
lommelS2 : (%,%,%) -> % mantissa : % -> Integer
max : (%,%) -> % min : (%,%) -> %
negative? : % -> Boolean norm : % -> %
nthRoot : (%,Integer) -> % one? : % -> Boolean
order : % -> Integer pi : () -> %
polygamma : (%,%) -> % polylog : (%,%) -> %
positive? : % -> Boolean precision : () -> PositiveInteger
prime? : % -> Boolean ?quo? : (%,%) -> %
recip : % -> Union(%,"failed") ?rem? : (%,%) -> %
retract : % -> Fraction(Integer) retract : % -> Integer
riemannZeta : % -> % round : % -> %
sample : () -> % sec : % -> %
sech : % -> % sign : % -> Integer
sin : % -> % sinh : % -> %
sizeLess? : (%,%) -> Boolean smaller? : (%,%) -> Boolean
sqrt : % -> % squareFree : % -> Factored(%)
squareFreePart : % -> % struveH : (%,%) -> %
struveL : (%,%) -> % tan : % -> %
tanh : % -> % truncate : % -> %
unit? : % -> Boolean unitCanonical : % -> %
weberE : (%,%) -> % weierstrassP : (%,%,%) -> %
weierstrassZeta : (%,%,%) -> % whittakerM : (%,%,%) -> %
whittakerW : (%,%,%) -> % wholePart : % -> Integer
zero? : % -> Boolean ?~=? : (%,%) -> Boolean
?*? : (NonNegativeInteger,%) -> %
OMwrite : (OpenMathDevice,%,Boolean) -> Void
OMwrite : (OpenMathDevice,%) -> Void
?^? : (%,NonNegativeInteger) -> %
bits : PositiveInteger -> PositiveInteger if $ has ATARBPR
characteristic : () -> NonNegativeInteger
decreasePrecision : Integer -> PositiveInteger if $ has ATARBPR
differentiate : (%,NonNegativeInteger) -> %
digits : PositiveInteger -> PositiveInteger if $ has ATARBPR
divide : (%,%) -> Record(quotient: %,remainder: %)
doubleFloatFormat : String -> String
euclideanSize : % -> NonNegativeInteger
expressIdealMember : (List(%),%) -> Union(List(%),"failed")
exquo : (%,%) -> Union(%,"failed")
extendedEuclidean : (%,%,%) -> Union(Record(coef1: %,coef2: %),"failed")
extendedEuclidean : (%,%) -> Record(coef1: %,coef2: %,generator: %)
float : (Integer,Integer,PositiveInteger) -> %
gcdPolynomial : (SparseUnivariatePolynomial(%),SparseUnivariatePolynomial(%)) -> SparseUnivariatePolynomial(%)
hypergeometricF : (List(%),List(%),%) -> % if $ has RETRACT(INT)
increasePrecision : Integer -> PositiveInteger if $ has ATARBPR
max : () -> % if not(has($,arbitraryExponent)) and not(has($,arbitraryPrecision))
meijerG : (List(%),List(%),List(%),List(%),%) -> % if $ has RETRACT(INT)
min : () -> % if not(has($,arbitraryExponent)) and not(has($,arbitraryPrecision))
multiEuclidean : (List(%),%) -> Union(List(%),"failed")
patternMatch : (%,Pattern(Float),PatternMatchResult(Float,%)) -> PatternMatchResult(Float,%)
precision : PositiveInteger -> PositiveInteger if $ has ATARBPR
principalIdeal : List(%) -> Record(coef: List(%),generator: %)
rationalApproximation : (%,NonNegativeInteger,NonNegativeInteger) -> Fraction(Integer)
rationalApproximation : (%,NonNegativeInteger) -> Fraction(Integer)
retractIfCan : % -> Union(Fraction(Integer),"failed")
retractIfCan : % -> Union(Integer,"failed")
subtractIfCan : (%,%) -> Union(%,"failed")
unitNormal : % -> Record(unit: %,canonical: %,associate: %)
weierstrassPPrime : (%,%,%) -> %
weierstrassSigma : (%,%,%) -> %
axiom
)show DoubleFloatSpecialFunctions
DoubleFloatSpecialFunctions is a package constructor
Abbreviation for DoubleFloatSpecialFunctions is DFSFUN
This constructor is exposed in this frame.
------------------------------- Operations --------------------------------
Gamma : DoubleFloat -> DoubleFloat
Beta : (DoubleFloat,DoubleFloat) -> DoubleFloat
Beta : (Complex(DoubleFloat),Complex(DoubleFloat)) -> Complex(DoubleFloat)
Gamma : Complex(DoubleFloat) -> Complex(DoubleFloat)
airyAi : Complex(DoubleFloat) -> Complex(DoubleFloat)
airyAi : DoubleFloat -> DoubleFloat
airyBi : DoubleFloat -> DoubleFloat
airyBi : Complex(DoubleFloat) -> Complex(DoubleFloat)
besselI : (DoubleFloat,DoubleFloat) -> DoubleFloat
besselI : (Complex(DoubleFloat),Complex(DoubleFloat)) -> Complex(DoubleFloat)
besselJ : (DoubleFloat,DoubleFloat) -> DoubleFloat
besselJ : (Complex(DoubleFloat),Complex(DoubleFloat)) -> Complex(DoubleFloat)
besselK : (DoubleFloat,DoubleFloat) -> DoubleFloat
besselK : (Complex(DoubleFloat),Complex(DoubleFloat)) -> Complex(DoubleFloat)
besselY : (DoubleFloat,DoubleFloat) -> DoubleFloat
besselY : (Complex(DoubleFloat),Complex(DoubleFloat)) -> Complex(DoubleFloat)
digamma : DoubleFloat -> DoubleFloat
digamma : Complex(DoubleFloat) -> Complex(DoubleFloat)
hypergeometric0F1 : (DoubleFloat,DoubleFloat) -> DoubleFloat
hypergeometric0F1 : (Complex(DoubleFloat),Complex(DoubleFloat)) -> Complex(DoubleFloat)
logGamma : DoubleFloat -> DoubleFloat
logGamma : Complex(DoubleFloat) -> Complex(DoubleFloat)
polygamma : (NonNegativeInteger,DoubleFloat) -> DoubleFloat
polygamma : (NonNegativeInteger,Complex(DoubleFloat)) -> Complex(DoubleFloat)
Status: rejected => open
Apparently the difference has something to do with the fact that
DoubleFloat? is a
domain
while
DoubleFloatSpecialFunctions?
is a
package
. It is possible to obtain some of the effectst that
you want by dropping the
DoubleFloatSpecialFunctions? from the
list of exposed constructors.
axiom
)set expose drop constructor DoubleFloatSpecialFunctions
DoubleFloatSpecialFunctions is now explicitly hidden in frame
initial
Then these are treated the same
axiom
sin(2)
Function Selection for sin
Arguments: PI
-> no appropriate sin found in PositiveInteger
-> no appropriate sin found in Integer
-> no appropriate sin found in PositiveInteger
-> no appropriate sin found in Integer
Modemaps from Associated Packages
no modemaps
Remaining General Modemaps
[1] D -> D from D if D has TRIGCAT
[1] signature: EXPR(INT) -> EXPR(INT)
implemented: slot $$ from EXPR(INT)
Type: Expression(Integer)
axiom
digamma(2)
Function Selection for digamma
Arguments: PI
-> no appropriate digamma found in PositiveInteger
-> no appropriate digamma found in Integer
-> no appropriate digamma found in PositiveInteger
-> no appropriate digamma found in Integer
Modemaps from Associated Packages
no modemaps
Remaining General Modemaps
[1] D -> D from D if D has SPFCAT
[1] signature: EXPR(INT) -> EXPR(INT)
implemented: slot $$ from EXPR(INT)
Type: Expression(Integer)
except now it is necessary to do a package call to evaluate
it even for something that is a floating point value.
axiom
digamma(2.0)
Function Selection for float
Arguments: (INT,INT,PI)
Target type: FLOAT
From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT
implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for digamma
Arguments: FLOAT
-> no appropriate digamma found in Float
-> no appropriate digamma found in Float
Modemaps from Associated Packages
no modemaps
Remaining General Modemaps
[1] D -> D from D if D has SPFCAT
[1] signature: EXPR(FLOAT) -> EXPR(FLOAT)
implemented: slot $$ from EXPR(FLOAT)
Type: Expression(Float)
axiom
digamma(2.0)$DoubleFloatSpecialFunctions
Function Selection for float
Arguments: (INT,INT,PI)
Target type: FLOAT
From: FLOAT
[1] signature: (INT,INT,PI) -> FLOAT
implemented: slot $(Integer)(Integer)(PositiveInteger) from FLOAT
Function Selection for digamma
Arguments: FLOAT
From: DFSFUN
[1] signature: DFLOAT -> DFLOAT
implemented: slot (DoubleFloat)(DoubleFloat) from DFSFUN
[2] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT)
implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN
In DoubleFloatSpecialFunctions
?, incomplete gamma function is missing. If someone implements it, it's possible to add SpecialFunctionCategory
?
to the "Exports" of DoubleFloat
? (add all these functions... => I don't know why gamma is actually exported by DoubleFloat
?), unexpose DoubleFloatSpecialFunctions
? and may be SpecialFunction
?(Integer) will work as requested. The actual behavior is really annoying
Cheers
Category: Axiom Library => building Axiom from source
Severity: serious => normal
Status: open => planned
Category: building Axiom from source => Axiom Library
Severity: normal => serious
Status: planned => open