Wow, this is incredible and quite low-level! I was looking for this some 
time ago and did not find any documentation either, but had no time to post 
the question.


On Wednesday, May 18, 2016 at 6:15:31 PM UTC-5, Aaron Meurer wrote:
>
> For 8 + 8/(1+p), apart() will give this form. 
>
> In general, it likely depends on the expression which function will do 
> this. You can use the count method to count how many times a variable 
> appears in an expression 
>
> In [65]: (8 + 8/(1+x)).count(x) 
> Out[65]: 1 
>
> In [66]: (8*(x + 3)/(x + 2)).count(x) 
> Out[66]: 2 
>
> You could use the measure option to simplify to tell it to minimize this: 
>
> In [67]: simplify(8 + 8/(1+x), measure=lambda i: i.count(x)) 
> Out[67]: 
>       8 
> 8 + ───── 
>     x + 1 
>
> You could also write your own function that tries various functions 
> and returns the result with the fewest occurrences of the variables. 
>
> Aaron Meurer 
>
>
> On Wed, May 18, 2016 at 5:49 PM, Timothy Wright <[email protected] 
> <javascript:>> wrote: 
> > Hi 
> > 
> > I am using factor() to reduce the equation '8 + 8/(1+p)' 
> > 
> > I get 8*(p + 3)/(p + 2) because factor() must return a product.  But I 
> want 
> > a reduction that minimizes the number of each variable in the equation. 
>  In 
> > this case, my input referenced p once, running factor gives me a product 
> > that has two references to p. 
> > 
> > I need to generalize this to very long equations with 5 independent 
> > variables.  I am replacing the use of mathematica with sympy, 
> mathematica 
> > seems to be able to reduce the equation in this way 
> > 
> > I have looked at cancel(), simplify(), apart(), expand(), all don't do 
> what 
> > I want. 
> > 
> > After reviewing the email history, I don't think this can be done out of 
> the 
> > box.  But there could be a way to write my own reducer to do this? 
> > 
> > Is this correct?  I want to check if I am on the right path. 
> > 
> > Thanks 
> > 
> > Tim 
> > 
> > -- 
> > 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 [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > 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/43f8ff85-9b85-43ad-942b-90722d86a506%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 [email protected].
To post to this group, send email to [email protected].
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/7e4d98e1-de0c-4265-9036-e7ecba475d9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to