On Mar 28, 3:57 pm, Alan Bromborsky <abro...@verizon.net> wrote:
> Vinzent Steinberg wrote:
> > On Mar 27, 4:55 pm, Ondrej Certik <ond...@certik.cz> wrote:
>
> >> On Fri, Mar 27, 2009 at 8:34 AM, Vinzent Steinberg
>
> >> <vinzent.steinb...@googlemail.com> wrote:
>
> >>> This is strange, because just constructing such an expression triggers
> >>> this trivial simplification:
>
> >>>>>> (cos(x)**3)**(2/3)*cos(y)**2 - (cos(x)**3)**(5/3)*cos(y)**2 + \
>
> >>> ... 3*cos(x)**3*cos(y)**2 + cos(x)**2*cos(y)**2*tan(x)**2 + \
> >>> ... cos(x)**5*cos(y)**2*tan(x)**4
> >>> cos(y)**2 + 2*cos(x)**3*cos(y)**2 + cos(x)**2*cos(y)**2*tan(x)**2 + cos
> >>> (x)**5*cos(y)**2*tan(x)**4
>
> >> What is strange on this?
>
> >> O.
>
> > That it doesn't simplify for Alan:
>
> > Alan Bromborsky wrote:
>
> >> Here is a trigsimp problem, although the problem is not really in trigsimp.
>
> >> Run this code:
>
> >> from sympy import *
> >> x = Symbol('x')
> >> y = Symbol('y')
> >> s = sin(x)
> >> c = cos(x)
> >> S = sin(y)
> >> C = cos(y)
> >> e = (1-S**2)*(1+c)*(s**2+c**2)+C**2*(1-s**2)*c**3+C**2*(1-c**2)*c**3
> >> e = expand(e)
> >> print e
> >> print trigsimp(e,deep=True,recursive=True)
>
> >> and get:
>
> >> sin(x)**2*cos(x) - sin(x)**2*sin(y)**2*cos(x) + cos(x)**2 + sin(x)**2 -
> >> cos(x)**2*sin(y)**2 -
> >>      cos(x)**3*sin(y)**2 - cos(x)**5*cos(y)**2 - sin(x)**2*sin(y)**2 +
> >> 2*cos(x)**3*cos(y)**2 -
> >>      cos(x)**3*cos(y)**2*sin(x)**2 + cos(x)**3
>
> >> (cos(x)**3)**(2/3)*cos(y)**2 - (cos(x)**3)**(5/3)*cos(y)**2 +
> >> 3*cos(x)**3*cos(y)**2 +
> >>      cos(x)**2*cos(y)**2*tan(x)**2 + cos(x)**5*cos(y)**2*tan(x)**4
>
> >> The problem is expressions of the form: (cos(x)**3)**(5/3)
> >> which probably prevent trigsimp from further simplification.  Is their
> >> any simple way to insure3
> >> that (cos(x)**3)**(5/3) would be replaced by cos(x)**5!
>
> > Vinzent
>
> If you modify trigsimp here is another problem.  For this code:
>
> from sympy import *
> x = Symbol('x')
> y = Symbol('y')
> e = cos(x)*tan(x)
> print e
> print trigsimp(e)
>
> The result is:
>
> cos(x)*tan(x)
> cos(x)*tan(x)
>
> Maybe there should be an option in trigsimp "not" to replace
> sin(x)/cos(x) with tan(x) and cos(x)/sin(x)
> with cot(x) ?  *Actually the option should be to replace tan(x) with
> sin(x)/cos(x) and cot(x) with
> cos(x)/sin(x) before simplifying.*

trigsimp could try both variants and see which one is shorter.

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

Reply via email to