- Timestamp:
- 05/19/09 16:11:30 (4 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/schemes/elliptic_curves/ell_generic.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/schemes/elliptic_curves/ell_generic.py
r12224 r12287 360 360 sage: eqn = symbolic_expression(E); eqn 361 361 y^2 + y == x^3 - x^2 - 10*x - 20 362 sage: print eqn363 2 3 2364 y + y == x - x - 10 x - 20365 362 366 363 We verify that the given point is on the curve:: … … 373 370 We create a single expression:: 374 371 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 378 374 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] 390 378 391 379 You can also solve for x in terms of y, but the result is … … 393 381 find points over random fields by substituting in values for x:: 394 382 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 401 385 sage: v = v.function(x) 402 386 sage: v(3) 403 (-sqrt(127)*I - 1)/2387 -1/2*sqrt(-127) - 1/2 404 388 sage: v(7) 405 (-sqrt(817) - 1)/2389 -1/2*sqrt(817) - 1/2 406 390 sage: v(-7) 407 (-sqrt(1367)*I - 1)/2391 -1/2*sqrt(-1367) - 1/2 408 392 sage: v(sqrt(2)) 409 (-sqrt(-32*sqrt(2) - 87) - 1)/2393 -1/2*sqrt(-32*sqrt(2) - 87) - 1/2 410 394 411 395 We can even do arithmetic with them, as follows:: 412 396 413 397 sage: E2 = E.change_ring(SR); E2 414 Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20over Symbolic Ring415 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) 416 400 sage: P 417 (3 : (-sqrt(127)*I - 1)/2 : 1)401 (3 : -1/2*sqrt(-127) - 1/2 : 1) 418 402 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) 420 404 421 405 We can even throw in a transcendental:: 422 406 423 407 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 425 412 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 427 421 """ 428 422 a = [SR(x) for x in self.a_invariants()]
Note: See TracChangeset
for help on using the changeset viewer.
