William Stein <[email protected]> writes:
> The above definition of binomial is documented if you type "binomial?"
> in Sage. This is also arguable the standard usage of "binomial",
> since it is the same in Mathematica, Maple, Maxima, Pari, GAP, and
> Magma:
>
> sage: mathematica('Binomial[-7,1]')
> -7
> sage: maple('binomial(-7,1)')
> -7
> sage: pari('binomial(-7,1)')
> -7
> sage: maxima('binomial(-7,1)')
> -7
> sage: gap('Binomial(-7,1)')
> -7
> sage: magma('Binomial(-7,1)')
> -7
>
>> Axiom returns 0 in this case.
>
> Based on the above, maybe Axiom should be changed?
FriCAS give 0 for the input above, *but* this is only half of the story.
In FriCAS (and Axiom, and I believe Sage too), the answer of a
computation depends on the domain of the input. Eg.:
(1) -> 0::INT^0::NNI
(1) 1
Type: PositiveInteger
(2) -> 0.0^0.0
>> Error detected within library code:
0^0 is undefined
I think that at least here, this makes sense: when computing with
integers, I want that 0^0 = 1, when computing with floats, I don't.
However, even with this simple example, the right thing to do is not
always clear. Eg.:
(3) -> 0^(0::FRAC INT)
Function Selection for ^
Arguments: (NNI,FRAC(INT))
Default target type: AlgebraicNumber
[1] signature: (AN,FRAC(INT)) -> AN
implemented: slot $$(Fraction (Integer)) from AN
(3) 1
Type: AlgebraicNumber
(AN is short for AlgebraicNumber)
Shouldn't this give an error? (I'm inclined to say yes, but I'm not
entirely sure...) There was some discussion in
http://lists.nongnu.org/archive/html/axiom-developer/2004-06/
but unfortunately, it was never quite "finished".
Concerning binomial coefficients, the same applies. I must say that I'm
rather tending to think that the two operations should give the same
result. Bug fixes and/or unittests are welcome. In fact, for 0^0, a
series of tests saying for which domains we want an error and for which
1 might be a good excercise.
Concerning FriCAS, other things are simply more pressing. Developers
welcome.
Martin
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---