Ticket #3963: trac_3963.patch
| File trac_3963.patch, 1.0 kB (added by mhansen, 4 months ago) |
|---|
-
a/sage/rings/rational.pyx
old new 426 426 return "-\\frac{%s}{%s}"%(-self.numer(), self.denom()) 427 427 else: 428 428 return "\\frac{%s}{%s}"%(self.numer(), self.denom()) 429 430 def _sympy_(self): 431 """ 432 Convert Sage Rational to SymPy Rational. 433 434 EXAMPLES: 435 sage: n = 1/2; n._sympy_() 436 1/2 437 sage: n = -1/5; n._sympy_() 438 -1/5 439 sage: from sympy import Symbol 440 sage: QQ(1)+Symbol('x')*QQ(2) 441 2*x + 1 442 443 """ 444 import sympy 445 return sympy.Rational(int(self.numerator()), int(self.denominator())) 446 429 447 430 448 def _mathml_(self): 431 449 """