LINALG.TEX 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359
  1. \documentstyle[11pt,reduce,fancyheadings]{article}
  2. \title{A Linear Algebra package for \REDUCE{}}
  3. \author{Matt Rebbeck \\
  4. Konrad-Zuse-Zentrum f\"ur Informationstechnik Berlin}
  5. \date{July 1994}
  6. \def\foottitle{The Linear Algebra Package}
  7. \pagestyle{fancy}
  8. \lhead[]{{\footnotesize\leftmark}{}}
  9. \rhead[]{\thepage}
  10. \setlength{\headrulewidth}{0.6pt}
  11. \setlength{\footrulewidth}{0.6pt}
  12. \cfoot{}
  13. \rfoot{\small\foottitle}
  14. %decided against using these.
  15. %\def\ltri{$\triangleleft$}
  16. %\def\rtri{$\triangleright$}
  17. %\newcommand{\tribound}[1]{\rtri#1\ltri}
  18. \def\exprlist {expr$_{1}$,expr$_{2}$, \ldots ,expr$_{{\tt n}}$}
  19. \def\lineqlist {lin\_eqn$_{1}$,lin\_eqn$_{2}$, \ldots ,lin\_eqn$_{n}$}
  20. \def\matlist {mat$_{1}$,mat$_{2}$, \ldots ,mat$_{n}$}
  21. \def\veclist {vec$_{1}$,vec$_{2}$, \ldots ,vec$_{n}$}
  22. \def\lazyfootnote{\footnote{If you're feeling lazy then the \{\}'s can
  23. be omitted.}}
  24. \renewcommand{\thefootnote}{\fnsymbol{footnote}}
  25. \begin{document}
  26. \maketitle
  27. \index{Linear Algebra package}
  28. \section{Introduction}
  29. This package provides a selection of functions that are useful
  30. in the world of linear algebra. These functions are described
  31. alphabetically in section 3 of this document and are labelled 3.1 to
  32. 3.51. They can be classified into four sections(n.b: the numbers after
  33. the dots signify the function label in section 3).
  34. \subsection{Basic matrix handling}
  35. \begin{center}
  36. \begin{tabular}{l l l l l l}
  37. add\_columns & \ldots & 3.1 &
  38. add\_rows & \ldots & 3.2 \\
  39. add\_to\_columns & \ldots & 3.3 &
  40. add\_to\_rows & \ldots & 3.4 \\
  41. augment\_columns & \ldots & 3.5 &
  42. char\_poly & \ldots & 3.9 \\
  43. column\_dim & \ldots & 3.12 &
  44. copy\_into & \ldots & 3.14 \\
  45. diagonal & \ldots & 3.15 &
  46. extend & \ldots & 3.16 \\
  47. find\_companion & \ldots & 3.17 &
  48. get\_columns & \ldots & 3.18 \\
  49. get\_rows & \ldots & 3.19 &
  50. hermitian\_tp & \ldots & 3.21 \\
  51. matrix\_augment & \ldots & 3.28 &
  52. matrix\_stack & \ldots & 3.30 \\
  53. minor & \ldots & 3.31 &
  54. mult\_columns & \ldots & 3.32 \\
  55. mult\_rows & \ldots & 3.33 &
  56. pivot & \ldots & 3.34 \\
  57. remove\_columns & \ldots & 3.37 &
  58. remove\_rows & \ldots & 3.38 \\
  59. row\_dim & \ldots & 3.39 &
  60. rows\_pivot & \ldots & 3.40 \\
  61. stack\_rows & \ldots & 3.43 &
  62. sub\_matrix & \ldots & 3.44 \\
  63. swap\_columns & \ldots & 3.46 &
  64. swap\_entries & \ldots & 3.47 \\
  65. swap\_rows & \ldots & 3.48 &
  66. \end{tabular}
  67. \end{center}
  68. \subsection{Constructors}
  69. Functions that create matrices.
  70. \begin{center}
  71. \begin{tabular}{l l l l l l}
  72. band\_matrix & \ldots & 3. 6 &
  73. block\_matrix & \ldots & 3. 7 \\
  74. char\_matrix & \ldots & 3. 8 &
  75. coeff\_matrix & \ldots & 3. 11 \\
  76. companion & \ldots & 3. 13 &
  77. hessian & \ldots & 3. 22 \\
  78. hilbert & \ldots & 3. 23 &
  79. jacobian & \ldots & 3. 24 \\
  80. jordan\_block & \ldots & 3. 25 &
  81. make\_identity & \ldots & 3. 27 \\
  82. random\_matrix & \ldots & 3. 36 &
  83. toeplitz & \ldots & 3. 50 \\
  84. Vandermonde & \ldots & 3. 51 &
  85. Kronecker\_Product & \ldots & 3. 52
  86. \end{tabular}
  87. \end{center}
  88. \subsection{High level algorithms}
  89. \begin{center}
  90. \begin{tabular}{l l l l l l}
  91. char\_poly & \ldots & 3.9 &
  92. cholesky & \ldots & 3.10 \\
  93. gram\_schmidt & \ldots & 3.20 &
  94. lu\_decom & \ldots & 3.26 \\
  95. pseudo\_inverse & \ldots & 3.35 &
  96. simplex & \ldots & 3.41 \\
  97. svd & \ldots & 3.45 &
  98. \end{tabular}
  99. \end{center}
  100. \vspace*{5mm}
  101. There is a separate {\small NORMFORM}[1] package for computing
  102. the following matrix normal forms in \REDUCE.
  103. \begin{center}
  104. smithex, smithex\_int, frobenius, ratjordan, jordansymbolic, jordan.
  105. \end{center}
  106. \subsection{Predicates}
  107. \begin{center}
  108. \begin{tabular}{l l l l l l}
  109. matrixp & \ldots & 3.29 &
  110. squarep & \ldots & 3.42 \\
  111. symmetricp & \ldots & 3.49 &
  112. \end{tabular}
  113. \end{center}
  114. \subsection*{Note on examples:}
  115. In the examples the matrix ${\cal A}$ will be
  116. \begin{flushleft}
  117. \begin{math}
  118. {\cal A} = \left( \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9
  119. \end{array} \right)
  120. \end{math}
  121. \end{flushleft}
  122. \subsection*{Notation}
  123. Throughout ${\cal I}$ is used to indicate the identity matrix and
  124. ${\cal A}^T$ to indicate the transpose of the matrix ${\cal A}$.
  125. \section{Getting started}
  126. If you have not used matrices within {\REDUCE} before then the
  127. following may be helpful.
  128. \subsection*{Creating matrices}
  129. Initialisation of matrices takes the following syntax:
  130. {\tt mat1 := mat((a,b,c),(d,e,f),(g,h,i));}
  131. will produce
  132. \begin{flushleft}
  133. \begin{math}
  134. mat1 := \left( \begin{array}{ccc} a & b & c \\ d & e & f \\ g & h & i
  135. \end{array} \right)
  136. \end{math}
  137. \end{flushleft}
  138. \subsection*{Getting at the entries}
  139. The (i,$\,$j)'th entry can be accessed by:
  140. {\tt mat1(i,j);}
  141. \subsection*{Loading the linear\_algebra package}
  142. The package is loaded by:
  143. {\tt load\_package linalg;}
  144. \section{What's available}
  145. \subsection{add\_columns, add\_rows}
  146. %{\bf How to use it:}
  147. \hspace*{0.175in} {\tt add\_columns(${\cal A}$,c1,c2,expr);}
  148. \hspace*{0.1in}
  149. \begin{tabular}{l l l}
  150. ${\cal A}$ & :- & a matrix. \\
  151. c1,c2 & :- & positive integers. \\
  152. expr & :- & a scalar expression.
  153. \end{tabular}
  154. {\bf Synopsis:} %{\bf What it does:}
  155. \begin{addtolength}{\leftskip}{0.22in}
  156. \parbox[t]{0.95\linewidth}{{\tt add\_columns} replaces column c2 of
  157. ${\cal A}$ by expr $*$ column(${\cal A}$,c1) $+$ column(${\cal A}$,c2).}
  158. {\tt add\_rows} performs the equivalent task on the rows of ${\cal A}$.
  159. \end{addtolength}
  160. {\bf Examples:}
  161. \begin{flushleft}
  162. \begin{math}
  163. \hspace*{0.16in}
  164. \begin{array}{ccc}
  165. {\tt add\_columns}({\cal A},1,2,x) & = &
  166. \left( \begin{array}{ccc} 1 & x+2 & 3 \\ 4 & 4*x+5 & 6 \\ 7 & 7*x+8 & 9
  167. \end{array} \right)
  168. \end{array}
  169. \end{math}
  170. \end{flushleft}
  171. \vspace*{0.1in}
  172. \begin{flushleft}
  173. \hspace*{0.1in}
  174. \begin{math}
  175. \begin{array}{ccc}
  176. {\tt add\_rows}({\cal A},2,3,5) & = &
  177. \left( \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 27 & 33 & 39
  178. \end{array} \right)
  179. \end{array}
  180. \end{math}
  181. \end{flushleft}
  182. {\bf Related functions:}
  183. \hspace*{0.175in} {\tt add\_to\_columns}, {\tt add\_to\_rows},
  184. {\tt mult\_columns}, {\tt mult\_rows}.
  185. \subsection{add\_rows}
  186. \hspace*{0.175in} see: {\tt add\_columns}.
  187. \subsection{add\_to\_columns, add\_to\_rows}
  188. %{\bf How to use it:}
  189. \hspace*{0.175in} {\tt add\_to\_columns(${\cal A}$,column\_list,expr);}
  190. \hspace*{0.1in}
  191. \begin{tabular}{l l l}
  192. ${\cal A}$ &:-& a matrix. \\
  193. column\_list &:-& a positive integer or a list of positive integers. \\
  194. expr &:-& a scalar expression.
  195. \end{tabular}
  196. {\bf Synopsis:} %{\bf What it does:}
  197. \begin{addtolength}{\leftskip}{0.22in}
  198. {\tt add\_to\_columns} adds expr to each column specified in
  199. column\_list of ${\cal A}$.
  200. {\tt add\_to\_rows} performs the equivalent task on the rows of
  201. ${\cal A}$.
  202. \end{addtolength}
  203. {\bf Examples:}
  204. \begin{flushleft}
  205. \hspace*{0.175in}
  206. \begin{math}
  207. \begin{array}{ccc}
  208. {\tt add\_to\_columns}({\cal A},\{1,2\},10) & = &
  209. \left( \begin{array}{ccc} 11 & 12 & 3 \\ 14 & 15 & 6 \\ 17 & 18 & 9
  210. \end{array} \right)
  211. \end{array}
  212. \end{math}
  213. \end{flushleft}
  214. \vspace*{0.1in}
  215. \begin{flushleft}
  216. \hspace*{0.175in}
  217. \begin{math}
  218. \begin{array}{ccc}
  219. {\tt add\_to\_rows}({\cal A},2,-x) & = &
  220. \left( \begin{array}{ccc} 1 & 2 & 3 \\ -x+4 & -x+5 & -x+6 \\ 7 & 8 & 9
  221. \end{array} \right)
  222. \end{array}
  223. \end{math}
  224. \end{flushleft}
  225. {\bf Related functions:}
  226. \hspace*{0.175in}
  227. {\tt add\_columns}, {\tt add\_rows}, {\tt mult\_rows},
  228. {\tt mult\_columns}.
  229. \subsection{add\_to\_rows}
  230. \hspace*{0.175in} see: {\tt add\_to\_columns}.
  231. \subsection{augment\_columns, stack\_rows}
  232. %{\bf How to use it:}
  233. \hspace*{0.175in} {\tt augment\_columns(${\cal A}$,column\_list);}
  234. \hspace*{0.1in}
  235. \begin{tabular}{l l l}
  236. ${\cal A}$ &:-& a matrix. \\
  237. column\_list &:-& either a positive integer or a list of positive
  238. integers.
  239. \end{tabular}
  240. {\bf Synopsis:} %{\bf What it does:}
  241. \begin{addtolength}{\leftskip}{0.22in}
  242. {\tt augment\_columns} gets hold of the columns of ${\cal A}$ specified
  243. in column\_list and sticks them together.
  244. {\tt stack\_rows} performs the same task on rows of
  245. ${\cal A}$.
  246. \end{addtolength}
  247. {\bf Examples:}
  248. \begin{flushleft}
  249. \hspace*{0.1in}
  250. \begin{math}
  251. \begin{array}{ccc}
  252. {\tt augment\_columns}({\cal A},\{1,2\}) & = &
  253. \left( \begin{array}{cc} 1 & 2 \\ 4 & 5 \\ 7 & 8
  254. \end{array} \right)
  255. \end{array}
  256. \end{math}
  257. \end{flushleft}
  258. \vspace*{0.1in}
  259. \begin{flushleft}
  260. \hspace*{0.1in}
  261. \begin{math}
  262. \begin{array}{ccc}
  263. {\tt stack\_rows}({\cal A},\{1,3\}) & = &
  264. \left( \begin{array}{ccc} 1 & 2 & 3 \\ 7 & 8 & 9
  265. \end{array} \right)
  266. \end{array}
  267. \end{math}
  268. \end{flushleft}
  269. {\bf Related functions:}
  270. \hspace*{0.175in} {\tt get\_columns}, {\tt get\_rows},
  271. {\tt sub\_matrix}.
  272. \subsection{band\_matrix}
  273. %{\bf How to use it:}
  274. \hspace*{0.175in} {\tt band\_matrix(expr\_list,square\_size);}
  275. \hspace*{0.1in}
  276. \begin{tabular}{l l l}
  277. expr\_list \hspace*{0.088in} &:-& \parbox[t]{.72\linewidth}
  278. {either a single scalar expression or a list of an odd number of scalar
  279. expressions.}
  280. \end{tabular}
  281. \vspace*{0.04in}
  282. \hspace*{0.1in}
  283. \begin{tabular}{l l l}
  284. square\_size &:-& a positive integer.
  285. \end{tabular}
  286. {\bf Synopsis:} %{\bf What it does:}
  287. \begin{addtolength}{\leftskip}{0.22in}
  288. {\tt band\_matrix} creates a square matrix of dimension
  289. square\_size. The diagonal consists of the middle expr
  290. of the expr\_list. The exprs to the left of this fill
  291. the required number of sub\_diagonals and the exprs
  292. to the right the super\_diagonals.
  293. \end{addtolength}
  294. {\bf Examples:}
  295. \begin{flushleft}
  296. \hspace*{0.1in}
  297. \begin{math}
  298. \begin{array}{ccc}
  299. {\tt band\_matrix}(\{x,y,z\},6) & = &
  300. \left( \begin{array}{cccccc} y & z & 0 & 0 & 0 & 0 \\ x & y & z & 0 & 0
  301. & 0 \\ 0 & x & y & z & 0 & 0 \\ 0 & 0 & x & y & z & 0 \\ 0 & 0 & 0 & x &
  302. y & z \\ 0 & 0 & 0 & 0 & x & y
  303. \end{array} \right)
  304. \end{array}
  305. \end{math}
  306. \end{flushleft}
  307. {\bf Related functions:}
  308. \hspace*{0.175in} {\tt diagonal}.
  309. \subsection{block\_matrix}
  310. %{\bf How to use it:}
  311. \hspace*{0.175in} {\tt block\_matrix(r,c,matrix\_list);}
  312. \hspace*{0.1in}
  313. \begin{tabular}{l l l}
  314. r,c &:-& positive integers. \\
  315. matrix\_list &:-& a list of matrices.
  316. \end{tabular}
  317. {\bf Synopsis:} %{\bf What it does:}
  318. \begin{addtolength}{\leftskip}{0.22in}
  319. {\tt block\_matrix} creates a matrix that consists of r by c matrices
  320. filled from the matrix\_list row wise.
  321. \end{addtolength}
  322. {\bf Examples:}
  323. \begin{flushleft}
  324. \hspace*{0.1in}
  325. \begin{math}
  326. \begin{array}{ccc}
  327. {\cal B} = \left( \begin{array}{cc} 1 & 0 \\ 0 & 1
  328. \end{array} \right), &
  329. {\cal C} = \left( \begin{array}{c} 5 \\ 5
  330. \end{array} \right), &
  331. {\cal D} = \left( \begin{array}{cc} 22 & 33 \\ 44 & 55
  332. \end{array} \right)
  333. \end{array}
  334. \end{math}
  335. \end{flushleft}
  336. \vspace*{0.175in}
  337. \begin{flushleft}
  338. \hspace*{0.1in}
  339. \begin{math}
  340. \begin{array}{ccc}
  341. {\tt block\_matrix}(2,3,\{{\cal B,C,D,D,C,B}\}) & = &
  342. \left( \begin{array}{ccccc} 1 & 0 & 5 & 22 & 33 \\ 0 & 1 & 5 & 44 & 55
  343. \\
  344. 22 & 33 & 5 & 1 & 0 \\ 44 & 55 & 5 & 0 & 1
  345. \end{array} \right)
  346. \end{array}
  347. \end{math}
  348. \end{flushleft}
  349. \subsection{char\_matrix}
  350. %{\bf How to use it:}
  351. \hspace*{0.175in} {\tt char\_matrix(${\cal A},\lambda$);}
  352. \hspace*{0.1in}
  353. \begin{tabular}{l l l}
  354. ${\cal A}$ &:-& a square matrix. \\
  355. $\lambda$ &:-& a symbol or algebraic expression.
  356. \end{tabular}
  357. {\bf Synopsis:} %{\bf What it does:}
  358. \begin{addtolength}{\leftskip}{0.22in}
  359. {\tt char\_matrix} creates the characteristic matrix ${\cal C}$ of
  360. ${\cal A}$.
  361. This is ${\cal C} = \lambda * {\cal I} - {\cal A}$.
  362. \end{addtolength}
  363. {\bf Examples:}
  364. \begin{flushleft}
  365. \hspace*{0.1in}
  366. \begin{math}
  367. \begin{array}{ccc}
  368. {\tt char\_matrix}({\cal A},x) & = &
  369. \left( \begin{array}{ccc} x-1 & -2 & -3 \\ -4 & x-5 & -6 \\ -7 & -8 &
  370. x-9
  371. \end{array} \right)
  372. \end{array}
  373. \end{math}
  374. \end{flushleft}
  375. {\bf Related functions:}
  376. \hspace*{0.175in} {\tt char\_poly}.
  377. \subsection{char\_poly}
  378. %{\bf How to use it:}
  379. \hspace*{0.175in} {\tt char\_poly(${\cal A},\lambda$);}
  380. \hspace*{0.1in}
  381. \begin{tabular}{l l l}
  382. ${\cal A}$ &:-& a square matrix. \\
  383. $\lambda$ &:-& a symbol or algebraic expression.
  384. \end{tabular}
  385. {\bf Synopsis:} %{\bf What it does:}
  386. \begin{addtolength}{\leftskip}{0.22in}
  387. {\tt char\_poly} finds the characteristic polynomial of
  388. ${\cal A}$.
  389. This is the determinant of $\lambda * {\cal I} - {\cal A}$.
  390. \end{addtolength}
  391. {\bf Examples:}
  392. \hspace*{0.175in}
  393. {\tt char\_poly({\cal A},$x$) $= x^3-15*x^2-18*x$}
  394. {\bf Related functions:}
  395. \hspace*{0.175in} {\tt char\_matrix}.
  396. \subsection{cholesky}
  397. %{\bf How to use it:}
  398. \hspace*{0.175in} {\tt cholesky(${\cal A}$);}
  399. \hspace*{0.1in}
  400. \begin{tabular}{l l l}
  401. ${\cal A}$ &:-& a positive definite matrix containing numeric entries.
  402. \end{tabular}
  403. {\bf Synopsis:} %{\bf What it does:}
  404. \begin{addtolength}{\leftskip}{0.22in}
  405. {\tt cholesky} computes the cholesky decomposition of ${\cal A}$.
  406. It returns \{${\cal L,U}$\} where ${\cal L}$
  407. is a lower matrix, ${\cal U}$ is an upper matrix, \\ ${\cal A} =
  408. {\cal LU}$, and ${\cal U} = {\cal L}^T$.
  409. \end{addtolength}
  410. {\bf Examples:}
  411. \begin{flushleft}
  412. \hspace*{0.175in}
  413. \begin{math}
  414. {\cal F} = \left( \begin{array}{ccc} 1 & 1 & 0 \\ 1 & 3 & 1 \\ 0 & 1 &
  415. 1
  416. \end{array} \right)
  417. \end{math}
  418. \end{flushleft}
  419. \begin{flushleft}
  420. \hspace*{0.1in}
  421. \begin{math}
  422. \begin{array}{ccc}
  423. ${\tt cholesky}$({\cal F}) & = &
  424. \left\{ \left( \begin{array}{ccc} 1 & 0 & 0 \\ 1 & \sqrt{2} & 0 \\
  425. 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{array} \right), \left(
  426. \begin{array}{ccc} 1 & 1 & 0 \\ 0 & \sqrt{2} & \frac{1}{\sqrt{2}} \\ 0
  427. & 0 & \frac{1}{\sqrt{2}} \end{array} \right)
  428. \right\} \end{array}
  429. \end{math}
  430. \end{flushleft}
  431. {\bf Related functions:}
  432. \hspace*{0.175in} {\tt lu\_decom}.
  433. \subsection{coeff\_matrix}
  434. %{\bf How to use it:}
  435. \hspace*{0.175in} {\tt coeff\_matrix(\{\lineqlist{}\});}
  436. \lazyfootnote{}
  437. \hspace*{0.1in}
  438. \begin{tabular}{l l l}
  439. \lineqlist &:-& \parbox[t]{.435\linewidth}{linear equations. Can be
  440. of the form {\it equation $=$ number} or just {\it equation}.}
  441. \end{tabular}
  442. {\bf Synopsis:} %{\bf What it does:}
  443. \begin{addtolength}{\leftskip}{0.22in}
  444. {\tt coeff\_matrix} creates the coefficient matrix
  445. ${\cal C}$ of the linear equations.
  446. It returns \{${\cal C,X,B}$\} such that ${\cal CX} = {\cal B}$.
  447. \end{addtolength}
  448. {\bf Examples:}
  449. \begin{math}
  450. \hspace*{0.175in}
  451. {\tt coeff\_matrix}(\{x+y+4*z=10,y+x-z=20,x+y+4\}) =
  452. \end{math}
  453. \vspace*{0.1in}
  454. \begin{flushleft}
  455. \hspace*{0.175in}
  456. \begin{math}
  457. \left\{ \left( \begin{array}{ccc} 4 & 1 & 1 \\ -1 & 1 & 1 \\ 0 & 1 & 1
  458. \end{array} \right), \left( \begin{array}{c} z \\ y \\ x \end{array}
  459. \right), \left( \begin{array}{c} 10 \\ 20 \\ -4
  460. \end{array} \right) \right\}
  461. \end{math}
  462. \end{flushleft}
  463. \subsection{column\_dim, row\_dim}
  464. %{\bf How to use it:}
  465. \hspace*{0.175in} {\tt column\_dim(${\cal A}$);}
  466. \hspace*{0.1in}
  467. \begin{tabular}{l l l}
  468. ${\cal A}$ &:-& a matrix.
  469. \end{tabular}
  470. {\bf Synopsis:} %{\bf What it does:}
  471. \hspace*{0.175in} {\tt column\_dim} finds the column dimension of
  472. ${\cal A}$.
  473. \hspace*{0.175in} {\tt row\_dim} finds the row dimension of ${\cal A}$.
  474. {\bf Examples:}
  475. \hspace*{0.175in}
  476. {\tt column\_dim}(${\cal A}$) = 3
  477. \subsection{companion}
  478. %{\bf How to use it:}
  479. \hspace*{0.175in} {\tt companion(poly,x);}
  480. \hspace*{0.1in}
  481. \begin{tabular}{l l l}
  482. poly &:-& a monic univariate polynomial in x. \\
  483. x &:-& the variable.
  484. \end{tabular}
  485. {\bf Synopsis:} %{\bf What it does:}
  486. \begin{addtolength}{\leftskip}{0.22in}
  487. {\tt companion} creates the companion matrix ${\cal C}$
  488. of poly.
  489. This is the square matrix of dimension n, where n is the degree of poly
  490. w.r.t. x.
  491. The entries of ${\cal C}$ are:
  492. ${\cal C}$(i,n) = -coeffn(poly,x,i-1) for i = 1
  493. \ldots n, ${\cal C}$(i,i-1) = 1 for i = 2 \ldots n and
  494. the rest are 0.
  495. \end{addtolength}
  496. {\bf Examples:}
  497. \begin{flushleft}
  498. \hspace*{0.1in}
  499. \begin{math}
  500. \begin{array}{ccc}
  501. {\tt companion}(x^4+17*x^3-9*x^2+11,x) & = &
  502. \left( \begin{array}{cccc} 0 & 0 & 0 & -11 \\ 1 & 0 & 0 & 0 \\
  503. 0 & 1 & 0 & 9 \\ 0 & 0 & 1 & -17
  504. \end{array} \right)
  505. \end{array}
  506. \end{math}
  507. \end{flushleft}
  508. {\bf Related functions:}
  509. \hspace*{0.175in} {\tt find\_companion}.
  510. \subsection{copy\_into}
  511. %{\bf How to use it:}
  512. \hspace*{0.175in} {\tt copy\_into(${\cal A,B}$,r,c);}
  513. \hspace*{0.1in}
  514. \begin{tabular}{l l l}
  515. ${\cal A,B}$ &:-& matrices. \\
  516. r,c &:-& positive integers.
  517. \end{tabular}
  518. {\bf Synopsis:} %{\bf What it does:}
  519. \hspace*{0.175in} {\tt copy\_into} copies matrix ${\cal A}$ into
  520. ${\cal B}$ with ${\cal A}$(1,1) at ${\cal B}$(r,c).
  521. {\bf Examples:}
  522. \begin{flushleft}
  523. \hspace*{0.175in}
  524. \begin{math}
  525. {\cal G} = \left( \begin{array}{cccc} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\
  526. 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0
  527. \end{array} \right)
  528. \end{math}
  529. \end{flushleft}
  530. \begin{flushleft}
  531. \hspace*{0.1in}
  532. \begin{math}
  533. \begin{array}{ccc}
  534. {\tt copy\_into}({\cal A,G},1,2) & = &
  535. \left( \begin{array}{cccc} 0 & 1 & 2 & 3 \\ 0 & 4 & 5 & 6 \\ 0 & 7 & 8
  536. & 9 \\ 0 & 0 & 0 & 0
  537. \end{array} \right)
  538. \end{array}
  539. \end{math}
  540. \end{flushleft}
  541. {\bf Related functions:}
  542. \begin{addtolength}{\leftskip}{0.22in}
  543. {\tt augment\_columns}, {\tt extend}, {\tt matrix\_augment},
  544. {\tt matrix\_stack}, {\tt stack\_rows}, {\tt sub\_matrix}.
  545. \end{addtolength}
  546. \subsection{diagonal}
  547. %{\bf How to use it:}
  548. \hspace*{0.175in} {\tt diagonal(\{\matlist{}\});}\lazyfootnote{}
  549. \hspace*{0.1in}
  550. \begin{tabular}{l l l}
  551. \matlist &:-& \parbox[t]{.58\linewidth}{each can be either a scalar
  552. expr or a square matrix. }
  553. \end{tabular}
  554. {\bf Synopsis:} %{\bf What it does:}
  555. \hspace*{0.175in} {\tt diagonal} creates a matrix that contains the
  556. input on the diagonal.
  557. {\bf Examples:}
  558. \begin{flushleft}
  559. \hspace*{0.175in}
  560. \begin{math}
  561. {\cal H} = \left( \begin{array}{cc} 66 & 77 \\ 88 & 99
  562. \end{array} \right)
  563. \end{math}
  564. \end{flushleft}
  565. \begin{flushleft}
  566. \hspace*{0.1in}
  567. \begin{math}
  568. \begin{array}{ccc}
  569. {\tt diagonal}(\{{\cal A},x,{\cal H}\}) & = &
  570. \left( \begin{array}{cccccc} 1 & 2 & 3 & 0 & 0 & 0 \\ 4 & 5 & 6 & 0 & 0
  571. & 0 \\ 7 & 8 & 9 & 0 & 0 & 0 \\ 0 & 0 & 0 & x & 0 & 0 \\ 0 & 0 & 0 & 0
  572. & 66 & 77 \\ 0 & 0 & 0 & 0 & 88 & 99
  573. \end{array} \right)
  574. \end{array}
  575. \end{math}
  576. \end{flushleft}
  577. {\bf Related functions:}
  578. \hspace*{0.175in} {\tt jordan\_block}.
  579. \subsection{extend}
  580. %{\bf How to use it:}
  581. \hspace*{0.175in} {\tt extend(${\cal A}$,r,c,expr);}
  582. \hspace*{0.1in}
  583. \begin{tabular}{l l l}
  584. ${\cal A}$ &:-& a matrix. \\
  585. r,c &:-& positive integers. \\
  586. expr &:-& algebraic expression or symbol.
  587. \end{tabular}
  588. {\bf Synopsis:} %{\bf What it does:}
  589. \begin{addtolength}{\leftskip}{0.22in}
  590. {\tt extend} returns a copy of ${\cal A}$ that has been
  591. extended by r rows and c columns. The new entries are
  592. made equal to expr.
  593. \end{addtolength}
  594. {\bf Examples:}
  595. \begin{flushleft}
  596. \hspace*{0.1in}
  597. \begin{math}
  598. \begin{array}{ccc}
  599. {\tt extend}({\cal A},1,2,x) & = &
  600. \left( \begin{array}{ccccc} 1 & 2 & 3 & x & x \\ 4 & 5 & 6 & x & x
  601. \\ 7 & 8 & 9 & x & x \\ x & x & x & x & x
  602. \end{array} \right)
  603. \end{array}
  604. \end{math}
  605. \end{flushleft}
  606. {\bf Related functions:}
  607. \begin{addtolength}{\leftskip}{0.22in}
  608. \parbox[t]{0.95\linewidth}{{\tt copy\_into}, {\tt matrix\_augment},
  609. {\tt matrix\_stack}, {\tt remove\_columns}, {\tt remove\_rows}.}
  610. \end{addtolength}
  611. \subsection{find\_companion}
  612. \hspace*{0.175in} {\tt find\_companion(${\cal A}$,x);}
  613. \hspace*{0.1in}
  614. \begin{tabular}{l l l}
  615. ${\cal A}$ &:-& a matrix. \\
  616. x &:-& the variable.
  617. \end{tabular}
  618. {\bf Synopsis:}
  619. \begin{addtolength}{\leftskip}{0.22in}
  620. Given a companion matrix, {\tt find\_companion} finds the polynomial
  621. from which it was made.
  622. \end{addtolength}
  623. {\bf Examples:}
  624. \begin{flushleft}
  625. \hspace*{0.175in}
  626. \begin{math}
  627. {\cal C} = \left( \begin{array}{cccc} 0 & 0 & 0 & -11 \\ 1 & 0 & 0 & 0
  628. \\ 0 & 1 & 0 & 9 \\ 0 & 0 & 1 & -17
  629. \end{array} \right)
  630. \end{math}
  631. \end{flushleft}
  632. \vspace*{3mm}
  633. \begin{flushleft}
  634. \hspace*{0.175in}
  635. \begin{math}
  636. {\tt find\_companion}({\cal C},x) = x^4+17*x^3-9*x^2+11
  637. \end{math}
  638. \end{flushleft}
  639. \vspace*{3mm}
  640. {\bf Related functions:}
  641. \hspace*{0.175in} {\tt companion}.
  642. \subsection{get\_columns, get\_rows}
  643. %{\bf How to use it:}
  644. \hspace*{0.175in} {\tt get\_columns(${\cal A}$,column\_list);}
  645. \hspace*{0.1in}
  646. \begin{tabular}{l l l}
  647. ${\cal A}$ &:-& a matrix. \\
  648. c &:-& either a positive integer or a list of positive
  649. integers.
  650. \end{tabular}
  651. {\bf Synopsis:} %{\bf What it does:}
  652. \begin{addtolength}{\leftskip}{0.22in}
  653. {\tt get\_columns} removes the columns of ${\cal A}$ specified in
  654. column\_list and returns them as a list of column
  655. matrices.
  656. \end{addtolength}
  657. \hspace*{0.175in} {\tt get\_rows} performs the same task on the rows of
  658. ${\cal A}$.
  659. {\bf Examples:}
  660. \begin{flushleft}
  661. \hspace*{0.1in}
  662. \begin{math}
  663. \begin{array}{ccc}
  664. {\tt get\_columns}({\cal A},\{1,3\}) & = &
  665. \left\{
  666. \left( \begin{array}{c} 1 \\ 4 \\ 7 \end{array} \right),
  667. \left( \begin{array}{c} 3 \\ 6 \\ 9 \end{array} \right)
  668. \right\}
  669. \end{array}
  670. \end{math}
  671. \end{flushleft}
  672. \vspace*{0.1in}
  673. \begin{flushleft}
  674. \hspace*{0.1in}
  675. \begin{math}
  676. \begin{array}{ccc}
  677. {\tt get\_rows}({\cal A},2) & = &
  678. \left\{
  679. \left( \begin{array}{ccc} 4 & 5 & 6 \end{array} \right)
  680. \right\}
  681. \end{array}
  682. \end{math}
  683. \end{flushleft}
  684. {\bf Related functions:}
  685. \hspace*{0.175in} {\tt augment\_columns}, {\tt stack\_rows},
  686. {\tt sub\_matrix}.
  687. \subsection{get\_rows}
  688. \hspace*{0.175in} see: {\tt get\_columns}.
  689. \subsection{gram\_schmidt}
  690. %{\bf How to use it:}
  691. \hspace*{0.175in} {\tt gram\_schmidt(\{\veclist{}\});} \lazyfootnote{}
  692. \hspace*{0.1in}
  693. \begin{tabular}{l l l}
  694. \veclist &:-& \parbox[t]{.62\linewidth}{linearly independent vectors.
  695. Each vector must be written as a list,
  696. eg:\{1,0,0\}. }
  697. \end{tabular}
  698. {\bf Synopsis:} %{\bf What it does:}
  699. \begin{addtolength}{\leftskip}{0.22in}
  700. {\tt gram\_schmidt} performs the gram\_schmidt
  701. orthonormalisation on the input vectors.
  702. It returns a list of orthogonal normalised vectors.
  703. \end{addtolength}
  704. {\bf Examples:}
  705. \hspace*{0.175in}
  706. {\tt gram\_schmidt(\{\{1,0,0\},\{1,1,0\},\{1,1,1\}\})} =
  707. \{\{1,0,0\},\{0,1,0\},\{0,0,1\}\}
  708. \hspace*{0.175in}
  709. {\tt gram\_schmidt(\{\{1,2\},\{3,4\}\})} $=
  710. \{\{ \frac{1}{{\sqrt{5}}} , \frac{2}{\sqrt{5}} \},
  711. \{ \frac{2*\sqrt{5}}{5} , \frac{-\sqrt{5}}{5} \}\}$
  712. \subsection{hermitian\_tp}
  713. %{\bf How to use it:}
  714. \hspace*{0.175in} {\tt hermitian\_tp(${\cal A}$);}
  715. \hspace*{0.1in}
  716. \begin{tabular}{l l l}
  717. ${\cal A}$ &:-& a matrix.
  718. \end{tabular}
  719. {\bf Synopsis:} %{\bf What it does:}
  720. \begin{addtolength}{\leftskip}{0.22in}
  721. {\tt hermitian\_tp} computes the hermitian transpose of
  722. ${\cal A}$.
  723. This is a matrix in which the (i,$\,$j)'th entry is the conjugate of
  724. the (j,$\,$i)'th entry of ${\cal A}$.
  725. \end{addtolength}
  726. {\bf Examples:}
  727. \begin{flushleft}
  728. \hspace*{0.175in}
  729. \begin{math}
  730. {\cal J} = \left( \begin{array}{ccc} i+1 & i+2 & i+3 \\ 4 & 5 & 2 \\ 1 &
  731. i & 0
  732. \end{array} \right)
  733. \end{math}
  734. \end{flushleft}
  735. \vspace*{0.1in}
  736. \begin{flushleft}
  737. \hspace*{0.1in}
  738. \begin{math}
  739. \begin{array}{ccc}
  740. {\tt hermitian\_tp}({\cal J}) & = &
  741. \left( \begin{array}{ccc} -i+1 & 4 & 1 \\ -i+2 & 5 & -i \\-i+3 & 2 & 0
  742. \end{array} \right)
  743. \end{array}
  744. \end{math}
  745. \end{flushleft}
  746. {\bf Related functions:}
  747. \hspace*{0.175in} {\tt tp}\footnote{standard reduce call for the
  748. transpose of a matrix - see {\REDUCE} User's Manual[2].}.
  749. \subsection{hessian}
  750. %{\bf How to use it:}
  751. \hspace*{0.175in} {\tt hessian(expr,variable\_list);}
  752. \hspace*{0.1in}
  753. \begin{tabular}{l l l}
  754. expr &:-& a scalar expression. \\
  755. variable\_list &:-& either a single variable or a list of variables.
  756. \end{tabular}
  757. {\bf Synopsis:} %{\bf What it does:}
  758. \begin{addtolength}{\leftskip}{0.22in}
  759. {\tt hessian} computes the hessian matrix of expr w.r.t.
  760. the varibles in variable\_list.
  761. This is an n by n matrix
  762. where n is the number of variables and the (i,$\,$j)'th
  763. entry is df(expr,variable\_list(i),variable\_list(j)).
  764. \end{addtolength}
  765. {\bf Examples:}
  766. \begin{flushleft}
  767. \hspace*{0.1in}
  768. \begin{math}
  769. \begin{array}{ccc}
  770. {\tt hessian}(x*y*z+x^2,\{w,x,y,z\}) & = &
  771. \left( \begin{array}{cccc} 0 & 0 & 0 & 0 \\ 0 & 2 & z & y \\ 0 & z & 0
  772. & x \\ 0 & y & x & 0
  773. \end{array} \right)
  774. \end{array}
  775. \end{math}
  776. \end{flushleft}
  777. {\bf Related functions:}
  778. \hspace*{0.175in} {\tt df}\footnote{standard reduce call for
  779. differentiation - see {\REDUCE} User's Manual[2]}.
  780. \subsection{hilbert}
  781. %{\bf How to use it:}
  782. \hspace*{0.175in} {\tt hilbert(square\_size,expr);}
  783. \hspace*{0.1in}
  784. \begin{tabular}{l l l}
  785. square\_size &:-& a positive integer. \\
  786. expr &:-& an algebraic expression.
  787. \end{tabular}
  788. {\bf Synopsis:} %{\bf What it does:}
  789. \begin{addtolength}{\leftskip}{0.22in}
  790. {\tt hilbert} computes the square hilbert matrix of
  791. dimension square\_size.
  792. This is the symmetric matrix in
  793. which the (i,$\,$j)'th entry is 1/(i+j-expr).
  794. \end{addtolength}
  795. {\bf Examples:}
  796. \begin{flushleft}
  797. \hspace*{0.1in}
  798. \begin{math}
  799. \begin{array}{ccc}
  800. {\tt hilbert}(3,y+x) & = &
  801. \left( \begin{array}{ccc} \frac{-1}{x+y-2} & \frac{-1}{x+y-3}
  802. & \frac{-1}{x+y-4} \\ \frac{-1}{x+y-3} & \frac{-1}{x+y-4} &
  803. \frac{-1}{x+y-5} \\ \frac{-1}{x+y-4} & \frac{-1}{x+y-5} &
  804. \frac{-1}{x+y-6}
  805. \end{array} \right)
  806. \end{array}
  807. \end{math}
  808. \end{flushleft}
  809. \subsection{jacobian}
  810. %{\bf How to use it:}
  811. \hspace*{0.175in} {\tt jacobian(expr\_list,variable\_list);}
  812. \hspace*{0.1in}
  813. \begin{tabular}{l l l}
  814. expr\_list \hspace*{0.175in} &:-& \parbox[t]{.72\linewidth}{either a
  815. single algebraic expression or a list of algebraic expressions.}
  816. \end{tabular}
  817. \vspace*{0.04in}
  818. \hspace*{0.1in}
  819. \begin{tabular}{l l l}
  820. variable\_list &:-& either a single variable or a list of variables.
  821. \end{tabular}
  822. {\bf Synopsis:} %{\bf What it does:}
  823. \begin{addtolength}{\leftskip}{0.22in}
  824. {\tt jacobian} computes the jacobian matrix of expr\_list w.r.t.
  825. variable\_list.
  826. This is a matrix whose (i,$\,$j)'th entry is df(expr\_list(i),
  827. variable\_list(j)).
  828. The matrix is n by m where n is the
  829. number of variables and m the number of expressions.
  830. \end{addtolength}
  831. {\bf Examples:}
  832. \hspace*{0.175in}
  833. {\tt jacobian(\{$x^4,x*y^2,x*y*z^3$\},\{$w,x,y,z$\})} =
  834. \vspace*{0.1in}
  835. \begin{flushleft}
  836. \hspace*{0.175in}
  837. \begin{math}
  838. \left( \begin{array}{cccc} 0 & 4*x^3 & 0 & 0 \\ 0 & y^2 & 2*x*y & 0 \\
  839. 0 & y*z^3 & x*z^3 & 3*x*y*z^2
  840. \end{array} \right)
  841. \end{math}
  842. \end{flushleft}
  843. {\bf Related functions:}
  844. \hspace*{0.175in} {\tt hessian}, {\tt df}\footnote{standard reduce call
  845. for differentiation - see {\REDUCE} User's Manual[2].}.
  846. \subsection{jordan\_block}
  847. %{\bf How to use it:}
  848. \hspace*{0.175in} {\tt jordan\_block(expr,square\_size);}
  849. \hspace*{0.1in}
  850. \begin{tabular}{l l l}
  851. expr &:-& an algebraic expression or symbol. \\
  852. square\_size &:-& a positive integer.
  853. \end{tabular}
  854. {\bf Synopsis:} %{\bf What it does:}
  855. \begin{addtolength}{\leftskip}{0.22in}
  856. {\tt jordan\_block} computes the square jordan block matrix ${\cal J}$
  857. of dimension square\_size.
  858. The entries of ${\cal J}$ are:
  859. ${\cal J}$(i,i) = expr for i=1
  860. \ldots n, ${\cal J}$(i,i+1) = 1 for i=1
  861. \ldots n-1, and all other entries are 0.
  862. \end{addtolength}
  863. {\bf Examples:}
  864. \begin{flushleft}
  865. \hspace*{0.1in}
  866. \begin{math}
  867. \begin{array}{ccc}
  868. {\tt jordan\_block(x,5)} & = &
  869. \left( \begin{array}{ccccc} x & 1 & 0 & 0 & 0 \\ 0 & x & 1 & 0 & 0 \\ 0
  870. & 0 & x & 1 & 0 \\ 0 & 0 & 0 & x & 1 \\ 0 & 0 & 0 & 0 & x
  871. \end{array} \right)
  872. \end{array}
  873. \end{math}
  874. \end{flushleft}
  875. {\bf Related functions:}
  876. \hspace*{0.175in} {\tt diagonal}, {\tt companion}.
  877. \subsection{lu\_decom}
  878. %{\bf How to use it:}
  879. \hspace*{0.175in} {\tt lu\_decom(${\cal A}$);}
  880. \hspace*{0.1in}
  881. \begin{tabular}{l l l}
  882. ${\cal A}$ &:-& \parbox[t]{.848\linewidth}{a matrix containing either
  883. numeric entries or imaginary entries with numeric coefficients.}
  884. \end{tabular}
  885. {\bf Synopsis:} %{\bf What it does:}
  886. \begin{addtolength}{\leftskip}{0.22in}
  887. {\tt lu\_decom} performs LU decomposition on ${\cal A}$,
  888. ie: it returns \{${\cal L,U}$\} where ${\cal L}$
  889. is a lower diagonal matrix, ${\cal U}$ an upper diagonal
  890. matrix and ${\cal A} = {\cal LU}$.
  891. \end{addtolength}
  892. {\bf caution:}
  893. \begin{addtolength}{\leftskip}{0.22in}
  894. The algorithm used can swap the rows of ${\cal A}$
  895. during the calculation. This means that ${\cal LU}$ does
  896. not equal ${\cal A}$ but a row equivalent of it. Due to
  897. this, {\tt lu\_decom} returns \{${\cal L,U}$,vec\}. The
  898. call {\tt convert(${\cal A}$,vec)} will return the
  899. matrix that has been decomposed, ie: ${\cal LU} = $
  900. {\tt convert(${\cal A}$,vec)}.
  901. \end{addtolength}
  902. {\bf Examples:}
  903. \begin{flushleft}
  904. \hspace*{0.175in}
  905. \begin{math}
  906. {\cal K} = \left( \begin{array}{ccc} 1 & 3 & 5 \\ -4 & 3 & 7 \\ 8 & 6 &
  907. 4
  908. \end{array} \right)
  909. \end{math}
  910. \end{flushleft}
  911. \begin{flushleft}
  912. \hspace*{0.1in}
  913. \begin{math}
  914. \begin{array}{cccc}
  915. ${\tt lu} := {\tt lu\_decom}$({\cal K}) & = &
  916. \left\{
  917. \left( \begin{array}{ccc} 8 & 0 & 0 \\ -4 & 6 & 0 \\ 1 & 2.25 &
  918. 1.125 1 \end{array} \right),
  919. \left( \begin{array}{ccc} 1 & 0.75 & 0.5 \\ 0 & 1 & 1.5 \\ 0 &
  920. 0 & 1 \end{array} \right),
  921. [\; 3 \; 2 \; 3 \; ]
  922. \right\}
  923. \end{array}
  924. \end{math}
  925. \end{flushleft}
  926. \vspace*{0.1in}
  927. \begin{flushleft}
  928. \hspace*{0.1in}
  929. \begin{math}
  930. \begin{array}{ccc}
  931. ${\tt first lu * second lu}$ & = &
  932. \left( \begin{array}{ccc} 8 & 6 & 4 \\ -4 & 3 & 7 \\ 1 & 3 & 5
  933. \end{array} \right)
  934. \end{array}
  935. \end{math}
  936. \end{flushleft}
  937. \begin{flushleft}
  938. \hspace*{0.1in}
  939. \begin{math}
  940. \begin{array}{ccc}
  941. ${\tt convert(${\cal K}$,third lu}$) \hspace*{0.055in} & = &
  942. \left( \begin{array}{ccc} 8 & 6 & 4 \\ -4 & 3 & 7 \\ 1 & 3 & 5
  943. \end{array} \right)
  944. \end{array}
  945. \end{math}
  946. \end{flushleft}
  947. \vspace*{0.5in}
  948. \begin{flushleft}
  949. \hspace*{0.175in}
  950. \begin{math}
  951. {\cal P} = \left( \begin{array}{ccc} i+1 & i+2 & i+3 \\ 4 & 5 & 2 \\ 1
  952. & i & 0
  953. \end{array} \right)
  954. \end{math}
  955. \end{flushleft}
  956. \begin{eqnarray}
  957. \hspace*{0.22in}
  958. {\tt lu} := {\tt lu\_decom}({\cal P}) & = &
  959. \left\{
  960. \left( \begin{array}{ccc} 1 & 0 & 0 \\ 4 & -4*i+5 & 0 \\ i+1 &
  961. 3 & 0.41463*i+2.26829 \end{array} \right), \right. \nonumber \\ & &
  962. \left. \: \; \, \left( \begin{array}{ccc} 1 & i & 0 \\ 0 & 1 &
  963. 0.19512*i+0.24390 \\ 0 & 0 & 1 \end{array} \right), \hspace*{0.05in}
  964. [\; 3 \; 2 \; 3 \;] \hspace*{0.05in}
  965. \right\} \nonumber
  966. \end{eqnarray}
  967. \vspace*{0.1in}
  968. \begin{flushleft}
  969. \hspace*{0.1in}
  970. \begin{math}
  971. \begin{array}{ccc}
  972. ${\tt first lu * second lu}$ & = &
  973. \left( \begin{array}{ccc} 1 & i & 0 \\ 4 & 5 & 2 \\ i+1 & i+2 &
  974. i+3
  975. \end{array} \right)
  976. \end{array}
  977. \end{math}
  978. \end{flushleft}
  979. \begin{flushleft}
  980. \hspace*{0.1in}
  981. \begin{math}
  982. \begin{array}{ccc}
  983. ${\tt convert({\cal P},third lu}$) \hspace*{0.1in} & = & \left(
  984. \begin{array}{c c c} 1 & i & 0 \\ 4 & 5 & 2 \\ i+1 & i+2 & i+3
  985. \end{array} \right)
  986. \end{array}
  987. \end{math}
  988. \end{flushleft}
  989. {\bf Related functions:}
  990. \hspace*{0.175in} {\tt cholesky}.
  991. \subsection{make\_identity}
  992. %{\bf How to use it:}
  993. \hspace*{0.175in} {\tt make\_identity(square\_size);}
  994. \hspace*{0.1in}
  995. \begin{tabular}{l l l}
  996. square\_size &:-& a positive integer.
  997. \end{tabular}
  998. {\bf Synopsis:} %{\bf What it does:}
  999. \hspace*{0.175in} {\tt make\_identity} creates the identity matrix of
  1000. dimension square\_size.
  1001. {\bf Examples:}
  1002. \begin{flushleft}
  1003. \hspace*{0.1in}
  1004. \begin{math}
  1005. \begin{array}{ccc}
  1006. {\tt make\_identity}(4) & = &
  1007. \left( \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0
  1008. & 0 & 1 & 0 \\ 0 & 0 & 0 & 1
  1009. \end{array} \right)
  1010. \end{array}
  1011. \end{math}
  1012. \end{flushleft}
  1013. {\bf Related functions:}
  1014. \hspace*{0.175in} {\tt diagonal}.
  1015. \subsection{matrix\_augment, matrix\_stack}
  1016. %{\bf How to use it:}
  1017. \hspace*{0.175in} {\tt matrix\_augment(\{\matlist\});}\lazyfootnote{}
  1018. \hspace*{0.1in}
  1019. \begin{tabular}{l l l}
  1020. \matlist &:-& matrices.
  1021. \end{tabular}
  1022. {\bf Synopsis:} %{\bf What it does:}
  1023. \hspace*{0.175in} {\tt matrix\_augment} sticks the matrices in
  1024. matrix\_list together horizontally.
  1025. \hspace*{0.175in}
  1026. {\tt matrix\_stack} sticks the matrices in matrix\_list
  1027. together vertically.
  1028. {\bf Examples:}
  1029. \begin{flushleft}
  1030. \hspace*{0.1in}
  1031. \begin{math}
  1032. \begin{array}{ccc}
  1033. {\tt matrix\_augment}(\{{\cal A,A}\}) & = &
  1034. \left( \begin{array}{cccccc} 1 & 2 & 3 & 1 & 2 & 3 \\ 4 & 4 & 6
  1035. & 4 & 5 & 6 \\ 7 & 8 & 9 & 7 & 8 & 9
  1036. \end{array} \right)
  1037. \end{array}
  1038. \end{math}
  1039. \end{flushleft}
  1040. \vspace*{0.1in}
  1041. \begin{flushleft}
  1042. \hspace*{0.1in}
  1043. \begin{math}
  1044. \begin{array}{ccc}
  1045. {\tt matrix\_stack}(\{{\cal A,A}\}) & = &
  1046. \left( \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9
  1047. \\ 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9
  1048. \end{array} \right)
  1049. \end{array}
  1050. \end{math}
  1051. \end{flushleft}
  1052. {\bf Related functions:}
  1053. \hspace*{0.175in} {\tt augment\_columns}, {\tt stack\_rows},
  1054. {\tt sub\_matrix}.
  1055. \subsection{matrixp}
  1056. %{\bf How to use it:}
  1057. \hspace*{0.175in} {\tt matrixp(test\_input);}
  1058. \hspace*{0.1in}
  1059. \begin{tabular}{l l l}
  1060. test\_input &:-& anything you like.
  1061. \end{tabular}
  1062. {\bf Synopsis:} %{\bf What it does:}
  1063. \begin{addtolength}{\leftskip}{0.22in}
  1064. {\tt matrixp} is a boolean function that returns t if
  1065. the input is a matrix and nil otherwise.
  1066. \end{addtolength}
  1067. {\bf Examples:}
  1068. \hspace*{0.175in} {\tt matrixp}(${\cal A}$) = t
  1069. \hspace*{0.175in} {\tt matrixp}(doodlesackbanana) = nil
  1070. {\bf Related functions:}
  1071. \hspace*{0.175in} {\tt squarep}, {\tt symmetricp}.
  1072. \subsection{matrix\_stack}
  1073. \hspace*{0.175in} see: {\tt matrix\_augment}.
  1074. \subsection{minor}
  1075. %{\bf How to use it:}
  1076. \hspace*{0.175in} {\tt minor(${\cal A}$,r,c);}
  1077. \hspace*{0.1in}
  1078. \begin{tabular}{l l l}
  1079. ${\cal A}$ &:-& a matrix. \\
  1080. r,c &:-& positive integers.
  1081. \end{tabular}
  1082. {\bf Synopsis:} %{\bf What it does:}
  1083. \begin{addtolength}{\leftskip}{0.22in}
  1084. {\tt minor} computes the (r,c)'th minor of ${\cal A}$.
  1085. This is created by removing the r'th row and the c'th
  1086. column from ${\cal A}$.
  1087. \end{addtolength}
  1088. {\bf Examples:}
  1089. \begin{flushleft}
  1090. \hspace*{0.1in}
  1091. \begin{math}
  1092. \begin{array}{ccc}
  1093. {\tt minor}({\cal A},1,3) & = &
  1094. \left( \begin{array}{cc} 4 & 5 \\ 7 & 8
  1095. \end{array} \right)
  1096. \end{array}
  1097. \end{math}
  1098. \end{flushleft}
  1099. {\bf Related functions:}
  1100. \hspace*{0.175in} {\tt remove\_columns}, {\tt remove\_rows}.
  1101. \subsection{mult\_columns, mult\_rows}
  1102. %{\bf How to use it:}
  1103. \hspace*{0.175in} {\tt mult\_columns(${\cal A}$,column\_list,expr);}
  1104. \hspace*{0.1in}
  1105. \begin{tabular}{l l l}
  1106. ${\cal A}$ &:-& a matrix. \\
  1107. column\_list &:-& a positive integer or a list of positive integers. \\
  1108. expr &:-& an algebraic expression.
  1109. \end{tabular}
  1110. {\bf Synopsis:} %{\bf What it does:}
  1111. \begin{addtolength}{\leftskip}{0.22in}
  1112. {\tt mult\_columns} returns a copy of ${\cal A}$ in which
  1113. the columns specified in column\_list have been
  1114. multiplied by expr.
  1115. {\tt mult\_rows} performs the same task on the rows of ${\cal A}$.
  1116. \end{addtolength}
  1117. {\bf Examples:}
  1118. \begin{flushleft}
  1119. \hspace*{0.1in}
  1120. \begin{math}
  1121. \begin{array}{ccc}
  1122. {\tt mult\_columns}({\cal A},\{1,3\},x) & = &
  1123. \left( \begin{array}{ccc} x & 2 & 3*x \\ 4*x & 5 & 6*x \\ 7*x &
  1124. 8 & 9*x
  1125. \end{array} \right)
  1126. \end{array}
  1127. \end{math}
  1128. \end{flushleft}
  1129. \vspace*{0.1in}
  1130. \begin{flushleft}
  1131. \hspace*{0.1in}
  1132. \begin{math}
  1133. \begin{array}{ccc}
  1134. {\tt mult\_rows}({\cal A},2,10) & = &
  1135. \left( \begin{array}{ccc} 1 & 2 & 3 \\ 40 & 50 & 60 \\ 7 & 8 &
  1136. 9 \end{array} \right)
  1137. \end{array}
  1138. \end{math}
  1139. \end{flushleft}
  1140. {\bf Related functions:}
  1141. \hspace*{0.175in} {\tt add\_to\_columns}, {\tt add\_to\_rows}.
  1142. \subsection{\tt mult\_rows}
  1143. \hspace*{0.175in} see: {\tt mult\_columns}.
  1144. \subsection{pivot}
  1145. %{\bf How to use it:}
  1146. \hspace*{0.175in} {\tt pivot(${\cal A}$,r,c);}
  1147. \hspace*{0.1in}
  1148. \begin{tabular}{l l l}
  1149. ${\cal A}$ &:-& a matrix. \\
  1150. r,c &:-& positive integers such that ${\cal A}$(r,c) neq 0.
  1151. \end{tabular}
  1152. {\bf Synopsis:} %{\bf What it does:}
  1153. \begin{addtolength}{\leftskip}{0.22in}
  1154. {\tt pivot} pivots ${\cal A}$ about its (r,c)'th entry.
  1155. To do this, multiples of the r'th row are added to every
  1156. other row in the matrix.
  1157. This means that the c'th column
  1158. will be 0 except for the (r,c)'th entry.
  1159. \end{addtolength}
  1160. {\bf Examples:}
  1161. \begin{flushleft}
  1162. \hspace*{0.1in}
  1163. \begin{math}
  1164. \begin{array}{ccc}
  1165. {\tt pivot}({\cal A},2,3) & = &
  1166. \left( \begin{array}{ccc} -1 & -0.5 & 0 \\ 4 & 5 & 6 \\ 1 & 0.5
  1167. & 0
  1168. \end{array} \right)
  1169. \end{array}
  1170. \end{math}
  1171. \end{flushleft}
  1172. {\bf Related functions:}
  1173. \hspace*{0.175in} {\tt rows\_pivot}.
  1174. \subsection{pseudo\_inverse}
  1175. %{\bf How to use it:}
  1176. \hspace*{0.175in} {\tt pseudo\_inverse(${\cal A}$);}
  1177. \hspace*{0.1in}
  1178. \begin{tabular}{l l l}
  1179. ${\cal A}$ &:-& a matrix.
  1180. \end{tabular}
  1181. {\bf Synopsis:} %{\bf What it does:}
  1182. \begin{addtolength}{\leftskip}{0.22in}
  1183. {\tt pseudo\_inverse}, also known as the Moore-Penrose inverse, computes
  1184. the pseudo inverse of ${\cal A}$.
  1185. Given the singular value decomposition of ${\cal A}$, i.e: ${\cal A} =
  1186. {\cal U}
  1187. \sum {\cal V}^T$, then the pseudo inverse ${\cal A}^{-1}$ is defined
  1188. by ${\cal A}^{-1} = {\cal V}^T \sum^{-1} {\cal U}$.
  1189. Thus ${\cal A}$ $ * $ {\tt pseudo\_inverse}$({\cal A}) = {\cal I}$.
  1190. \end{addtolength}
  1191. {\bf Examples:}
  1192. % \begin{flushleft}
  1193. % \hspace*{0.175in}
  1194. % \begin{math}
  1195. % {\cal R} = \left( \begin{array}{cccc} 1 & 2 & 3 & 4 \\ 9 & 8 & 7 & 6
  1196. % \end{array} \right)
  1197. % \end{math}
  1198. % \end{flushleft}
  1199. \begin{flushleft}
  1200. \hspace*{0.1in}
  1201. \begin{math}
  1202. \begin{array}{ccc}
  1203. {\tt pseudo\_inverse}({\cal A}) & = &
  1204. \left( \begin{array}{cc} -0.2 & 0.1 \\ -0.05 & 0.05 \\ 0.1 & 0
  1205. \\ 0.25 & -0.05
  1206. \end{array} \right)
  1207. \end{array}
  1208. \end{math}
  1209. \end{flushleft}
  1210. {\bf Related functions:}
  1211. \hspace*{0.175in} {\tt svd}.
  1212. \subsection{random\_matrix}
  1213. %{\bf How to use it:}
  1214. \hspace*{0.175in} {\tt random\_matrix(r,c,limit);}
  1215. \hspace*{0.1in}
  1216. \begin{tabular}{l l l}
  1217. r,c,$\,$limit &:-& positive integers. \\
  1218. \end{tabular}
  1219. {\bf Synopsis:} %{\bf What it does:}
  1220. \begin{addtolength}{\leftskip}{0.22in}
  1221. {\tt random\_matrix} creates an r by c matrix with random
  1222. entries in the range $-$limit $<$ entry $<$ limit.
  1223. \end{addtolength}
  1224. {\bf switches:}
  1225. \hspace*{0.1in}
  1226. \begin{tabular}{l l l}
  1227. {\tt imaginary} \hspace*{0.175in} &:-& \parbox[t]{0.685\linewidth}{if
  1228. on then matrix entries are x+i$*$y where $-$limit $<$ x,y $<$ limit.}
  1229. \end{tabular}
  1230. \vspace*{0.04in}
  1231. \hspace*{0.1in}
  1232. \begin{tabular}{l l l}
  1233. {\tt not\_negative} &:-& \parbox[t]{0.685\linewidth}{if on then 0 $<$
  1234. entry $<$ limit. In the imaginary case we have 0 $<$ x,y $<$ limit.}
  1235. \end{tabular}
  1236. \vspace*{0.04in}
  1237. \hspace*{0.1in}
  1238. \begin{tabular}{l l l}
  1239. {\tt only\_integer} &:-& \parbox[t]{0.685\linewidth}{if on then each
  1240. entry is an integer. In the imaginary case x and y are integers.}
  1241. \end{tabular}
  1242. \vspace*{0.04in}
  1243. \hspace*{0.1in}
  1244. \begin{tabular}{l l l}
  1245. {\tt symmetric} &:-& if on then the matrix is symmetric. \\
  1246. {\tt upper\_matrix} &:-& \parbox[t]{0.685\linewidth}{if on then the
  1247. matrix is upper triangular.} \\
  1248. {\tt lower\_matrix} &:-& if on then the matrix is lower triangular.
  1249. \end{tabular}
  1250. {\bf Examples:}
  1251. \begin{flushleft}
  1252. \hspace*{0.1in}
  1253. \begin{math}
  1254. \begin{array}{ccc}
  1255. {\tt random\_matrix}(3,3,10) & = &
  1256. \left( \begin{array}{ccc} -4.729721 & 6.987047 & 7.521383 \\
  1257. - 5.224177 & 5.797709 & - 4.321952 \\
  1258. - 9.418455 & - 9.94318 & - 0.730980
  1259. \end{array} \right)
  1260. \end{array}
  1261. \end{math}
  1262. \end{flushleft}
  1263. \vspace*{0.2in}
  1264. \hspace*{0.165in}
  1265. {\tt on only\_integer, not\_negative, upper\_matrix, imaginary;}
  1266. \begin{flushleft}
  1267. \hspace*{0.12in}
  1268. \begin{math}
  1269. \begin{array}{ccc}
  1270. {\tt random\_matrix}(4,4,10) & = &
  1271. \left( \begin{array}{cccc} 2*i+5 & 3*i+7 & 7*i+3 & 6 \\ 0 & 2*i+5 &
  1272. 5*i+1 & 2*i+1 \\ 0 & 0 & 8 & i \\ 0 & 0 & 0& 5*i+9
  1273. \end{array} \right)
  1274. \end{array}
  1275. \end{math}
  1276. \end{flushleft}
  1277. \subsection{remove\_columns, remove\_rows}
  1278. %{\bf How to use it:}
  1279. \hspace*{0.175in} {\tt remove\_columns(${\cal A}$,column\_list);}
  1280. \hspace*{0.1in}
  1281. \begin{tabular}{l l l}
  1282. ${\cal A}$ &:-& a matrix. \\
  1283. column\_list &:-& either a positive integer or a list of
  1284. positive integers.
  1285. \end{tabular}
  1286. {\bf Synopsis:} %{\bf What it does:}
  1287. \hspace*{0.175in} {\tt remove\_columns} removes the columns specified in
  1288. column\_list from ${\cal A}$.
  1289. \hspace*{0.175in} {\tt remove\_rows} performs the same task on the rows
  1290. of ${\cal A}$.
  1291. {\bf Examples:}
  1292. \begin{flushleft}
  1293. \hspace*{0.1in}
  1294. \begin{math}
  1295. \begin{array}{ccc}
  1296. {\tt remove\_columns}({\cal A},2) & = &
  1297. \left( \begin{array}{cc} 1 & 3 \\ 4 & 6 \\ 7 & 9
  1298. \end{array} \right)
  1299. \end{array}
  1300. \end{math}
  1301. \end{flushleft}
  1302. \vspace*{0.1in}
  1303. \begin{flushleft}
  1304. \hspace*{0.1in}
  1305. \begin{math}
  1306. \begin{array}{ccc}
  1307. {\tt remove\_rows}({\cal A},\{1,3\}) & = &
  1308. \left( \begin{array}{ccc} 4 & 5 & 6
  1309. \end{array} \right)
  1310. \end{array}
  1311. \end{math}
  1312. \end{flushleft}
  1313. {\bf Related functions:}
  1314. \hspace*{0.175in} {\tt minor}.
  1315. \subsection{remove\_rows}
  1316. \hspace*{0.175in} see: {\tt remove\_columns}.
  1317. \subsection{row\_dim}
  1318. \hspace{0.175in} see: {\tt column\_dim}.
  1319. \subsection{rows\_pivot}
  1320. %{\bf How to use it:}
  1321. \hspace*{0.175in} {\tt rows\_pivot(${\cal A}$,r,c,\{row\_list\});}
  1322. \hspace*{0.1in}
  1323. \begin{tabular}{l l l}
  1324. ${\cal A}$ &:-& a matrix. \\
  1325. r,c &:-& positive integers such that ${\cal A}$(r,c) neq 0.\\
  1326. row\_list &:-& positive integer or a list of positive integers.
  1327. \end{tabular}
  1328. {\bf Synopsis:} %{\bf What it does:}
  1329. \begin{addtolength}{\leftskip}{0.22in}
  1330. {\tt rows\_pivot} performs the same task as {\tt pivot} but applies
  1331. the pivot only to the rows specified in row\_list.
  1332. \end{addtolength}
  1333. {\bf Examples:}
  1334. \begin{flushleft}
  1335. \hspace*{0.175in}
  1336. \begin{math}
  1337. {\cal N} = \left( \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 &
  1338. 9 \\1 & 2 & 3 \\ 4 & 5 & 6
  1339. \end{array} \right)
  1340. \end{math}
  1341. \end{flushleft}
  1342. \begin{flushleft}
  1343. \hspace*{0.1in}
  1344. \begin{math}
  1345. \begin{array}{ccc}
  1346. {\tt rows\_pivot}({\cal N},2,3,\{4,5\}) & = & \left( \begin{array}
  1347. {c c c}1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ -0.75 & 0 & 0.75 \\
  1348. -0.375 & 0 & 0.375
  1349. \end{array} \right)
  1350. \end{array}
  1351. \end{math}
  1352. \end{flushleft}
  1353. {\bf Related functions:}
  1354. \hspace*{0.175in} {\tt pivot}.
  1355. \subsection{simplex}
  1356. %{\bf How to use it:}
  1357. \hspace*{0.175in} {\tt simplex(max/min,objective function,\{linear
  1358. inequalities\});}
  1359. \hspace*{0.1in}
  1360. \begin{tabular}{l l l}
  1361. max/min & :- & \parbox[t]{.63\linewidth}{either max or min
  1362. (signifying maximise and minimise).} \\
  1363. objective function & :- & the function you are maximising or
  1364. minimising. \\
  1365. linear inequalities & :- & \parbox[t]{.63\linewidth}{the constraint
  1366. inequalities. Each one must be of the form
  1367. {\it sum of variables ($<=,=,>=$) number}.}
  1368. \end{tabular}
  1369. {\bf Synopsis:} %{\bf What it does:}
  1370. \begin{addtolength}{\leftskip}{0.22in}
  1371. {\tt simplex} applies the revised simplex algorithm to find the
  1372. optimal(either maximum or minimum) value of the objective function
  1373. under the linear inequality constraints.
  1374. It returns \{optimal value,\{ values of variables at this optimal\}\}.
  1375. The algorithm implies that all the variables are non-negative.
  1376. \end{addtolength}
  1377. {\bf Examples:}
  1378. \begin{addtolength}{\leftskip}{0.22in}
  1379. %\begin{math}
  1380. {\tt simplex($max,x+y,\{x>=10,y>=20,x+y<=25\}$);}
  1381. %\end{math}
  1382. {\tt ***** Error in simplex: Problem has no feasible solution.}
  1383. \vspace*{0.2in}
  1384. \parbox[t]{0.96\linewidth}{\tt simplex($max,10x+5y+5.5z,\{5x+3z<=200,
  1385. x+0.1y+0.5z<=12$,\\
  1386. \hspace*{0.55in} $0.1x+0.2y+0.3z<=9, 30x+10y+50z<=1500\}$);}
  1387. \vspace*{0.1in}
  1388. {\tt $\{525.0,\{x=40.0,y=25.0,z=0\}$\}}
  1389. \end{addtolength}
  1390. \subsection{squarep}
  1391. %{\bf How to use it:}
  1392. \hspace*{0.175in} {\tt squarep(${\cal A}$);}
  1393. \hspace*{0.1in}
  1394. \begin{tabular}{l l l}
  1395. ${\cal A}$ &:-& a matrix.
  1396. \end{tabular}
  1397. {\bf Synopsis:} %{\bf What it does:}
  1398. \begin{addtolength}{\leftskip}{0.22in}
  1399. {\tt squarep} is a boolean function that returns t if
  1400. the matrix is square and nil otherwise.
  1401. \end{addtolength}
  1402. {\bf Examples:}
  1403. \begin{flushleft}
  1404. \hspace*{0.175in}
  1405. \begin{math}
  1406. {\cal L} = \left( \begin{array}{ccc} 1 & 3 & 5
  1407. \end{array} \right)
  1408. \end{math}
  1409. \end{flushleft}
  1410. \vspace*{0.1in}
  1411. \hspace*{0.175in} {\tt squarep}(${\cal A}$) = t
  1412. \hspace*{0.175in} {\tt squarep}(${\cal L}$) = nil
  1413. {\bf Related functions:}
  1414. \hspace*{0.175in} {\tt matrixp}, {\tt symmetricp}.
  1415. \subsection{stack\_rows}
  1416. \hspace*{0.175in} see: {\tt augment\_columns}.
  1417. \subsection{sub\_matrix}
  1418. %{\bf How to use it:}
  1419. \hspace*{0.175in} {\tt sub\_matrix(${\cal A}$,row\_list,column\_list);}
  1420. \hspace*{0.1in}
  1421. \begin{tabular}{l l l}
  1422. ${\cal A}$ &:-& a matrix. \\
  1423. row\_list, column\_list &:-& \parbox[t]{.605\linewidth}{either a
  1424. positive integer or a list of positive integers.}
  1425. \end{tabular}
  1426. {\bf Synopsis:} %{\bf What it does:}
  1427. \begin{addtolength}{\leftskip}{0.22in}
  1428. {\tt sub\_matrix} produces the matrix consisting of the
  1429. intersection of the rows specified in row\_list and the
  1430. columns specified in column\_list.
  1431. \end{addtolength}
  1432. {\bf Examples:}
  1433. \begin{flushleft}
  1434. \hspace*{0.1in}
  1435. \begin{math}
  1436. \begin{array}{ccc}
  1437. {\tt sub\_matrix}({\cal A},\{1,3\},\{2,3\}) & = &
  1438. \left( \begin{array}{cc} 2 & 3 \\ 8 & 9
  1439. \end{array} \right)
  1440. \end{array}
  1441. \end{math}
  1442. \end{flushleft}
  1443. {\bf Related functions:}
  1444. \hspace*{0.175in} {\tt augment\_columns}, {\tt stack\_rows}.
  1445. \subsection{svd (singular value decomposition)}
  1446. %{\bf How to use it:}
  1447. \hspace*{0.175in} {\tt svd(${\cal A}$);}
  1448. \hspace*{0.1in}
  1449. \begin{tabular}{l l l}
  1450. ${\cal A}$ &:-& a matrix containing only numeric entries.
  1451. \end{tabular}
  1452. {\bf Synopsis:} %{\bf What it does:}
  1453. \begin{addtolength}{\leftskip}{0.22in}
  1454. {\tt svd} computes the singular value decomposition of ${\cal A}$.
  1455. It returns \{${\cal U},\sum,{\cal V}$\} where ${\cal A} = {\cal U}
  1456. \sum {\cal V}^T$ and $\sum = diag(\sigma_{1}, \ldots ,\sigma_{n}). \;
  1457. \sigma_{i}$ for $i= (1 \ldots n)$ are the singular values of ${\cal A}$.
  1458. n is the column dimension of ${\cal A}$.
  1459. The singular values of ${\cal A}$ are the non-negative square roots of
  1460. the eigenvalues of ${\cal A}^T {\cal A}$.
  1461. ${\cal U}$ and ${\cal V}$ are such that ${\cal UU}^T = {\cal VV}^T =
  1462. {\cal V}^T {\cal V} = {\cal I}_n$.
  1463. \end{addtolength}
  1464. {\bf Examples:}
  1465. \begin{flushleft}
  1466. \hspace*{0.175in}
  1467. \begin{math}
  1468. {\cal Q} = \left( \begin{array}{cc} 1 & 3 \\ -4 & 3
  1469. \end{array} \right)
  1470. \end{math}
  1471. \end{flushleft}
  1472. \begin{eqnarray}
  1473. \hspace*{0.1in}
  1474. {\tt svd({\cal Q})} & = &
  1475. \left\{
  1476. \left( \begin{array}{cc} 0.289784 & 0.957092 \\ -0.957092 &
  1477. 0.289784 \end{array} \right), \left( \begin{array}{cc} 5.149162 & 0 \\
  1478. 0 & 2.913094 \end{array} \right), \right. \nonumber \\ & & \left. \: \;
  1479. \, \left( \begin{array}{cc} -0.687215 & 0.726453 \\ -0.726453 &
  1480. -0.687215 \end{array} \right)
  1481. \right\} \nonumber
  1482. \end{eqnarray}
  1483. \subsection{swap\_columns, swap\_rows}
  1484. %{\bf How to use it:}
  1485. \hspace*{0.175in} {\tt swap\_columns(${\cal A}$,c1,c2);}
  1486. \hspace*{0.1in}
  1487. \begin{tabular}{l l l}
  1488. ${\cal A}$ &:-& a matrix. \\
  1489. c1,c1 &:-& positive integers.
  1490. \end{tabular}
  1491. {\bf Synopsis:} %{\bf What it does:}
  1492. \hspace*{0.175in}
  1493. {\tt swap\_columns} swaps column c1 of ${\cal A}$ with column c2.
  1494. \hspace*{0.175in} {\tt swap\_rows} performs the same task on 2 rows of
  1495. ${\cal A}$.
  1496. {\bf Examples:}
  1497. \begin{flushleft}
  1498. \hspace*{0.1in}
  1499. \begin{math}
  1500. \begin{array}{ccc}
  1501. {\tt swap\_columns}({\cal A},2,3) & = &
  1502. \left( \begin{array}{ccc} 1 & 3 & 2 \\ 4 & 6 & 5 \\ 7 & 9 & 8
  1503. \end{array} \right)
  1504. \end{array}
  1505. \end{math}
  1506. \end{flushleft}
  1507. {\bf Related functions:}
  1508. \hspace*{0.175in} {\tt swap\_entries}.
  1509. \subsection{swap\_entries}
  1510. %{\bf How to use it:}
  1511. \hspace*{0.175in} {\tt swap\_entries(${\cal A}$,\{r1,c1\},\{r2,c2\});}
  1512. \hspace*{0.1in}
  1513. \begin{tabular}{l l l}
  1514. ${\cal A}$ &:-& a matrix. \\
  1515. r1,c1,r2,c2 &:-& positive integers.
  1516. \end{tabular}
  1517. {\bf Synopsis:} %{\bf What it does:}
  1518. \hspace*{0.175in} {\tt swap\_entries} swaps ${\cal A}$(r1,c1) with
  1519. ${\cal A}$(r2,c2).
  1520. {\bf Examples:}
  1521. \begin{flushleft}
  1522. \hspace*{0.1in}
  1523. \begin{math}
  1524. \begin{array}{ccc}
  1525. {\tt swap\_entries}({\cal A},\{1,1\},\{3,3\}) & = &
  1526. \left( \begin{array}{ccc} 9 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 1
  1527. \end{array} \right)
  1528. \end{array}
  1529. \end{math}
  1530. \end{flushleft}
  1531. {\bf Related functions:}
  1532. \hspace*{0.175in} {\tt swap\_columns}, {\tt swap\_rows}.
  1533. \subsection{swap\_rows}
  1534. \hspace*{0.175in} see: {\tt swap\_columns}.
  1535. \subsection{symmetricp}
  1536. %{\bf How to use it:}
  1537. \hspace*{0.175in} {\tt symmetricp(${\cal A}$);}
  1538. \hspace*{0.1in}
  1539. \begin{tabular}{l l l}
  1540. ${\cal A}$ &:-& a matrix.
  1541. \end{tabular}
  1542. {\bf Synopsis:} %{\bf What it does:}
  1543. \begin{addtolength}{\leftskip}{0.22in}
  1544. {\tt symmetricp} is a boolean function that returns t if the
  1545. matrix is symmetric and nil otherwise.
  1546. \end{addtolength}
  1547. {\bf Examples:}
  1548. \begin{flushleft}
  1549. \hspace*{0.175in}
  1550. \begin{math}
  1551. {\cal M} = \left( \begin{array}{cc} 1 & 2 \\ 2 & 1
  1552. \end{array} \right)
  1553. \end{math}
  1554. \end{flushleft}
  1555. \vspace*{0.1in}
  1556. \hspace*{0.175in} {\tt symmetricp}(${\cal A}$) = nil
  1557. \hspace*{0.175in} {\tt symmetricp}(${\cal M}$) = t
  1558. {\bf Related functions:}
  1559. \hspace*{0.175in} {\tt matrixp}, {\tt squarep}.
  1560. \subsection{toeplitz}
  1561. %{\bf How to use it:}
  1562. \hspace*{0.175in} {\tt toeplitz(\{\exprlist{}\});} \lazyfootnote{}
  1563. \hspace*{0.1in}
  1564. \begin{tabular}{l l l}
  1565. \exprlist{} &:-& algebraic expressions.
  1566. \end{tabular}
  1567. {\bf Synopsis:} %{\bf What it does:}
  1568. \begin{addtolength}{\leftskip}{0.22in}
  1569. {\tt toeplitz} creates the toeplitz matrix from the
  1570. expression list.
  1571. This is a square symmetric matrix in
  1572. which the first expression is placed on the diagonal
  1573. and the i'th expression is placed on the (i-1)'th sub
  1574. and super diagonals.
  1575. It has dimension n where n is the
  1576. number of expressions.
  1577. \end{addtolength}
  1578. {\bf Examples:}
  1579. \begin{flushleft}
  1580. \hspace*{0.1in}
  1581. \begin{math}
  1582. \begin{array}{ccc}
  1583. {\tt toeplitz}(\{w,x,y,z\}) & = &
  1584. \left( \begin{array}{cccc} w & x & y & z \\ x & w & x & y \\
  1585. y & x & w & x \\ z & y & x & w
  1586. \end{array} \right)
  1587. \end{array}
  1588. \end{math}
  1589. \end{flushleft}
  1590. \subsection{Vandermonde}
  1591. %{\bf How to use it:}
  1592. \hspace*{0.175in} {\tt vandermonde}(\{\exprlist{}\}); \addtocounter
  1593. {footnote}{-1}\footnotemark
  1594. %\lazyfootnote{}
  1595. \hspace*{0.1in}
  1596. \begin{tabular}{l l l}
  1597. \exprlist{} &:-& algebraic expressions.
  1598. \end{tabular}
  1599. {\bf Synopsis:} %{\bf What it does:}
  1600. \begin{addtolength}{\leftskip}{0.22in}
  1601. {\tt Vandermonde} creates the Vandermonde matrix from
  1602. the expression list.
  1603. This is the square matrix in which
  1604. the (i,$\,$j)'th entry is expr\_list(i) $^{(j-1)}$.
  1605. It has dimension n where n is the number of expressions.
  1606. \end{addtolength}
  1607. {\bf Examples:}
  1608. \begin{flushleft}
  1609. \hspace*{0.1in}
  1610. \begin{math}
  1611. \begin{array}{ccc}
  1612. {\tt vandermonde}(\{x,2*y,3*z\}) & = &
  1613. \left( \begin{array}{ccc} 1 & x & x^2 \\ 1 & 2*y & 4*y^2 \\ 1
  1614. & 3*z & 9*z^2
  1615. \end{array} \right)
  1616. \end{array}
  1617. \end{math}
  1618. \end{flushleft}
  1619. \subsection{kronecker\_product}
  1620. \hspace*{0.175in} {\tt kronecker\_product}($Mat_1,Mat_2$)
  1621. \hspace*{0.1in}
  1622. \begin{tabular}{l l l}
  1623. $Mat_1,Mat_2$ &:-& Matrices
  1624. \end{tabular}
  1625. {\bf Synopsis:}
  1626. \begin{addtolength}{\leftskip}{0.22in}
  1627. {\tt kronecker\_product} creates a matrix containing the Kronecker product
  1628. (also called {\tt direct product} or {\tt tensor product}) of its arguments.
  1629. \end{addtolength}
  1630. {\bf Examples:}
  1631. \begin{verbatim}
  1632. a1 := mat((1,2),(3,4),(5,6))$
  1633. a2 := mat((1,1,1),(2,z,2),(3,3,3))$
  1634. kronecker_product(a1,a2);
  1635. \end{verbatim}
  1636. \begin{flushleft}
  1637. \hspace*{0.1in}
  1638. \begin{math}
  1639. \begin{array}{ccc}
  1640. \left( \begin{array}{cccccc} 1 & 1 & 1 & 2 & 2 & 2 \\
  1641. 2 & z & 2 & 4 &2*z &4 \\
  1642. 3 & 3 & 3 & 6 & 6 &6 \\
  1643. 3 & 3 & 3 & 4 & 4 &4 \\
  1644. 6 & 3*z& 6 & 8 &4*z &8 \\
  1645. 9 & 9 & 9 & 12 &12 &12\\
  1646. 5 & 5 & 5 & 6 & 6 &6 \\
  1647. 10 &5*z& 10& 12 &6*z &12 \\
  1648. 15 &15 & 15& 18 &18 &18 \end{array} \right)
  1649. \end{array}
  1650. \end{math}
  1651. \end{flushleft}
  1652. \section{Fast Linear Algebra}
  1653. By turning the {\tt fast\_la} switch on, the speed of the following
  1654. functions will be increased:
  1655. \begin{tabular}{l l l l}
  1656. add\_columns & add\_rows & augment\_columns & column\_dim \\
  1657. copy\_into & make\_identity & matrix\_augment & matrix\_stack\\
  1658. minor & mult\_column & mult\_row & pivot \\
  1659. remove\_columns & remove\_rows & rows\_pivot & squarep \\
  1660. stack\_rows & sub\_matrix & swap\_columns & swap\_entries\\
  1661. swap\_rows & symmetricp
  1662. \end{tabular}
  1663. The increase in speed will be insignificant unless you are making a
  1664. significant number(i.e: thousands) of calls. When using this switch,
  1665. error checking is minimised. This means that illegal input may give
  1666. strange error messages. Beware.
  1667. \newpage
  1668. \section{Acknowledgments}
  1669. Many of the ideas for this package came from the Maple[3] Linalg package
  1670. [4].
  1671. The algorithms for {\tt cholesky}, {\tt lu\_decom}, and {\tt svd} are
  1672. taken from the book Linear Algebra - J.H. Wilkinson \& C. Reinsch[5].
  1673. The {\tt gram\_schmidt} code comes from Karin Gatermann's Symmetry
  1674. package[6] for {\REDUCE}.
  1675. \begin{thebibliography}{}
  1676. \bibitem{matt} Matt Rebbeck: NORMFORM: A {\REDUCE} package for the
  1677. computation of various matrix normal forms. ZIB, Berlin. (1993)
  1678. \bibitem{Reduce} Anthony C. Hearn: {\REDUCE} User's Manual 3.6.
  1679. RAND (1995)
  1680. \bibitem{Maple} Bruce W. Char\ldots [et al.]: Maple (Computer
  1681. Program). Springer-Verlag (1991)
  1682. \bibitem{linalg} Linalg - a linear algebra package for Maple[3].
  1683. \bibitem{WiRe} J. H. Wilkinson \& C. Reinsch: Linear Algebra
  1684. (volume II). Springer-Verlag (1971)
  1685. \bibitem{gat} Karin Gatermann: Symmetry: A {\REDUCE} package for the
  1686. computation of linear representations of groups. ZIB, Berlin. (1992)
  1687. \end{thebibliography}
  1688. \end{document}