> Would your routine help any for the expression in issue 1562?
> simplify() doesn't do anything to it because Poly.cancel() doesn't
> cancel the sin and cos terms.  The same for factor.
>

I'm happy to report that factor is able to do the heavy lifting after
you polify the expression you asked about in issue 1562:

>>> x=var('x')
>>> eq=8*x**15*cos(x)**6*sin(x)**21/(-2*x**15*cos(x)**2*sin(x)**21 - 
>>> x**15*sin(x)**23) + 
>>> 20*x**15*cos(x)**4*sin(x)**23/(-2*x**15*cos(x)**2*sin(x)**21 - 
>>> x**15*sin(x)**23) + 
>>> 16*x**15*cos(x)**2*sin(x)**25/(-2*x**15*cos(x)**2*sin(x)**21 - 
>>> x**15*sin(x)**23) + 4*x**15*sin(x)**27/(-2*x**15*cos(x)**2*sin(x)**21 - 
>>> x**15*sin(x)**23)
>>> repl,p=polify(eq)
>>> p
4*x**15*x1**27/(-2*x**15*x0**2*x1**21 - x**15*x1**23) +
8*x**15*x0**6*x1**21/(-2*x**15*x0**2*x1**21 - x**15*x1**23) +
16*x**15*x0**2*x1**25/(-2*x**15*x0**2*x1**21 - x**15*x1**23) +
20*x**15*x0**4*x1**23/(-2*x**15*x0**2*x1**21 - x**15*x1**23)
>>> n,d=p.as_numer_denom() #it's rational and factor won't work with that but...
>>> factor(n)/factor(d)
-4*(x0**2 + x1**2)**2
>>> _.subs(r)
-4*(cos(x)**2 + sin(x)**2)**2
>>> trigsimp(_)
-4

The routine I've got just completely reduces the expression to symbols
with numerical coefficients and integer powers. I'm not sure where to
work this routine in. Perhaps it should go into the cse section since
it can (but doesn't right now) use cse to get close to the desired
expression and then just do clean up. It could also go into polys
module. It's more like the cse routine in that it gives you an
expression (that is more polynomial-like than cse) but it also gives
you the replacements that you have to carry around. I'm open to some
discussion.

/c
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to