On Feb 2, 3:06 pm, Nicolas <[email protected]> wrote:
> Here is some to-my-opinion strange behaviour of trig_expand :
>
> #Declare real variables
> var('a b c')
> assume([a,'real'],[b,'real'],[c,'real'])
> assumptions()
> ---> [a is real, b is real, c is real]
>
> #Case 1
> sin(a+b).trig_expand()
> ---> sin(a)*cos(b) + sin(b)*cos(a)
>
> #Case 2
> sin((a+b)/2).trig_expand()
> ---> sin(1/2*a)*cos(1/2*b) + sin(1/2*b)*cos(1/2*a)
>
> #Case 3
> sin((a+b)/c).trig_expand()
> ---> sin((a + b)/c)
>
> #Case 4
> sin((a/c+b/c)).trig_expand()
>
> ________
> In case 3, the expansion is not done. I wonder if it would be possible
> to do it. Obviously, if the sine argument was rational expanded before
> trig expansion, it would work but none seem to work on the whole
> expression.
>
> Any idea ?
>
> PS: I am actually using this in an expression where doing this
> expansion would simplify a lot and I would have expected simplify_full
> to see it... which it does not, I suspect because of this.
> ---> sin(a/c)*cos(b/c) + sin(b/c)*cos(a/c)

Sage will expand (x+y)/2 into x/2 + y/2, so trig_expand does what you
expect. But it leaves (x+y)/a as (x+y)/a, so trig_expand does not
change it.

sage: sin((x+y)/2)
sin(1/2*x + 1/2*y)
sage: sin((x+y)/2).trig_expand()
sin(1/2*x)*cos(1/2*y) + sin(1/2*y)*cos(1/2*x)
sage: sin((x+y)/a)
sin((x + y)/a)
sage: sin((x+y)/a).trig_expand()
sin((x + y)/a)

I don't know how to change sin((x+y)/a) to sin(x/a + y/a) in Sage,
maybe someone else can help you with that.

HTH, Andrej

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

Reply via email to