TRIGSIMP.TEX 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. \documentstyle[11pt,reduce]{article}
  2. \title{{\tt TRIGSIMP}\\
  3. A REDUCE Package for the Simplification and Factorization of Trigonometric
  4. and Hyperbolic Functions}
  5. \date{}
  6. \author{Wolfram Koepf\\
  7. Andreas Bernig\\
  8. Herbert Melenk\\
  9. ZIB Berlin \\
  10. email: {\tt Koepf@ZIB-Berlin.de}}
  11. \begin{document}
  12. \maketitle
  13. \section{Introduction}
  14. The REDUCE package TRIGSIMP is a useful tool for all kinds of trigonometric and
  15. hyperbolic simplification and factorization. There are three
  16. procedures included in TRIGSIMP: trigsimp, trigfactorize and triggcd.
  17. The first is for finding simplifications of trigonometric or
  18. hyperbolic expressions with many options, the second for factorizing
  19. them and the third
  20. for finding the greatest common divisor of two trigonometric or
  21. hyperbolic polynomials.
  22. To start the package it must be loaded by:
  23. {\small
  24. \begin{verbatim}
  25. 1: load trigsimp;
  26. \end{verbatim}
  27. }\noindent
  28. \section{\REDUCE{} operator {\tt trigsimp}}
  29. As there is no normal form for trigonometric and hyperbolic functions, the same
  30. function can convert in many different directions, e.g.
  31. $\sin(2x) \leftrightarrow 2\sin(x)\cos(x)$.
  32. The user has the possibility to give several parameters to the
  33. procedure {\tt trigsimp} in order to influence the direction of transformations.
  34. The decision whether a rational expression in trigonometric
  35. and hyperbolic functions vanishes or not is possible.
  36. To simplify a function {\tt f}, one uses {\tt trigsimp(f[,options])}. Example:
  37. {\small
  38. \begin{verbatim}
  39. 2: trigsimp(sin(x)^2+cos(x)^2);
  40. 1
  41. \end{verbatim}
  42. }\noindent
  43. Possible options are (* denotes the default):
  44. \begin{enumerate}
  45. \item {\tt sin} (*) or {\tt cos}
  46. \item {\tt sinh} (*) or {\tt cosh}
  47. \item {\tt expand} (*) or {\tt combine} or {\tt compact}
  48. \item {\tt hyp} or {\tt trig} or {\tt expon}
  49. \item {\tt keepalltrig}
  50. \end{enumerate}
  51. From each group one can use at most one option, otherwise an error
  52. message will occur. The first group fixes the preference used while
  53. transforming a trigonometric expression:
  54. {\small
  55. \begin{verbatim}
  56. 3: trigsimp(sin(x)^2);
  57. 2
  58. sin(x)
  59. 4: trigsimp(sin(x)^2,cos);
  60. 2
  61. - cos(x) + 1
  62. \end{verbatim}
  63. }\noindent
  64. The second group is the equivalent for the hyperbolic functions.
  65. The third group determines the type of transformations. With
  66. the default {\tt expand}, an expression is written in a form only using
  67. single arguments and no sums of arguments:
  68. {\small
  69. \begin{verbatim}
  70. 5: trigsimp(sin(2x+y));
  71. 2
  72. 2*cos(x)*cos(y)*sin(x) - 2*sin(x) *sin(y) + sin(y)
  73. \end{verbatim}
  74. }\noindent
  75. With {\tt combine}, products of trigonometric functions are transformed to
  76. trigonometric functions involving sums of arguments:
  77. {\small
  78. \begin{verbatim}
  79. 6: trigsimp(sin(x)*cos(y),combine);
  80. sin(x - y) + sin(x + y)
  81. -------------------------
  82. 2
  83. \end{verbatim}
  84. }\noindent
  85. With {\tt compact}, the REDUCE operator {\tt compact} \cite{hearns}
  86. is applied to {\tt f}.
  87. This leads often to a simple form, but in contrast to {\tt expand} one
  88. doesn't get a normal form. Example for {\tt compact}:
  89. {\small
  90. \begin{verbatim}
  91. 7: trigsimp((1-sin(x)**2)**20*(1-cos(x)**2)**20,compact);
  92. 40 40
  93. cos(x) *sin(x)
  94. \end{verbatim}
  95. }\noindent
  96. With the fourth group each expression is transformed to a
  97. trigonometric, hyperbolic or exponential form:
  98. {\small
  99. \begin{verbatim}
  100. 8: trigsimp(sin(x),hyp);
  101. - sinh(i*x)*i
  102. 9: trigsimp(sinh(x),expon);
  103. 2*x
  104. e - 1
  105. ----------
  106. x
  107. 2*e
  108. 10: trigsimp(e^x,trig);
  109. x x
  110. cos(---) + sin(---)*i
  111. i i
  112. \end{verbatim}
  113. }\noindent
  114. Usually, {\tt tan}, {\tt cot}, {\tt sec}, {\tt csc} are expressed in terms of
  115. {\tt sin} and {\tt cos}. It can
  116. be sometimes useful to avoid this, which is handled by the option
  117. {\tt keepalltrig}:
  118. {\small
  119. \begin{verbatim}
  120. 11: trigsimp(tan(x+y),keepalltrig);
  121. - (tan(x) + tan(y))
  122. ----------------------
  123. tan(x)*tan(y) - 1
  124. \end{verbatim}
  125. }\noindent
  126. It is possible to use the options of different groups simultaneously:
  127. {\small
  128. \begin{verbatim}
  129. 12: trigsimp(sin(x)**4,cos,combine);
  130. cos(4*x) - 4*cos(2*x) + 3
  131. ---------------------------
  132. 8
  133. \end{verbatim}
  134. }\noindent
  135. Sometimes, it is necessary to handle an expression in different steps:
  136. {\small
  137. \begin{verbatim}
  138. 13: trigsimp((sinh(x)+cosh(x))**n+(cosh(x)-sinh(x))**n,expon);
  139. 2*n*x
  140. e + 1
  141. ------------
  142. n*x
  143. e
  144. 14: trigsimp(ws,hyp);
  145. 2*cosh(n*x)
  146. 15: trigsimp((cosh(a*n)*sinh(a)*sinh(p)+cosh(a)*sinh(a*n)*sinh(p)+
  147. sinh(a - p)*sinh(a*n))/sinh(a));
  148. cosh(a*n)*sinh(p) + cosh(p)*sinh(a*n)
  149. 16: trigsimp(ws,combine);
  150. sinh(a*n + p)
  151. \end{verbatim}
  152. }\noindent
  153. \section{\REDUCE{} operator {\tt trigfactorize}}
  154. With {\tt trigfactorize(p,x)} one can factorize the trigonometric or
  155. hyperbolic polynomial {\tt p} with respect to the argument x. Example:
  156. {\small
  157. \begin{verbatim}
  158. 17: trigfactorize(sin(x),x/2);
  159. x x
  160. {2,cos(---),sin(---)}
  161. 2 2
  162. \end{verbatim}
  163. }\noindent
  164. If the polynomial is not coordinated or balanced \cite{art},
  165. the output will equal the input.
  166. In this case, changing the value for x can help to find a factorization:
  167. {\small
  168. \begin{verbatim}
  169. 18: trigfactorize(1+cos(x),x);
  170. {cos(x) + 1}
  171. 19: trigfactorize(1+cos(x),x/2);
  172. x x
  173. {2,cos(---),cos(---)}
  174. 2 2
  175. \end{verbatim}
  176. }\noindent
  177. The polynomial can consist of both trigonometric and hyperbolic functions:
  178. {\small
  179. \begin{verbatim}
  180. 20: trigfactorize(sin(2x)*sinh(2x),x);
  181. {4, cos(x), sin(x), cosh(x), sinh(x)}
  182. \end{verbatim}
  183. }\noindent
  184. \section{\REDUCE{} operator {\tt triggcd}}
  185. The operator {\tt triggcd} is an application of {\tt trigfactorize}.
  186. With its help the user can find the greatest common divisor of two
  187. trigonometric or hyperbolic polynomials. It uses the method described
  188. in \cite{art}. The syntax is: {\tt triggcd(p,q,x)}, where p and q
  189. are the polynomials and x is the smallest unit to use. Example:
  190. {\small
  191. \begin{verbatim}
  192. 21: triggcd(sin(x),1+cos(x),x/2);
  193. x
  194. cos(---)
  195. 2
  196. 22: triggcd(sin(x),1+cos(x),x);
  197. 1
  198. \end{verbatim}
  199. }\noindent
  200. The polynomials p and q can consist of both trigonometric and hyperbolic
  201. functions:
  202. {\small
  203. \begin{verbatim}
  204. 23: triggcd(sin(2x)*sinh(2x),(1-cos(2x))*(1+cosh(2x)),x);
  205. cosh(x)*sin(x)
  206. \end{verbatim}
  207. }\noindent
  208. \section{Further Examples}
  209. With the help of the package the user can create identities:
  210. {\small
  211. \begin{verbatim}
  212. 24: trigsimp(tan(x)*tan(y));
  213. sin(x)*sin(y)
  214. ---------------
  215. cos(x)*cos(y)
  216. 25: trigsimp(ws,combine);
  217. cos(x - y) - cos(x + y)
  218. -------------------------
  219. cos(x - y) + cos(x + y)
  220. 26: trigsimp((sin(x-a)+sin(x+a))/(cos(x-a)+cos(x+a)));
  221. sin(x)
  222. --------
  223. cos(x)
  224. 27: trigsimp(cosh(n*acosh(x))-cos(n*acos(x)),trig);
  225. 0
  226. 28: trigsimp(sec(a-b),keepalltrig);
  227. csc(a)*csc(b)*sec(a)*sec(b)
  228. -------------------------------
  229. csc(a)*csc(b) + sec(a)*sec(b)
  230. 29: trigsimp(tan(a+b),keepalltrig);
  231. - (tan(a) + tan(b))
  232. ----------------------
  233. tan(a)*tan(b) - 1
  234. 30: trigsimp(ws,keepalltrig,combine);
  235. tan(a + b)
  236. \end{verbatim}
  237. }\noindent
  238. Some difficult expressions can be simplified:
  239. {\small
  240. \begin{verbatim}
  241. 31: df(sqrt(1+cos(x)),x,4);
  242. 4 2 2 2
  243. (sqrt(cos(x) + 1)*( - 4*cos(x) - 20*cos(x) *sin(x) + 12*cos(x)
  244. 2 4 2
  245. - 4*cos(x)*sin(x) + 8*cos(x) - 15*sin(x) + 16*sin(x) ))/(16
  246. 4 3 2
  247. *(cos(x) + 4*cos(x) + 6*cos(x) + 4*cos(x) + 1))
  248. 32: trigsimp(ws);
  249. sqrt(cos(x) + 1)
  250. ------------------
  251. 16
  252. 33: load taylor;
  253. 34: taylor(sin(x+a)*cos(x+b),x,0,4);
  254. cos(b)*sin(a) + (cos(a)*cos(b) - sin(a)*sin(b))*x
  255. 2
  256. - (cos(a)*sin(b) + cos(b)*sin(a))*x
  257. 2*( - cos(a)*cos(b) + sin(a)*sin(b)) 3
  258. + --------------------------------------*x
  259. 3
  260. cos(a)*sin(b) + cos(b)*sin(a) 4 5
  261. + -------------------------------*x + O(x )
  262. 3
  263. 35: trigsimp(ws,combine);
  264. sin(a - b) + sin(a + b) 2 2*cos(a + b) 3
  265. ------------------------- + cos(a + b)*x - sin(a + b)*x - --------------*x
  266. 2 3
  267. sin(a + b) 4 5
  268. + ------------*x + O(x )
  269. 3
  270. \end{verbatim}
  271. }\noindent
  272. Certain integrals whose calculation was not possible in REDUCE
  273. (without preprocessing), are now computable:
  274. {\small
  275. \begin{verbatim}
  276. 36: int(trigsimp(sin(x+y)*cos(x-y)*tan(x)),x);
  277. 2 2
  278. cos(x) *x - cos(x)*sin(x) - 2*cos(y)*log(cos(x))*sin(y) + sin(x) *x
  279. ---------------------------------------------------------------------
  280. 2
  281. 37: int(trigsimp(sin(x+y)*cos(x-y)/tan(x)),x);
  282. x 2
  283. (cos(x)*sin(x) - 2*cos(y)*log(tan(---) + 1)*sin(y)
  284. 2
  285. x
  286. + 2*cos(y)*log(tan(---))*sin(y) + x)/2
  287. 2
  288. \end{verbatim}
  289. }\noindent
  290. Without the package, the integration fails, in the second case one doesn't
  291. receive an answer for many hours.
  292. {\small
  293. \begin{verbatim}
  294. 38: trigfactorize(sin(2x)*cos(y)**2,y/2);
  295. {2*cos(x)*sin(x),
  296. y y
  297. cos(---) + sin(---),
  298. 2 2
  299. y y
  300. cos(---) + sin(---),
  301. 2 2
  302. y y
  303. cos(---) - sin(---),
  304. 2 2
  305. y y
  306. cos(---) - sin(---)}
  307. 2 2
  308. 39: trigfactorize(sin(y)**4-x**2,y);
  309. 2 2
  310. { - sin(y) + x, - (sin(y) + x)}
  311. 40: trigfactorize(sin(x)*sinh(x),x/2);
  312. x x x x
  313. {4,cos(---),sin(---),cosh(---),sinh(---)}
  314. 2 2 2 2
  315. 41: triggcd(-5+cos(2x)-6sin(x),-7+cos(2x)-8sin(x),x/2);
  316. x x
  317. 2*cos(---)*sin(---) + 1
  318. 2 2
  319. 42: triggcd(1-2cosh(x)+cosh(2x),1+2cosh(x)+cosh(2x),x/2);
  320. x 2
  321. 2*sinh(---) + 1
  322. 2
  323. \end{verbatim}
  324. }
  325. \begin{thebibliography}{99}
  326. \bibitem{art}
  327. Roach, Kelly: Difficulties with Trigonometrics. Notes of a talk.
  328. \bibitem{hearns}
  329. Hearn, A.C.: COMPACT User Manual.
  330. \end{thebibliography}
  331. \end{document}