Undo trigexpand of complex arguments ??
- Subject: Undo trigexpand of complex arguments ??
- From: Aleksas Domarkas
- Date: Mon, 25 Nov 2013 23:00:24 +0200
On Mon, Nov 25, 2013 at 9:58 AM, Henry Baker <hbaker1 at
pipeline.com<http://www.math.utexas.edu/mailman/listinfo/maxima>>
wrote:
>What is the antidote for trigexpand with complex arguments?
>
>trigreduce doesn't seem to work here.
>
>Maxima 5.28.0-2 http://maxima.sourceforge.net
>using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
>Distributed under the GNU Public License. See the file COPYING.
>Dedicated to the memory of William Schelter.
>The function bug_report() provides bug reporting information.
>(%i1) cos(p+q*%i);
>(%o1) cos(%i q + p)
>(%i2) trigexpand(%);
>(%o2) cos(p) cosh(q) - %i sin(p) sinh(q)
>(%i3) trigreduce(%);
>(%o3) cos(p) cosh(q) - %i sin(p) sinh(q)
>(%i4)
I define
(%i1) trigcomb(r):=block([x,i,sinv,cosv,mi,mii,%iargs:false],
mi(x):=%i*x,
mii(x):=-%i*x,
load(to_poly_solve),
sinv:compose_functions([mii,sin,mi]),
tanv:compose_functions([mii,tan,mi]),
cosv:compose_functions([cos,mi]),
cotv:compose_functions([mi,cot,mi]),
subst([sinh=sinv,cosh=cosv,tanh=tanv,coth=cotv],r),
subst(%i=i,%%),
trigrat(%%),
trigreduce(%%),
subst(i=%i,%%)
)$
Examples:
1.
(%i2) cos(p+q*%i);
(%o2) cos(%i*q+p)
(%i3) trigexpand(%);
(%o3) cos(p)*cosh(q)-%i*sin(p)*sinh(q)
(%i4) trigcomb(%);
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
(%o4) cos(%i*q+p)
2.
(%i5) sin(a+b*%i);
(%o5) sin(%i*b+a)
(%i6) trigexpand(%);
(%o6) %i*cos(a)*sinh(b)+sin(a)*cosh(b)
(%i7) trigcomb(%);
(%o7) sin(%i*b+a)
3.
(%i8) cos(a*%i+b*%i);
(%o8) cos(%i*b+%i*a)
(%i9) trigexpand(%);
(%o9) sinh(a)*sinh(b)+cosh(a)*cosh(b)
(%i10) trigcomb(%);
(%o10) cos(%i*b+%i*a)
4.
(%i11) tan(a+%i*b);
(%o11) tan(%i*b+a)
(%i12) trigexpand(%);
(%o12) (%i*tanh(b)+tan(a))/(1-%i*tan(a)*tanh(b))
(%i13) trigcomb(%);
(%o13) tan(%i*b+a)
5.
(%i14) cot(x+%i*y);
(%o14) cot(%i*y+x)
(%i15) trigexpand(%);
(%o15) (-%i*cot(x)*coth(y)-1)/(cot(x)-%i*coth(y))
(%i16) trigcomb(%);
(%o16) cot(%i*y+x)
best
Aleksas D