Ah, I forgot that if factor is not a number, it won't distribute
automatically. You'll want to do something like

n, d = expr.as_numer_denom()
expand(n*factor)/expand(d*factor)

The way it is now, factor just immediately cancels.

And by the way, if your goal is to write a rational function in
reduced terms, you can use cancel() or factor() (the latter will also
factor the numerator and denominator).

Aaron Meurer


On Thu, Nov 17, 2016 at 8:23 AM, Scott Calabrese Barton
<koo...@gmail.com> wrote:
> Unfortunately that image will not render.  Here's a link to it:
> https://goo.gl/J1wn0P
>
> On Thursday, November 17, 2016 at 8:17:33 AM UTC-5, Scott Calabrese Barton
> wrote:
>>
>> Aaron, thanks, that's definitely the right idea, but doesn't work,
>> probably because of simplification. Here's an example:
>>>
>>>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/2d2bbab6-ed5c-4a9a-957f-51986b4f40e8%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6L_worPu7j1L9qVnji2Es3ZuHRZ1uZZcJfSjwjSYb20_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to