login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #130 SpecialFunction(Integer) doesn't return Expression Integer revision 1 of 2

1 2
Editor:
Time: 2007/11/17 21:55:49 GMT-8
Note: revert status

changed:
-
Original Issue Report

  \begin{axiom}
  digamma 2
  \end{axiom}
  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:
\begin{axiom}
)set message selection on
digamma 2
\end{axiom}

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.

\begin{axiom}
digamma(2::EXPR INT)
digamma(2)@(EXPR INT)
\end{axiom}

Of course as something of type EXPR INT this expression has
no simplier representation.

From BillPage Wed Mar 23 16:17:27 -0600 2005
From: Bill Page
Date: Wed, 23 Mar 2005 16:17:27 -0600
Subject: this works as documented
Message-ID: <20050323161727-0600@page.axiom-developer.org>

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.




From BillPage Wed Mar 23 18:06:05 -0600 2005
From: Bill Page
Date: Wed, 23 Mar 2005 18:06:05 -0600
Subject: PLEASE RESPOND and THANK YOU
Message-ID: <20050323180605-0600@page.axiom-developer.org>

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":UserOptions
rather than remaining anonymous. 

What I think you mean is this: Why is the mode selection for the
following pairs of expressions different?
\begin{axiom}
)set message selection on
sin(2)
digamma(2)
\end{axiom}
and
\begin{axiom}
sin(2.0)
digamma(2.0)
\end{axiom}
Since sin is defined in DoubleFloat and digamma is defined in
DoubleFloatSpecialFunctions one should expect similar treatment.
\begin{axiom}
)show DoubleFloat
)show DoubleFloatSpecialFunctions
\end{axiom}

From BillPage Wed Mar 23 18:10:37 -0600 2005
From: Bill Page
Date: Wed, 23 Mar 2005 18:10:37 -0600
Subject: please excuse my premature change of status
Message-ID: <20050323181037-0600@page.axiom-developer.org>

Status: rejected => open 


From BillPage Wed Mar 23 20:06:31 -0600 2005
From: Bill Page
Date: Wed, 23 Mar 2005 20:06:31 -0600
Subject: Treating special functions like Expression Integer
Message-ID: <20050323200631-0600@page.axiom-developer.org>

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.
\begin{axiom}
)set expose drop constructor DoubleFloatSpecialFunctions
\end{axiom}
Then these are treated the same
\begin{axiom}
sin(2)
digamma(2)
\end{axiom}
except now it is necessary to do a package call to evaluate
it even for something that is a floating point value.
\begin{axiom}
digamma(2.0)
digamma(2.0)$DoubleFloatSpecialFunctions
\end{axiom}

From unknown Thu Mar 24 11:16:59 -0600 2005
From: unknown
Date: Thu, 24 Mar 2005 11:16:59 -0600
Subject: Icomplete gamma function is missing
Message-ID: <20050324111659-0600@page.axiom-developer.org>

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
<br>
Cheers

From unknown Fri Aug 18 19:10:00 -0500 2006
From: unknown
Date: Fri, 18 Aug 2006 19:10:00 -0500
Subject: =
Message-ID: <20060818191000-0500@wiki.axiom-developer.org>

Category: Axiom Library => building Axiom from source 
Severity: serious => normal 
Status: open => planned 


From unknown Fri Aug 18 19:10:38 -0500 2006
From: unknown
Date: Fri, 18 Aug 2006 19:10:38 -0500
Subject: =
Message-ID: <20060818191038-0500@wiki.axiom-developer.org>



From greg Fri Aug 18 19:32:48 -0500 2006
From: greg
Date: Fri, 18 Aug 2006 19:32:48 -0500
Subject: revert status
Message-ID: <20060818193248-0500@wiki.axiom-developer.org>

Category: building Axiom from source => Axiom Library 
Severity: normal => serious 
Status: planned => open 


Submitted by : (unknown) at: 2007-11-17T21:55:49-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

Original Issue Report

axiom
digamma 2

\label{eq1}digamma \left({2}\right)(1)
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

\label{eq2}digamma \left({2}\right)(2)
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)

\label{eq3}digamma \left({2}\right)(3)
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)

\label{eq4}digamma \left({2}\right)(4)
Type: Expression(Integer)

Of course as something of type EXPR INT this expression has no simplier representation.

this works as documented --Bill Page, Wed, 23 Mar 2005 16:17:27 -0600 reply
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 RESPOND and THANK YOU --Bill Page, Wed, 23 Mar 2005 18:06:05 -0600 reply
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)

\label{eq5}\sin \left({2}\right)(5)
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

\label{eq6}digamma \left({2}\right)(6)
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

\label{eq7}0.9092974268256816954(7)
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

\label{eq8}0.42278433509846725(8)
Type: DoubleFloat?

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)

please excuse my premature change of status --Bill Page, Wed, 23 Mar 2005 18:10:37 -0600 reply
Status: rejected => open

Treating special functions like Expression Integer --Bill Page, Wed, 23 Mar 2005 20:06:31 -0600 reply
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)

\label{eq9}\sin \left({2}\right)(9)
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)

\label{eq10}digamma \left({2}\right)(10)
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)

\label{eq11}digamma \left({2.0}\right)(11)
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

\label{eq12}0.42278433509846725(12)
Type: DoubleFloat?

Icomplete gamma function is missing --unknown, Thu, 24 Mar 2005 11:16:59 -0600 reply
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