Possible workaround: sage: num -1/2*(12*r^4*x + 4*r^2*x^3 + 4*r^2*x*y^2 - 4*r^2*x + 4*x^3 + 4*x*y^2)^2/(r^6 + 6*r^4*x^2 + r^2*x^4 + 2*r^4*y^2 + 2*r^2*x^2*y^2 + r^2*y^4 - 2*r^2*x^2 + x^4 + 2*r^2*y^2 + 2*x^2*y^2 + y^4)^2 - 1/2*(4*r^4*y + 4*r^2*x^2*y + 4*r^2*y^3 + 4*r^2*y + 4*x^2*y + 4*y^3)^2/(r^6 + 6*r^4*x^2 + r^2*x^4 + 2*r^4*y^2 + 2*r^2*x^2*y^2 + r^2*y^4 - 2*r^2*x^2 + x^4 + 2*r^2*y^2 + 2*x^2*y^2 + y^4)^2 + 1/2*(12*r^4 + 12*r^2*x^2 + 4*r^2*y^2 - 4*r^2 + 12*x^2 + 4*y^2)/(r^6 + 6*r^4*x^2 + r^2*x^4 + 2*r^4*y^2 + 2*r^2*x^2*y^2 + r^2*y^4 - 2*r^2*x^2 + x^4 + 2*r^2*y^2 + 2*x^2*y^2 + y^4) + 1/2*(4*r^4 + 4*r^2*x^2 + 12*r^2*y^2 + 4*r^2 + 4*x^2 + 12*y^2)/(r^6 + 6*r^4*x^2 + r^2*x^4 + 2*r^4*y^2 + 2*r^2*x^2*y^2 + r^2*y^4 - 2*r^2*x^2 + x^4 + 2*r^2*y^2 + 2*x^2*y^2 + y^4) sage: num.maxima_methods().factor() 8*(r^6 - 2*r^4*x^2 + r^2*x^4 + 2*r^4*y^2 + 2*r^2*x^2*y^2 + r^2*y^4 + 5*r^2*x^2 + x^4 + r^2*y^2 + 2*x^2*y^2 + y^4 - x^2 - y^2)*r^4/(r^6 + 6*r^4*x^2 + r^2*x^4 + 2*r^4*y^2 + 2*r^2*x^2*y^2 + r^2*y^4 - 2*r^2*x^2 + x^4 + 2*r^2*y^2 + 2*x^2*y^2 + y^4)^2
HTH, Le mercredi 24 juillet 2019 13:31:08 UTC+2, Enrique Artal a écrit : > > I have encountered a problem with factor in SR which can be avoided but it > shows a problem. If I run this code: > > var('t',domain='complex') > var('r,x,y',domain='real') > h= r^6+r^4*t^2 + 4*r^4*t*conjugate(t) + r^4*conjugate(t)^2 + > r^2*t^2*conjugate(t)^2 - r^2*t^2 - r^2*conjugate(t)^2 + t^2*conjugate(t)^2 > H=h(t=x+I*y).factor() > > num=1/2*(H.derivative(x)/H).derivative(x)+1/2*(H.derivative(y)/H).derivative(y) > num.factor() > > I get the following error > > ---------------------------------------------------------------------------ValueError > Traceback (most recent call > last)<ipython-input-1-bfb20671ab22> in <module>() 6 > H=h(t=x+I*y).factor() 7 > num=Integer(1)/Integer(2)*(H.derivative(x)/H).derivative(x)+Integer(1)/Integer(2)*(H.derivative(y)/H).derivative(y)----> > 8 num.factor() > /home/artal/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.pyx > in sage.symbolic.expression.Expression.factor > (build/cythonized/sage/symbolic/expression.cpp:57759)() 11107 cdef > GEx x 11108 cdef bint b> 11109 if dontfactor or not > self.is_rational_expression(): 11110 m = self._maxima_() 11111 > name = m.name() > /home/artal/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.pyx > in sage.symbolic.expression.Expression.is_rational_expression > (build/cythonized/sage/symbolic/expression.cpp:15368)() 2030 > False 2031 """-> 2032 return all(part.is_polynomial(v) > 2033 for part in (self.numerator(), self.denominator()) > 2034 for v in part.variables()) > /home/artal/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.pyx > in genexpr (build/cythonized/sage/symbolic/expression.cpp:15110)() 2031 > """ 2032 return all(part.is_polynomial(v)-> 2033 > for part in (self.numerator(), self.denominator()) 2034 > for v in part.variables()) 2035 > /home/artal/sage/local/lib/python2.7/site-packages/sage/symbolic/expression.pyx > in sage.symbolic.expression.Expression.numerator > (build/cythonized/sage/symbolic/expression.cpp:48252)() 9377 > sig_on() 9378 try:-> 9379 ex = > self._gobj.numer() 9380 finally: 9381 > sig_off() > ValueError: divide: arguments must be polynomials over the rationals > > > This error does not happen if I erase some terms of h; and some times it > gives the error only if I did not restart the jupyter notebook. Any ideas? > Enrique. > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/3151c690-a285-4f67-907e-16d628064f16%40googlegroups.com.