On Wed, 07 Feb 2007 23:15:41 -0700, Luis Finotti <[EMAIL PROTECTED]> wrote:
>> sage: E=EllipticCurve(RR,[0,-1])
>> sage: x0=RR(4)^(1/3)
>> sage: y0=sqrt(RR(3))
>> sage: p=E.point([x0,y0,1], check=False)
>> sage: p
>> (1.58740105196819 : 1.73205080756887 : 1)
>> sage: 2*p, 3*p
>> ((1.58740105196819 : -1.73205080756887 : 1), (0.000000000000000 :
>> 1.00000000000000 : 0.000000000000000))
>>
>> NOTE: It's important to input [x0,y0,1], i.e., a 3-tuple, since check=False
>> really does no
>> checking about the input, and you'll get surprising failures later if you're
>> not careful.
>
> Thanks! I could not find that in the Reference Manual...
I found it is as follows:
(1) I typed E.__call__??
to see the source code of the function that gets called when one types E(...).
(2) It just calls the point method, so I looked at that.
Alternatively, you could do
E.[press tab key]
and look at the list of elliptic curve methods.
> On the other hand, it seems that Sage (or Python) does not handle
> equality of reals very well:
>
> sage: sqrt(2)==sqrt(2)
> True
> sage: sqrt(2)==sqrt(2)+1-1
> False
>
> This might give me some problems when comparing two points/vectors...
> (I can find a way around it for sure. Again, just in case...)
The approximate real number library mpfr that SAGE builds on defines
equality for approximate real numbers in SAGE. If you look at
the underlying binary representations of the above two numbers,
you'll see that they really are NOT equal, due to rounding errors:
sage: sqrt(2).str(2)
'1.0110101000001001111001100110011111110011101111001101'
sage: (sqrt(2)+1-1).str(2)
'1.0110101000001001111001100110011111110011101111001100'
GP/PARI, another piece of math software (included as part of SAGE),
also has this property:
[EMAIL PROTECTED] sage-2.1.alpha4$ ./sage -gp
? sqrt(2)==sqrt(2)+1-1
%1 = 0
So does MAGMA:
> Sqrt(2) eq Sqrt(2) +1 - 1;
false
So does Python:
rank4:~/talks/2007-02-07-banff-bsd was$ sage -python
>>> from math import sqrtsqrt(2) == sqrt(2) + 1 -1
False
So I'm not sure it's fair to say that "Sage does not handle
equality of reals very well".
William
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---