Here is one way to derive that formula:
(%i26) expr: sin(p)+sin(q)$
(%i27) subs: [p=a+b,q=a-b]$
(%i28) subst(subs,expr);
(%o28) sin(b+a)-sin(b-a)
(%i29) trigexpand(%);
(%o29) 2*sin(a)*cos(b)
(%i30) solve(subs,[a,b]);
(%o30) [[a = (q+p)/2,b = (p-q)/2]]
(%i31) subst(%o30[1],%o29);
(%o31) 2*cos((p-q)/2)*sin((q+p)/2)
Another way to derive it:
(%i52) sin(q)+sin(p) = k*sin(x)*cos(y)$
(%i53) trigreduce(%);
(%o53) sin(q)+sin(p) = k*sin(y+x)/2-k*sin(y-x)/2
If k=2, q=x+y, and p=y-x, this is an identity.
If you want to substitute 2*sin((p+q)/2)*cos((p-q)/2) for every literal
occurence of sin(p)+sin(q) , you can use
ratsubst( 2*sin((p+q)/2)*cos((p-q)/2) , sin(p)+sin(q), ... )
If you intend 'p' and 'q' to be arbitrary expressions, that's a bit harder
--- you'll have to read up about pattern matching, and also determine what
you want to do in cases like sin(x)+sin(w)+sin(z).
-s
On Thu, Dec 1, 2011 at 12:07, Jos Simons <simons17 at xs4all.nl> wrote:
> How can Maxima the trigonometric form sin(p)+sin(q) transform into
> 2*sin((p+q)/2)*cos((p-q)/2).****
>
> ** **
>
> Thanking you in advance for your answer,****
>
> ** **
>
> ** **
>
> Dr. Joseph Simons****
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>