Previous Up Next

9.4.1  Expanding transcendental and trigonometric expressions

The texpand or tExpand command expands exponential and trigonometric functions, like simultaneous calling textttexpexpand (see Section 9.3.2), which, for example, expands enx as (ex)n, lnexpand (see Section 9.3.3), which, for example, expands ln(xn) as nln(x), and trigexpand (see Section 9.2.1), which, for example, expands sin(2x) as 2sin(x)cos(x).

Examples

Expand cos(x+y).

texpand(cos(x+y))
     
cosx cosy−sinx siny           

Expand cos(3x).

texpand(cos(3*x))
     
4 cos3x−3 cosx           

Expand sin(3x)+sin(7x)/sin(5x).

texpand((sin(3*x)+sin(7*x))/sin(5*x))
     
−
2 sinx
⎛
⎝
16 cos4x−12 cos2x+1⎞
⎠
sinx
+
28 sinx cos2x
⎛
⎝
16 cos4x−12 cos2x+1⎞
⎠
sinx
−
          
80 sinx cos4x
⎛
⎝
16 cos4x− 12 cos2x+1⎞
⎠
sinx
+ 
64 sinx cos6x
⎛
⎝
16 cos4x−12 cos2x+1⎞
⎠
sinx
          
normal(ans())
     
4 cos2x−2           

Expand ex+y.

texpand(exp(x+y))
     
ex ey           

Expand ln(x y).

texpand(log(x*y))
     
lny+lnx           

Expand ln(xn).

texpand(ln(x^n))
     
n lnx           

Expand ln((e2)+e2ln(2)+eln(3)+ln(2)).

texpand(log(e^2)+exp(2*log(2))+exp(log(3)+log(2)))
     
6+2· 3           

or:

texpand(log(e^2)+exp(2*log(2)))+ lncollect(exp(log(3)+log(2)))
     
12           

Expand ex+y+cos(x+y)+ln(3x2).

texpand(exp(x+y)+cos(x+y)+ln(3*x^2))
     
cosx cosy−sinx siny+ex ey+ln⎛
⎝
3⎞
⎠
+2 ln⎪
⎪
x⎪
⎪
          

Previous Up Next