Ticket #9684: 9684_dirty_model.patch
| File 9684_dirty_model.patch, 8.9 KB (added by arminstraub, 3 years ago) |
|---|
-
sage/schemes/elliptic_curves/ell_local_data.py
# HG changeset patch # User Armin Straub <math@arminstraub.com> # Date 1280898934 18000 # Node ID ac4ded622575618fc79a6e4777f81d91b3641b6b # Parent 96585fa43e337918c0fab649ac2f8966a797cf61 9684: Make use of _tidy_model() optional diff -r 96585fa43e33 -r ac4ded622575 sage/schemes/elliptic_curves/ell_local_data.py
a b 262 262 self._KS = KodairaSymbol(data[1].python()) 263 263 self._cp = data[3].python() 264 264 # We use a global minimal model since we can: 265 self._Emin = Eint.minimal_model()266 self._val_disc = self._Emin .discriminant().valuation(p)265 self._Emin_tidy = Eint.minimal_model() 266 self._val_disc = self._Emin_tidy.discriminant().valuation(p) 267 267 if self._fp>0: 268 268 self._reduction_type = Eint.ap(p) # = 0,-1 or +1 269 269 else: … … 294 294 red_type = "good" 295 295 if not self._reduction_type is None: 296 296 red_type = ["bad non-split multiplicative","bad additive","bad split multiplicative"][1+self._reduction_type] 297 return "Local data at %s:\nReduction type: %s\nLocal minimal model: %s\nMinimal discriminant valuation: %s\nConductor exponent: %s\nKodaira Symbol: %s\nTamagawa Number: %s"%(self._prime,red_type,self. _Emin,self._val_disc,self._fp,self._KS,self._cp)297 return "Local data at %s:\nReduction type: %s\nLocal minimal model: %s\nMinimal discriminant valuation: %s\nConductor exponent: %s\nKodaira Symbol: %s\nTamagawa Number: %s"%(self._prime,red_type,self.minimal_model(),self._val_disc,self._fp,self._KS,self._cp) 298 298 299 def minimal_model(self ):299 def minimal_model(self, tidy=True): 300 300 """ 301 301 Return the (local) minimal model from this local reduction data. 302 302 303 INPUT: 304 305 - ``tidy`` -- (default: True) if set to True the EC returned by Tate's algorithm will be 306 "tidied" as specified in _tidy_model() for curves over number fields. 307 303 308 EXAMPLES:: 304 309 305 310 sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData … … 310 315 Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field 311 316 sage: data.minimal_model() == E.local_minimal_model(2) 312 317 True 318 319 To demonstrate the behaviour of the parameter ``tidy``:: 320 321 sage: K.<a> = NumberField(x^3+x+1) 322 sage: E = EllipticCurve(K, [0, 0, a, 0, 1]) 323 sage: E.local_data(K.ideal(a-1)).minimal_model() 324 Elliptic Curve defined by y^2 + a*y = x^3 + 1 over Number Field in a with defining polynomial x^3 + x + 1 325 sage: E.local_data(K.ideal(a-1)).minimal_model(tidy=False) 326 Elliptic Curve defined by y^2 + (a+2)*y = x^3 + 3*x^2 + 3*x + (-a+1) over Number Field in a with defining polynomial x^3 + x + 1 327 328 sage: E = EllipticCurve([2, 1, 0, -2, -1]) 329 sage: E.local_data(ZZ.ideal(2), algorithm="generic").minimal_model(tidy=False) 330 Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + x^2 - 4*x - 2 over Rational Field 331 sage: E.local_data(ZZ.ideal(2), algorithm="pari").minimal_model(tidy=False) 332 Traceback (most recent call last): 333 ... 334 ValueError: the argument tidy must not be False if algorithm=pari is used 335 sage: E.local_data(ZZ.ideal(2), algorithm="generic").minimal_model() 336 Elliptic Curve defined by y^2 = x^3 - x^2 - 3*x + 2 over Rational Field 337 sage: E.local_data(ZZ.ideal(2), algorithm="pari").minimal_model() 338 Elliptic Curve defined by y^2 = x^3 - x^2 - 3*x + 2 over Rational Field 313 339 """ 314 return self._Emin 340 if tidy: 341 try: 342 return self._Emin_tidy 343 except AttributeError: 344 pass 345 self._Emin_tidy = self._Emin._tidy_model() 346 return self._Emin_tidy 347 else: 348 try: 349 return self._Emin 350 except AttributeError: 351 raise ValueError, "the argument tidy must not be False if algorithm=pari is used" 315 352 316 353 def prime(self): 317 354 """ … … 938 975 pie *= pi # now pie=pi^6 939 976 a6 /= pie 940 977 verbose("Non-minimal equation, dividing out...\nNew model is %s"%([a1, a2, a3, a4, a6]), t, 1) 941 C = C._tidy_model()942 978 return (C, p, val_disc, fp, KS, cp, split) 943 979 944 980 -
sage/schemes/elliptic_curves/ell_number_field.py
diff -r 96585fa43e33 -r ac4ded622575 sage/schemes/elliptic_curves/ell_number_field.py
a b 439 439 raise DeprecationWarning, "local_information is deprecated; use local_data instead" 440 440 return self.local_data(P,proof) 441 441 442 def local_data(self, P=None, proof = None ):442 def local_data(self, P=None, proof = None, algorithm="pari"): 443 443 r""" 444 444 Local data for this elliptic curve at the prime `P`. 445 445 … … 451 451 (default controlled by global proof module). Note that the 452 452 proof module is number_field, not elliptic_curves, since the 453 453 functions that actually need the flag are in number fields. 454 455 - ``algorithm`` (string, default: "pari") -- Ignored unless the 456 base field is `\QQ`. If "pari", use the PARI C-library 457 ``ellglobalred`` implementation of Tate's algorithm over 458 `\QQ`. If "generic", use the general number field 459 implementation. 454 460 455 461 OUTPUT: 456 462 … … 521 527 from sage.schemes.elliptic_curves.ell_local_data import check_prime 522 528 P = check_prime(self.base_field(),P) 523 529 524 return self._get_local_data(P,proof )530 return self._get_local_data(P,proof,algorithm) 525 531 526 def _get_local_data(self, P, proof ):532 def _get_local_data(self, P, proof, algorithm="pari"): 527 533 r""" 528 534 Internal function to create data for this elliptic curve at the prime `P`. 529 535 … … 539 545 (default controlled by global proof module). Note that the 540 546 proof module is number_field, not elliptic_curves, since the 541 547 functions that actually need the flag are in number fields. 548 549 - ``algorithm`` (string, default: "pari") -- Ignored unless the 550 base field is `\QQ`. If "pari", use the PARI C-library 551 ``ellglobalred`` implementation of Tate's algorithm over 552 `\QQ`. If "generic", use the general number field 553 implementation. 542 554 543 555 EXAMPLES:: 544 556 … … 554 566 Kodaira Symbol: I0 555 567 Tamagawa Number: 1 556 568 557 Verify that we cache based on the proof value ::569 Verify that we cache based on the proof value and the algorithm choice:: 558 570 559 571 sage: E._get_local_data(p, False) is E._get_local_data(p, True) 560 572 False 573 574 sage: E._get_local_data(p, None, "pari") is E._get_local_data(p, None, "generic") 575 False 561 576 """ 562 577 try: 563 return self._local_data[P, proof ]578 return self._local_data[P, proof, algorithm] 564 579 except AttributeError: 565 580 self._local_data = {} 566 581 except KeyError: 567 582 pass 568 583 from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData 569 self._local_data[P, proof ] = EllipticCurveLocalData(self, P, proof)570 return self._local_data[P, proof ]584 self._local_data[P, proof, algorithm] = EllipticCurveLocalData(self, P, proof, algorithm) 585 return self._local_data[P, proof, algorithm] 571 586 572 def local_minimal_model(self, P, proof = None ):587 def local_minimal_model(self, P, proof = None, algorithm="pari"): 573 588 r""" 574 589 Returns a model which is integral at all primes and minimal at `P`. 575 590 … … 581 596 (default controlled by global proof module). Note that the 582 597 proof module is number_field, not elliptic_curves, since the 583 598 functions that actually need the flag are in number fields. 599 600 - ``algorithm`` (string, default: "pari") -- Ignored unless the 601 base field is `\QQ`. If "pari", use the PARI C-library 602 ``ellglobalred`` implementation of Tate's algorithm over 603 `\QQ`. If "generic", use the general number field 604 implementation. 584 605 585 606 OUTPUT: 586 607 … … 609 630 # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions. 610 631 proof = sage.structure.proof.proof.get_flag(None, "number_field") 611 632 612 return self.local_data(P, proof ).minimal_model()633 return self.local_data(P, proof, algorithm).minimal_model() 613 634 614 635 def has_good_reduction(self, P): 615 636 r"""
