Ignore:
Timestamp:
05/19/09 16:11:30 (4 years ago)
Author:
Mike Hansen <mhansen@…>
Branch:
default
Message:

Updates for Pynac-0.1.7, main symbolics switch (#5930)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/schemes/elliptic_curves/ell_generic.py

    r12224 r12287  
    360360            sage: eqn = symbolic_expression(E); eqn 
    361361            y^2 + y == x^3 - x^2 - 10*x - 20 
    362             sage: print eqn 
    363                                       2        3    2 
    364                                      y  + y == x  - x  - 10 x - 20 
    365362         
    366363        We verify that the given point is on the curve:: 
     
    373370        We create a single expression:: 
    374371         
    375             sage: F = eqn.lhs() - eqn.rhs(); print F 
    376                                       2        3    2 
    377                                      y  + y - x  + x  + 10 x + 20 
     372            sage: F = eqn.lhs() - eqn.rhs(); F 
     373            -x^3 + x^2 + y^2 + 10*x + y + 20 
    378374            sage: y = var('y') 
    379             sage: print F.solve(y) 
    380             [ 
    381                                   3      2 
    382                         - sqrt(4 x  - 4 x  - 40 x - 79) - 1 
    383                     y == ----------------------------------- 
    384                                          2, 
    385                                  3      2 
    386                          sqrt(4 x  - 4 x  - 40 x - 79) - 1 
    387                      y == --------------------------------- 
    388                                          2 
    389             ] 
     375            sage: F.solve(y) 
     376            [y == -1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2, 
     377             y == 1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2] 
    390378         
    391379        You can also solve for x in terms of y, but the result is 
     
    393381        find points over random fields by substituting in values for x:: 
    394382         
    395             sage: v = F.solve(y)[0].rhs()    
    396             sage: print v 
    397                                             3      2 
    398                                   - sqrt(4 x  - 4 x  - 40 x - 79) - 1 
    399                                   ----------------------------------- 
    400                                                    2 
     383            sage: v = F.solve(y)[0].rhs(); v 
     384            -1/2*sqrt(4*x^3 - 4*x^2 - 40*x - 79) - 1/2 
    401385            sage: v = v.function(x) 
    402386            sage: v(3) 
    403             (-sqrt(127)*I - 1)/2 
     387            -1/2*sqrt(-127) - 1/2 
    404388            sage: v(7) 
    405             (-sqrt(817) - 1)/2 
     389            -1/2*sqrt(817) - 1/2 
    406390            sage: v(-7) 
    407             (-sqrt(1367)*I - 1)/2 
     391            -1/2*sqrt(-1367) - 1/2 
    408392            sage: v(sqrt(2)) 
    409             (-sqrt(-32*sqrt(2) - 87) - 1)/2 
     393            -1/2*sqrt(-32*sqrt(2) - 87) - 1/2 
    410394         
    411395        We can even do arithmetic with them, as follows:: 
    412396         
    413397            sage: E2 = E.change_ring(SR); E2 
    414             Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Symbolic Ring 
    415             sage: P = E2.point((3, v(3), 1), check=False) 
     398            Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Symbolic Ring 
     399            sage: P = E2.point((3, v(3), 1), check=False) # the check=False option doesn't verify that y^2 = f(x) 
    416400            sage: P 
    417             (3 : (-sqrt(127)*I - 1)/2 : 1) 
     401            (3 : -1/2*sqrt(-127) - 1/2 : 1) 
    418402            sage: P + P 
    419             (-756/127 : (sqrt(127)*I + 1)/2 + 12507*I/(127*sqrt(127)) - 1 : 1) 
     403            (-756/127 : 41143/32258*sqrt(-127) - 1/2 : 1) 
    420404         
    421405        We can even throw in a transcendental:: 
    422406         
    423407            sage: w = E2.point((pi,v(pi),1), check=False); w 
    424             (pi : (-sqrt(4*pi^3 - 4*pi^2 - 40*pi - 79) - 1)/2 : 1) 
     408            (pi : -1/2*sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1/2 : 1) 
     409            sage: x, y, z = w; ((y^2 + y) - (x^3 - x^2 - 10*x - 20)).expand() 
     410            0 
     411 
    425412            sage: 2*w 
    426             ((3*pi^2 - 2*pi - 10)^2/(4*pi^3 - 4*pi^2 - 40*pi - 79) - 2*pi + 1 : (sqrt(4*pi^3 - 4*pi^2 - 40*pi - 79) + 1)/2 - (3*pi^2 - 2*pi - 10)*(-(3*pi^2 - 2*pi - 10)^2/(4*pi^3 - 4*pi^2 - 40*pi - 79) + 3*pi - 1)/sqrt(4*pi^3 - 4*pi^2 - 40*pi - 79) - 1 : 1) 
     413            (-2*pi + (2*pi - 3*pi^2 + 10)^2/(-40*pi + 4*pi^3 - 4*pi^2 - 79) + 1 : (2*pi - 3*pi^2 + 10)*(3*pi - (2*pi - 3*pi^2 + 10)^2/(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1)/sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) + 1/2*sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1/2 : 1) 
     414             
     415            sage: x, y, z = 2*w; temp = ((y^2 + y) - (x^3 - x^2 - 10*x - 20)) 
     416 
     417        This is a point on the curve:: 
     418 
     419            sage: bool(temp == 0) 
     420            True 
    427421        """ 
    428422        a = [SR(x) for x in self.a_invariants()] 
Note: See TracChangeset for help on using the changeset viewer.