Ask Your Question
0

Rename xbar and factorize/simplify

asked 2017-08-30 17:10:06 -0500

Tommy Angelo gravatar image

updated 2017-08-30 18:50:14 -0500

See below (my answer)

When generating fraction fields, is it possible to rename xbar to x and do a factorization? Consider the following example:

sage: R=PolynomialRing(QQ, ['x','y','a4','a6'])
sage: R.inject_variables()
Defining x, y, a4, a6
sage: I=R.ideal(x^3+a4*x+a6-y^2)
sage: Q=R.quotient(I)
sage: F=Q.fraction_field()
sage: E=EllipticCurve(F,[a4,a6])
sage: E.discriminant()
-64*a4bar^3 - 432*a6bar^2
sage: _.factor()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-149-995262737325> in <module>()
----> 1 _.factor()

/usr/lib/python2.7/site-packages/sage/categories/quotient_fields.pyc in factor(self, *args, **kwds)
    352                 (x + y)^-1 * y * x
    353             """
--> 354             return (self.numerator().factor(*args, **kwds) /
    355                     self.denominator().factor(*args, **kwds))
    356 

/usr/share/sage/source/sage/structure/element.pyx in sage.structure.element.Element.__getattr__ (/build/sagemath/src/sage-8.0/src/src/build/cythonized/sage/structure/element.c:4290)()
    457             AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'
    458         """
--> 459         return self.getattr_from_category(name)
    460 
    461     cdef getattr_from_category(self, name):

/usr/share/sage/source/sage/structure/element.pyx in sage.structure.element.Element.getattr_from_category (/build/sagemath/src/sage-8.0/src/src/build/cythonized/sage/structure/element.c:4399)()
    470         else:
    471             cls = P._abstract_element_class
--> 472         return getattr_from_other_class(self, cls, name)
    473 
    474     def __dir__(self):

/usr/share/sage/source/sage/structure/misc.pyx in sage.structure.misc.getattr_from_other_class (/build/sagemath/src/sage-8.0/src/src/build/cythonized/sage/structure/misc.c:1927)()
    292         dummy_error_message.cls = type(self)
    293         dummy_error_message.name = name
--> 294         raise dummy_attribute_error
    295     cdef PyObject* attr = _PyType_Lookup(<type>cls, name)
    296     if attr is NULL:

AttributeError: 'QuotientRing_generic_with_category.element_class' object has no attribute 'factor'

I want to have -16*(4*a4^3 + 27*a6^2) as the output. Is this possible? Another try:

sage: factor(_)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-173-af2394367aae> in <module>()
----> 1 factor(_)

/usr/lib/python2.7/site-packages/sage/arith/misc.pyc in factor(n, proof, int_, algorithm, verbose, **kwds)
   2279             return n.factor(proof=proof, **kwds)
   2280         except AttributeError:
-> 2281             raise TypeError("unable to factor n")
   2282         except TypeError:
   2283             # Just in case factor method doesn't have a proof option.

TypeError: unable to factor n
sage: factor(_, proof=false)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-174-78e3719752df> in <module>()
----> 1 factor(_, proof=false)

/usr/lib/python2.7/site-packages/sage/arith/misc.pyc in factor(n, proof, int_, algorithm, verbose, **kwds)
   2279             return n.factor(proof=proof, **kwds)
   2280         except AttributeError:
-> 2281             raise TypeError("unable to factor n")
   2282         except TypeError:
   2283             # Just in case factor method doesn't have a proof option.

TypeError: unable to factor n
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-08-30 18:30:45 -0500

Tommy Angelo gravatar image

updated 2017-08-30 21:44:03 -0500

I've found a solution. It's not necessary to consider the fraction field.

sage: R=PolynomialRing(QQ, ['x','y','a4','a6'])
sage: R.inject_variables()
Defining x, y, a4, a6
sage: I=R.ideal(x^3+a4*x+a6-y^2)
sage: Q=R.quotient(I)
sage: E=EllipticCurve(Q,[a4,a6])
sage: D=E.discriminant()
sage: D.lift()
-64*a4^3 - 432*a6^2
sage: factor(_)
(-16) * (4*a4^3 + 27*a6^2)

It's not even necessary to consider the quotient ring.

sage: R=PolynomialRing(QQ, ['x','y','a4','a6'])
sage: R.inject_variables()
Defining x, y, a4, a6
sage: E=EllipticCurve(R,[a4,a6])
sage: E.discriminant()
-64*a4^3 - 432*a6^2
sage: factor(_)
(-16) * (4*a4^3 + 27*a6^2)

But what if I want to add some points on the elliptic curve generally and want to simplify the output terms?

Okay, I've also found an answer to that. One can "extract" the numerator and denominator separately and then lift them.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-08-30 17:10:06 -0500

Seen: 32 times

Last updated: Aug 30