On Oct 29, 11:23 pm, Jason Grout <[email protected]> wrote:
> I'm working with someone in a college algebra.  They were temporarily
> confused when they typed:
>
> 2/(x+2)
>
> and the worksheet printed back out (in Typeset mode) the equivalent of:
>
> 2 (1/(x+2))
>
> Is there a reason the 2 was pulled off the top of the fraction?  Does it
> have to be?

Looks like a Pynac thing.  Check out
sage: a=2/(x+2)
sage: a.operands()
sage: a.operands()[0].operands()
sage: a.operands()[0].operator()
So Pynac treats fractions fundamentally as negative powers, not as
division.
sage: b = 2*(x+2)^-1
sage: bool(b==a)
True
Here you would want the typesetting to have the 2 out front, right?

This doesn't suggest a solution, just diagnoses the issue.  I'm not
sure whether there would be a consistent way to do this.  Note,
however, that
sage: latex(1/(2*(x+2)))
also pulls the 2 out, so you get 1/2 "out front".

- kcrisman
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to