|
|
last edited 10 years ago by test1 |
1 2 | ||
Editor: test1
Time: 2014/04/15 16:59:31 GMT+0 |
||
Note: |
added:
From test1 Tue Apr 15 16:59:31 +0000 2014
From: test1
Date: Tue, 15 Apr 2014 16:59:31 +0000
Subject:
Message-ID: <20140415165931+0000@axiom-wiki.newsynthesis.org>
Status: open => closed
Original Issue Report
(1) -> digamma 2
(1) |
Has to return digamma(2) (EXPR INT)
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:
)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: FLOAT -> FLOAT implemented: slot (Float)(Float) from FSFUN [3] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT) implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN [4] signature: COMPLEX(FLOAT) -> COMPLEX(FLOAT) implemented: slot (Complex (Float))(Complex (Float)) from FSFUN
(2) |
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.
digamma(2::EXPR INT)
Function Selection for digamma Arguments: EXPR(INT)
[1] signature: EXPR(INT) -> EXPR(INT) implemented: slot from EXPR(INT)
(3) |
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)
(4) |
Of course as something of type EXPR INT this expression has no simplier representation.
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?
)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)
(5) |
digamma(2)
Function Selection for digamma Arguments: PI
[1] signature: EXPR(INT) -> EXPR(INT) implemented: slot from EXPR(INT) [2] signature: FLOAT -> FLOAT implemented: slot (Float)(Float) from FSFUN [3] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT) implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN [4] signature: COMPLEX(FLOAT) -> COMPLEX(FLOAT) implemented: slot (Complex (Float))(Complex (Float)) from FSFUN
(6) |
and
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
(7) |
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(Float) -> Complex(Float) from FloatSpecialFunctions [2] Float -> Float from FloatSpecialFunctions [3] Complex(DoubleFloat) -> Complex(DoubleFloat) from DoubleFloatSpecialFunctions
[1] signature: FLOAT -> FLOAT implemented: slot (Float)(Float) from FSFUN [2] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT) implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN [3] signature: COMPLEX(FLOAT) -> COMPLEX(FLOAT) implemented: slot (Complex (Float))(Complex (Float)) from FSFUN
(8) |
Since sin is defined in DoubleFloat? and digamma is defined in DoubleFloatSpecialFunctions? one should expect similar treatment.
)show DoubleFloat
DoubleFloat is a domain constructor. Abbreviation for DoubleFloat is DFLOAT This constructor is exposed in this frame. 180 Names for 220 Operations in this Domain. ------------------------------- Operations --------------------------------
?*? : (Integer,%) -> % ?*? : (PositiveInteger, %) -> % ?*? : (%, %) -> % ?+? : (%, %) -> % ?-? : (%, %) -> % -? : % -> % ?/? : (%, Integer) -> % ?/? : (%, %) -> % ?<? : (%, %) -> Boolean ?<=? : (%, %) -> Boolean ?=? : (%, %) -> Boolean ?>? : (%, %) -> Boolean ?>=? : (%, %) -> Boolean Beta : (%, %, %) -> % Beta : (%, %) -> % D : (%, NonNegativeInteger) -> % D : % -> % Gamma : (%, %) -> % Gamma : % -> % OMwrite : (%, Boolean) -> String OMwrite : % -> String 1 : () -> % 0 : () -> % ?^? : (%, Integer) -> % ?^? : (%, PositiveInteger) -> % ?^? : (%, %) -> % abs : % -> % acos : % -> % acosh : % -> % acot : % -> % acoth : % -> % acsc : % -> % acsch : % -> % airyAi : % -> % airyAiPrime : % -> % airyBi : % -> % airyBiPrime : % -> % angerJ : (%, %) -> % annihilate? : (%, %) -> Boolean antiCommutator : (%, %) -> % asec : % -> % asech : % -> % asin : % -> % asinh : % -> % associates? : (%, %) -> Boolean associator : (%, %, %) -> % atan : (%, %) -> % atan : % -> % atanh : % -> % base : () -> PositiveInteger besselI : (%, %) -> % besselJ : (%, %) -> % besselK : (%, %) -> % besselY : (%, %) -> % bits : () -> PositiveInteger ceiling : % -> % charlierC : (%, %, %) -> % coerce : % -> OutputForm coerce : Fraction(Integer) -> % coerce : Integer -> % coerce : % -> % commutator : (%, %) -> % conjugate : % -> % convert : % -> DoubleFloat convert : % -> Float convert : % -> InputForm convert : % -> Pattern(Float) convert : % -> String cos : % -> % cosh : % -> % cot : % -> % coth : % -> % csc : % -> % csch : % -> % differentiate : % -> % digamma : % -> % digits : () -> PositiveInteger diracDelta : % -> % ellipticE : (%, %) -> % ellipticE : % -> % ellipticF : (%, %) -> % ellipticK : % -> % ellipticPi : (%, %, %) -> % exp : % -> % exp1 : () -> % exponent : % -> Integer factor : % -> Factored(%) float : (Integer, Integer) -> % floor : % -> % fractionPart : % -> % gcd : List(%) -> % gcd : (%, %) -> % hankelH1 : (%, %) -> % hankelH2 : (%, %) -> % hash : % -> SingleInteger hermiteH : (%, %) -> % inv : % -> % jacobiCn : (%, %) -> % jacobiDn : (%, %) -> % jacobiP : (%, %, %, %) -> % jacobiSn : (%, %) -> % jacobiTheta : (%, %) -> % jacobiZeta : (%, %) -> % kelvinBei : (%, %) -> % kelvinBer : (%, %) -> % kelvinKei : (%, %) -> % kelvinKer : (%, %) -> % kummerM : (%, %, %) -> % kummerU : (%, %, %) -> % laguerreL : (%, %, %) -> % lambertW : % -> % latex : % -> String lcm : List(%) -> % lcm : (%, %) -> % legendreP : (%, %, %) -> % legendreQ : (%, %, %) -> % lerchPhi : (%, %, %) -> % log : % -> % log10 : % -> % log2 : % -> % lommelS1 : (%, %, %) -> % lommelS2 : (%, %, %) -> % mantissa : % -> Integer max : (%, %) -> % max : () -> % meixnerM : (%, %, %, %) -> % min : (%, %) -> % min : () -> % negative? : % -> Boolean norm : % -> % nthRoot : (%, Integer) -> % one? : % -> Boolean opposite? : (%, %) -> Boolean order : % -> Integer pi : () -> % polygamma : (%, %) -> % polylog : (%, %) -> % positive? : % -> Boolean precision : () -> PositiveInteger prime? : % -> Boolean qlog : % -> % qsqrt : % -> % ?quo? : (%, %) -> % recip : % -> Union(%, "failed") ?rem? : (%, %) -> % retract : % -> Fraction(Integer) retract : % -> Integer riemannZeta : % -> % round : % -> % sample : () -> % sec : % -> % sech : % -> % sign : % -> Integer sign : % -> % sin : % -> % sinh : % -> % sizeLess? : (%, %) -> Boolean smaller? : (%, %) -> Boolean sqrt : % -> % squareFree : % -> Factored(%) squareFreePart : % -> % struveH : (%, %) -> % struveL : (%, %) -> % tan : % -> % tanh : % -> % toString : % -> String truncate : % -> % unit? : % -> Boolean unitCanonical : % -> % unitStep : % -> % weberE : (%, %) -> % weierstrassP : (%, %, %) -> % whittakerM : (%, %, %) -> % whittakerW : (%, %, %) -> % wholePart : % -> Integer zero? : % -> Boolean ?~=? : (%, %) -> Boolean ?*? : (Fraction(Integer), %) -> % ?*? : (NonNegativeInteger, %) -> % ?*? : (%, Fraction(Integer)) -> % OMwrite : (OpenMathDevice, %, Boolean) -> Void OMwrite : (OpenMathDevice, %) -> Void ?^? : (%, Fraction(Integer)) -> % ?^? : (%, NonNegativeInteger) -> % characteristic : () -> NonNegativeInteger differentiate : (%, NonNegativeInteger) -> % divide : (%, %) -> Record(quotient: %, remainder: %) doubleFloatFormat : String -> String euclideanSize : % -> NonNegativeInteger expressIdealMember : (List(%), %) -> Union(List(%), "failed") exquo : (%, %) -> Union(%, "failed") extendedEuclidean : (%, %) -> Record(coef1: %, coef2: %, generator: %) extendedEuclidean : (%, %, %) -> Union(Record(coef1: %, coef2: %), "failed") float : (Integer, Integer, PositiveInteger) -> % gcdPolynomial : (SparseUnivariatePolynomial(%), SparseUnivariatePolynomial(%)) -> SparseUnivariatePolynomial(%) hashUpdate! : (HashState, %) -> HashState hypergeometricF : (List(%), List(%), %) -> % lcmCoef : (%, %) -> Record(llcm_res: %, coeff1: %, coeff2: %) leftPower : (%, NonNegativeInteger) -> % leftPower : (%, PositiveInteger) -> % leftRecip : % -> Union(%, "failed") meijerG : (List(%), List(%), List(%), List(%), %) -> % multiEuclidean : (List(%), %) -> Union(List(%), "failed") patternMatch : (%, Pattern(Float), PatternMatchResult(Float, %)) -> PatternMatchResult(Float, %) plenaryPower : (%, PositiveInteger) -> % principalIdeal : List(%) -> Record(coef: List(%), generator: %) rationalApproximation : (%, NonNegativeInteger, NonNegativeInteger) -> Fraction(Integer) rationalApproximation : (%, NonNegativeInteger) -> Fraction(Integer) retractIfCan : % -> Union(Fraction(Integer), "failed") retractIfCan : % -> Union(Integer, "failed") rightPower : (%, NonNegativeInteger) -> % rightPower : (%, PositiveInteger) -> % rightRecip : % -> Union(%, "failed") subtractIfCan : (%, %) -> Union(%, "failed") toString : (%, NonNegativeInteger) -> String unitNormal : % -> Record(unit: %, canonical: %, associate: %) weierstrassPInverse : (%, %, %) -> % weierstrassPPrime : (%, %, %) -> % weierstrassSigma : (%, %, %) -> % weierstrassZeta : (%, %, %) -> %
)show DoubleFloatSpecialFunctionsStatus: rejected => open
DoubleFloatSpecialFunctions is a package constructor Abbreviation for DoubleFloatSpecialFunctions is DFSFUN This constructor is exposed in this frame. ------------------------------- Operations --------------------------------
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 : Complex(DoubleFloat) -> Complex(DoubleFloat) polygamma : (NonNegativeInteger, Complex(DoubleFloat)) -> Complex(DoubleFloat)
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.
)set expose drop constructor DoubleFloatSpecialFunctions
DoubleFloatSpecialFunctions is now explicitly hidden in frame initial
Then these are treated the same
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)
(9) |
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 [2] Complex(Float) -> Complex(Float) from FloatSpecialFunctions [3] Float -> Float from FloatSpecialFunctions
[1] signature: EXPR(INT) -> EXPR(INT) implemented: slot from EXPR(INT) [2] signature: FLOAT -> FLOAT implemented: slot (Float)(Float) from FSFUN [3] signature: COMPLEX(FLOAT) -> COMPLEX(FLOAT) implemented: slot (Complex (Float))(Complex (Float)) from FSFUN
(10) |
except now it is necessary to do a package call to evaluate it even for something that is a floating point value.
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(Float) -> Complex(Float) from FloatSpecialFunctions [2] Float -> Float from FloatSpecialFunctions
[1] signature: FLOAT -> FLOAT implemented: slot (Float)(Float) from FSFUN [2] signature: COMPLEX(FLOAT) -> COMPLEX(FLOAT) implemented: slot (Complex (Float))(Complex (Float)) from FSFUN
(11) |
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 Target type: COMPLEX(DFLOAT) From: DFSFUN
[1] signature: COMPLEX(DFLOAT) -> COMPLEX(DFLOAT) implemented: slot (Complex (DoubleFloat))(Complex (DoubleFloat)) from DFSFUN
(12) |