1 2\iffalse 3The revised version of ORTHOVEC is a collection of REDUCE 3.4 procedures and 4operations which provide a simple to use environment for the manipulation of 5scalars and vectors. Operations include addition, subtraction, dot and cross 6products, division, modulus, div, grad, curl, laplacian, differentiation, 7integration, ${\bf a \cdot \nabla}$ and Taylor expansion. 8\fi 9Version 2 is 10summarized in \cite{Eastwood:91}. It differs from the original (\cite 11{Eastwood:87}) in revised notation and extended capabilities. 12 13%\begin{center} 14%{\Large{\bf New Version Summary}} 15%\end{center} 16%\begin{tabular}{ll} 17%\underline{Title of program}:&ORTHOVEC\\[2ex] 18%\underline{Catalogue number}:&AAXY\\[2ex] 19%\underline{Program obtainable from}: &CPC Program Library,\\ 20%&Queen's University of Belfast, N.~Ireland\\[2ex] 21%\underline{Reference to original program}: &CPC 47 (1987) 139-147\\[2ex] 22%\underline{Operating system}:&UNIX, MS-DOS + ARM-OS\\[2ex] 23%\underline{Programming Language used}: &REDUCE 3.4\\[2ex] 24%\underline{High speed storage required}: &As for 25%the underlying PSL/REDUCE \\ 26%&system, typically $>$ 1 Megabyte\\[2ex] 27%\underline{No. of lines in combined programs and test deck}:&600 \\[2ex] 28%\underline{Keywords}: & Computer Algebra, Vector Analysis,\\ 29%& series Expansion, Plasma Physics, \\ 30%&Hydrodynamics, Electromagnetics.\\[2ex] 31%\underline{Author of original program}: &James W. EASTWOOD\\[2ex] 32%\underline{Nature of Physical Problem}: 33%&There is a wide range using vector\\ 34%& calculus in orthogonal curvilinear coordinates\\ 35%& and vector integration, differentiation\\ 36%& and series expansion.\\[2ex] 37%\underline{Method of Solution}: & computer aided algebra using\\ 38%&standard orthogonal curvilinear coordinates\\ 39%&for differential and integral operators.\\[2ex] 40%\underline{Typical running time}: 41%& This is strongly problem dependent:\\ 42%&the test examples given took respectively\\ 43%& 10,19 and 48 seconds on a SUN 4/310,\\ 44%&SUN 4/110 and ACORN Springboard. \\[2ex] 45%\underline{Unusual Features of the Program}: 46%&The REDUCE procedures use\\ 47%&LISP vectors \cite{r2} 48%to provide a compact\\ 49%&mathematical notation similar\\ 50%& to that normally found in vector\\ 51%& analysis textbooks.\\ 52%\end{tabular} 53 54\subsection{Introduction} 55The revised version of ORTHOVEC\cite{Eastwood:91} is, like the 56original\cite{Eastwood:87}, a collection of REDUCE procedures and 57operators designed to simplify the machine aided manipulation of vectors 58and vector expansions frequently met in many areas of applied mathematics. 59The revisions have been introduced for two reasons: firstly, to add extra 60capabilities missing from the original and secondly, to tidy up input and 61output to make the package easier to use. 62 63The changes from Version 1 include: 64\begin{enumerate} 65\item merging of scalar and vector unary and binary operators, $+, - , *, / 66$ 67\item extensions of the definitions of division and exponentiation 68to vectors 69\item new vector dependency procedures 70\item application of l'H\^opital's rule in limits and Taylor expansions 71\item a new component selector operator 72\item algebraic mode output of LISP vector components 73\end{enumerate} 74 75The LISP vector primitives are again used to store vectors, although 76with the introduction of LIST types in algebraic mode in REDUCE 773.4, the implementation may have been more simply achieved 78using lists to store vector components. 79 80The philosophy used in Version 2 follows that used in the original: 81namely, algebraic mode is used wherever possible. The view is taken 82that some computational inefficiencies are acceptable if it allows 83coding to be intelligible to (and thence adaptable by) users other 84than LISP experts familiar with the internal workings of REDUCE. 85 86Procedures and operators in ORTHOVEC fall into the five classes: 87initialisation, input-output, algebraic operations, differential 88operations and integral operations. Definitions are given in 89the following sections, and 90a summary of the procedure names and their meanings are give in Table 1. 91The final section discusses test examples. 92 93\subsection{Initialisation}\label{vstart} 94\ttindex{VSTART} 95The procedure VSTART initialises ORTHOVEC. It may be 96called after ORTHOVEC has been INputted (or LOADed if a fast load 97version has been made) to reset coordinates. VSTART provides a 98menu of standard coordinate systems:- 99 100 101\begin{enumerate} 102\index{Cartesian coordinates}\index{Coordinates!cartesian} 103\item cartesian $(x, y, z) = $ {\tt (x, y, z)} 104\index{Cylindrical coordinates}\index{Coordinates!cylindrical} 105\item cylindrical $(r, \theta, z) = $ {\tt (r, th, z)} 106\index{Spherical coordinates}\index{coordinates!spherical} 107\item spherical $(r, \theta, \phi) = $ {\tt (r, th, ph) } 108\item general $( u_1, u_2, u_3 ) = $ {\tt (u1, u2, u3) } 109\item others 110\end{enumerate} 111 112which the user selects by number. Selecting options (1)-(4) 113automatically sets up the coordinates and scale factors. Selection 114option (5) shows the user how to select another coordinate system. If 115VSTART is not called, then the default cartesian coordinates are used. 116ORTHOVEC may be re-initialised to a new coordinate system at any time 117during a given REDUCE session by typing 118\begin{verbatim} 119VSTART $. 120\end{verbatim} 121 122\subsection{Input-Output} 123 124ORTHOVEC assumes all quantities are either scalars or 3 component 125vectors. To define a vector $a$ with components $(c_1, c_2, c_3)$ use 126the procedure SVEC as follows \ttindex{SVEC} 127\begin{verbatim} 128a := svec(c1, c2, c3); 129\end{verbatim} 130 131The standard REDUCE output for vectors when using the terminator ``$;$'' 132is to list the three components inside square brackets 133$[\cdots]$, with each component in prefix form. A replacement for the 134standard REDUCE procedure MAPRIN is included in 135the package to change the 136output of LISP vector components to algebraic notation. The procedure 137\ttindex{VOUT} VOUT (which returns the value of its argument) 138can be used to give labelled output of components 139in algebraic form: e.g., 140\begin{verbatim} 141b := svec (sin(x)**2, y**2, z)$ 142vout(b)$ 143\end{verbatim} 144 145The operator {\tt \_} can be used to select a particular 146component (1, 2 or 3) for output e.g. 147\begin{verbatim} 148b_1 ; 149\end{verbatim} 150 151\subsection{Algebraic Operations} 152 153Six infix operators, sum, difference, quotient, times, exponentiation 154and cross product, and four prefix 155operators, plus, minus, reciprocal 156and modulus are defined in ORTHOVEC. These operators can take suitable 157combinations of scalar and vector arguments, 158and in the case of scalar arguments reduce to the usual definitions of 159$ +, -, *, /, $ etc. 160 161The operators are represented by symbols 162\ttindextype{+}{operator!3-D vectors} 163\ttindextype{-}{operator!3-D vectors} 164\ttindextype{/}{operator!3-D vectors} 165\ttindextype{*}{operator!3-D vectors} 166\ttindextype{"\^}{operator!3-D vectors} 167\ttindextype{><}{(cross product) operator!3-D vectors} 168\begin{verbatim} 169+, -, /, *, ^, >< 170\end{verbatim} 171The composite \texttt{><} is an 172attempt to represent the cross product symbol 173$\times$ in ASCII characters. 174If we let $\mathbf{v}$ be a vector and $s$ be a scalar, then 175valid combinations of arguments of the 176procedures and operators and the type of the result 177are as summarised below. The notation used is\\ 178\emph{result :=procedure(left argument, right argument) } or\\ 179\emph{result :=(left operand) operator (right operand) } . 180 181\newpage 182\underline{Vector Addition} \\ 183\ttindex{VECTORPLUS} \ttindex{VECTORADD} \index{Vector!addition} 184\begin{tabular}{rclcrcl} 185{\bf v} &:=& VECTORPLUS({\bf v}) &{\rm or}& {\bf v} &:=& + {\bf v} \\ 186 s &:=& VECTORPLUS(s) &{\rm or} & s &:=& + s \\ 187{\bf v} &:=& VECTORADD({\bf v},{\bf v}) &{\rm or }& {\bf v} &:=& 188{\bf v} + {\bf v} \\ 189 s &:=& VECTORADD(s,s) &{\rm or }& s &:=& s + s \\ 190\end{tabular} 191 192\underline{Vector Subtraction} \\ 193\ttindex{VECTORMINUS} \ttindex{VECTORDIFFERENCE} \index{Vector!subtraction} 194\begin{tabular}{rclcrcl} 195{\bf v} &:=& VECTORMINUS({\bf v}) &{\rm or}& 196 {\bf v} &:=& - {\bf v} \\ 197 s &:=& VECTORMINUS(s) &{\rm or} & s &:=& - s \\ 198{\bf v} &:=& VECTORDIFFERENCE({\bf v},{\bf v}) &{\rm or }& {\bf v} &:=& 199 {\bf v} - {\bf v} \\ 200 s &:=& VECTORDIFFERENCE(s,s) &{\rm or }& s &:=& s - s \\ 201\end{tabular} 202 203\underline{Vector Division}\\ 204\ttindex{VECTORRECIP} \ttindex{VECTORQUOTIENT} \index{Vector!division} 205\begin{tabular}{rclcrcl} 206{\bf v} &:=& VECTORRECIP({\bf v}) &{\rm or}& {\bf v} &:=& / 207{\bf v} \\ 208 s &:=& VECTORRECIP(s) &{\rm or} & s &:=& / s \\ 209{\bf v} &:=& VECTORQUOTIENT({\bf v},{\bf v}) &{\rm or }& {\bf v} &:=& 210{\bf v} / {\bf v} \\ 211{\bf v} &:=& VECTORQUOTIENT({\bf v}, s ) &{\rm or }& {\bf v} &:=& 212{\bf v} / s \\ 213{\bf v} &:=& VECTORQUOTIENT( s ,{\bf v}) &{\rm or }& {\bf v} &:=& 214 s / {\bf v} \\ 215 s &:=& VECTORQUOTIENT(s,s) &{\rm or }& s &:=& s / s 216 \\ 217\end{tabular} 218 219\underline{Vector Multiplication}\\ 220\ttindex{VECTORTIMES} \index{Vector!multiplication} 221\begin{tabular}{rclcrcl} 222{\bf v} &:=& VECTORTIMES( s ,{\bf v}) &{\rm or }& {\bf v} &:=& 223s * {\bf v} \\ 224{\bf v} &:=& VECTORTIMES({\bf v}, s ) &{\rm or }& {\bf v} &:=& {\bf 225 v} * s \\ 226 s &:=& VECTORTIMES({\bf v},{\bf v}) &{\rm or }& s &:=& {\bf 227 v} * {\bf v} \\ 228 s &:=& VECTORTIMES( s , s ) &{\rm or }& s &:=& 229s * s \\ 230\end{tabular} 231 232\underline{Vector Cross Product} \\ 233\ttindex{VECTORCROSS} \index{Cross product} \index{Vector!cross product} 234\begin{tabular}{rclcrcl} 235{\bf v} &:=& VECTORCROSS({\bf v},{\bf v}) &{\rm or }& {\bf v} &:=& {\bf 236 v} $\times$ {\bf v} \\ 237\end{tabular} 238 239\underline{Vector Exponentiation}\\ 240\ttindex{VECTOREXPT} \index{Vector!exponentiation} 241\begin{tabular}{rclcrcl} 242 s &:=& VECTOREXPT ({\bf v}, s ) &{\rm or }& s &:=& {\bf 243 v} \^{} s \\ 244 s &:=& VECTOREXPT ( s , s ) &{\rm or }& s &:=& s 245 \^{} s \\ 246\end{tabular} 247 248\underline{Vector Modulus}\\ 249\ttindex{VMOD} \index{Vector!modulus} 250\begin{tabular}{rcl} 251 s &:=& VMOD (s)\\ 252 s &:=& VMOD ({\bf v}) \\ 253\end{tabular} 254 255All other combinations of operands for these operators lead to error 256messages being issued. The first two instances of vector 257multiplication are scalar multiplication of vectors, the third is the 258\index{Vector!dot product} \index{Vector!inner product} 259\index{Inner product} \index{Dot product} 260product of two scalars and the last is the inner (dot) product. The 261unary operators \texttt{+, -, /} can take either scalar or vector 262arguments and return results of the same type as their arguments. 263VMOD returns a scalar. 264 265In compound expressions, parentheses may be used to specify the order of 266combination. If parentheses are omitted the ordering of the 267operators, in increasing order of precedence is 268\begin{verbatim} 269+ | - | dotgrad | * | >< | ^ | _ 270\end{verbatim} 271and these are placed in the precedence list defined in REDUCE 272after $<$. 273The differential operator DOTGRAD is defined in the \ttindextype{DOTGRAD}{operator} 274following section, and the component selector {\tt \_} was introduced in 275section 3. 276 277Vector divisions are defined as follows: If ${\bf a}$ and ${\bf b}$ are 278vectors and $c$ is a scalar, then 279\begin{eqnarray*} 280{\bf a} / {\bf b} & = & \frac{{\bf a} \cdot {\bf b}}{ \mid {\bf b} 281\mid^2}\\ 282c / {\bf a} & = & \frac{c {\bf a} }{ \mid {\bf a} \mid^2} 283\end{eqnarray*} 284 285Both scalar multiplication and dot products are given by the same symbol, 286braces are advisable to ensure the correct 287precedences in expressions such as $({\bf a} \cdot {\bf b}) 288({\bf c} \cdot {\bf d})$. 289 290Vector exponentiation is defined as the power of the modulus:\\ 291${\bf a}^n \equiv {\rm VMOD}(a)^n = \mid {\bf a} \mid^n$ 292 293\subsection{Differential Operations} 294Differential operators provided are div, grad, curl, delsq, and dotgrad. 295\ttindextype{DIV}{operator} \ttindextype{GRAD}{operator}\ttindextype{CURL}{operator} 296\ttindextype{DELSQ}{ operator} \ttindextype{DOTGRAD}{operator} 297All but the last of these are prefix operators having a single 298vector or scalar argument as appropriate. Valid combinations of 299operator and argument, and the type of the result are shown in table~\ref{vvecttable}. 300 301 302\begin{table}[!tbp] 303\begin{center} 304\begin{tabular}{rcl} 305s & := & div ({\bf v}) \\ 306{\bf v} & := & grad(s) \\ 307{\bf v} & := & curl({\bf v}) \\ 308{\bf v} & := & delsq({\bf v}) \\ 309 s & := & delsq(s) \\ 310{\bf v} & := & {\bf v} dotgrad {\bf v} \\ 311 s & := & {\bf v} dotgrad s 312\end{tabular} 313\end{center} 314\caption{ORTHOVEC valid combinations of operator and argument}\label{vvecttable} 315\end{table} 316 317All other combinations of operator and argument type cause error 318messages to be issued. The differential operators have their usual 319meanings~\cite{Spiegel:59}. The coordinate system used by these operators is 320set by invoking VSTART (cf. Sec.~\ref{vstart}). The names {\tt h1}, 321{\tt h2} and {\tt h3 } are 322reserved for the scale factors, and {\tt u1}, {\tt u2} and {\tt u3} are 323used for the coordinates. 324 325A vector extension, VDF, of the REDUCE procedure DF allows the 326differentiation of a vector (scalar) with respect to a scalar to be 327performed. Allowed forms are \ttindex{VDF} 328VDF({\bf v}, s) $\rightarrow$ {\bf v} and 329VDF(s, s) $\rightarrow$ s , 330where, for example 331\begin{eqnarray*} 332{\tt vdf( B,x)} \equiv \frac{\partial {\bf B}}{\partial x} 333\end{eqnarray*} 334 335The standard REDUCE procedures DEPEND and NODEPEND have been redefined 336to allow dependences of vectors to be compactly 337defined. For example \index{DEPEND statement} \index{NODEPEND statement} 338\begin{verbatim} 339a := svec(a1,a2,a3)$; 340depend a,x,y; 341\end{verbatim} 342causes all three components {\tt a1},{\tt a2} and {\tt a3} of {\tt a} 343to be treated as functions of {\tt x} and {\tt y}. 344Individual component dependences can still be defined if desired. 345\begin{verbatim} 346depend a3,z; 347\end{verbatim} 348 349The procedure VTAYLOR gives truncated Taylor series expansions of scalar 350or vector functions:- \ttindex{VTAYLOR} 351\begin{verbatim} 352vtaylor(vex,vx,vpt,vorder); 353\end{verbatim} 354returns the series expansion of the expression 355VEX with respect to variable VX \ttindex{VORDER} 356about point VPT to order VORDER. Valid 357combinations of argument types are shown in table~\ref{ORTHOVEC:validexp}. 358 359\begin{table} 360\begin{center} 361\begin{tabular}{cccc} 362VEX & VX & VPT & VORDER \\[2ex] 363{\bf v} & {\bf v} & {\bf v} & {\bf v}\\ 364{\bf v} & {\bf v} & {\bf v} & s\\ 365{\bf v} & s & s & s \\ 366s & {\bf v} & {\bf v} & {\bf v} \\ 367s & {\bf v} & {\bf v} & s\\ 368s & s & s & s\\ 369\end{tabular} 370\end{center} 371\caption{ORTHOVEC valid combination of argument types.}\label{ORTHOVEC:validexp} 372\end{table} 373 374Any other combinations cause error messages to be issued. Elements of 375VORDER must be non-negative integers, otherwise error messages are 376issued. If scalar VORDER is given for a vector expansion, expansions 377in each component are truncated at the same order, VORDER. 378 379The new version of Taylor expansion applies \index{l'H\^opital's rule} 380l'H\^opital's rule in evaluating coefficients, so handle cases such as 381$\sin(x) / (x) $ , etc. which the original version of ORTHOVEC could 382not. The procedure used for this is LIMIT, \ttindex{LIMIT} which can 383be used directly to find the limit of a scalar function {\tt ex} of 384variable {\tt x} at point {\tt pt}:- 385 386\begin{verbatim} 387ans := limit(ex,x,pt); 388\end{verbatim} 389 390\subsection{Integral Operations} 391Definite and indefinite vector, volume and scalar line integration 392procedures are included in ORTHOVEC. They are defined as follows: 393\ttindex{VINT} \ttindex{DVINT} 394\ttindex{VOLINT} \ttindex{DVOLINT} \ttindex{LINEINT} \ttindex{DLINEINT} 395\begin{eqnarray*} 396{\rm VINT} ({\bf v},x) & = & \int {\bf v}(x)dx\\ 397% 398{\rm DVINT} ({\bf v},x, a, b) & = & \int^b_a {\bf v} (x) dx\\ 399% 400{\rm VOLINT} ({\bf v}) & = & \int {\bf v} h_1 h_2 h_3 du_1 du_2 du_3\\ 401% 402{\rm DVOLINT}({\bf v},{\bf l},{\bf u},n) & = & \int^{\bf u}_{\bf l} 403{\bf v} h_1 h_2 h_3 du_1 du_2 du_3\\ 404% 405{\rm LINEINT} ({\bf v, \omega}, t) & = & \int {\bf v} \cdot {\bf dr} 406\equiv \int v_i h_i \frac{\partial \omega_i}{\partial t} dt\\ 407% 408{\rm DLINEINT} ({\bf v, \omega} t, a, b) & = & \int^b_a v_i h_i 409\frac{\partial \omega_i}{\partial t} dt\\ 410\end{eqnarray*} 411 412In the vector and volume integrals, ${\bf v}$ are vector or scalar, 413$a, b,x$ and $n$ are scalar. Vectors ${\bf l}$ and ${\bf u}$ contain 414expressions for lower and upper bounds to the integrals. The integer 415index $n$ defines the order in which the integrals over $u_1, u_2$ and 416$u_3$ are performed in order to allow for functional dependencies in 417the integral bounds: 418 419\begin{center} 420\begin{tabular}{ll} 421n & order\\ 1 & $u_1~u_2~u_3$\\ 422% 4232 & $u_3~u_1~u_2$\\ 424% 4253 & $u_2~u_3~u_1$\\ 426% 4274 & $u_1~u_3~u_2$\\ 428% 4295 & $u_2~u_1~u_3$\\ otherwise & $u_3~u_2~u_1$\\ 430\end{tabular} 431\end{center} 432 433 434The vector ${\bf \omega}$ in the line integral's arguments contain 435explicit paramterisation of the coordinates $u_1, u_2, u_3$ of the 436line ${\bf u}(t)$ along which the integral is taken. 437 438\begin{table} 439\begin{center} 440\begin{tabular}{|l c l|} \hline 441\multicolumn{1}{|c}{Procedures} & & \multicolumn{1}{c|}{Description} \\ \hline 442VSTART & & select coordinate 443system \\ & & \\ SVEC & & set up a vector \\ VOUT & & output a vector 444\\ VECTORCOMPONENT & \_ & extract a vector component (1-3) \\ & & \\ 445VECTORADD & + & add two vectors or scalars \\ 446VECTORPLUS & + & unary vector or scalar plus\\ 447VECTORMINUS & - & unary vector or scalar minus\\ 448VECTORDIFFERENCE & - & subtract two vectors or scalars \\ 449VECTORQUOTIENT & / & vector divided by scalar \\ 450VECTORRECIP & / & unary vector or scalar division \\ & & \ \ \ (reciprocal)\\ 451VECTORTIMES & * & multiply vector or scalar by \\ & & \ \ \ vector/scalar \\ 452VECTORCROSS & $><$ & cross product of two vectors \\ 453VECTOREXPT & \^{} & exponentiate vector modulus or scalar \\ 454VMOD & & length of vector or scalar \\ \hline 455\end{tabular} 456\end{center} 457\caption{Procedures names and operators used in ORTHOVEC (part 1)} 458\end{table} 459 460\begin{table} 461\begin{center} 462\begin{tabular}{|l l|} \hline 463\multicolumn{1}{|c}{Procedures} & \multicolumn{1}{c|}{Description} \\ \hline 464DIV & divergence of vector \\ 465GRAD & gradient of scalar \\ 466CURL & curl of vector \\ 467DELSQ & laplacian of scalar or vector \\ 468DOTGRAD & (vector).grad(scalar or vector) \\ & \\ 469VTAYLOR & vector or scalar Taylor series of vector or scalar \\ 470VPTAYLOR & vector or scalar Taylor series of scalar \\ 471TAYLOR & scalar Taylor series of scalar \\ 472LIMIT & limit of quotient using l'H\^opital's rule \\ & \\ 473VINT & vector integral \\ 474DVINT & definite vector integral \\ 475VOLINT & volume integral \\ 476DVOLINT & definite volume integral \\ 477LINEINT & line integral \\ 478DLINEINT & definite line integral \\ & \\ 479MAPRIN & vector extension of REDUCE MAPRIN \\ 480DEPEND & vector extension of REDUCE DEPEND \\ 481NODEPEND & vector extension of REDUCE NODEPEND \\ \hline 482\end{tabular} 483\end{center} 484\caption{Procedures names and operators used in ORTHOVEC (part 2)} 485\end{table} 486 487 488\subsection{Test Cases} 489 490To use the REDUCE source version of ORTHOVEC, initiate a REDUCE 491session and then IN the file {\em orthovec.red} containing ORTHOVEC. 492However, it is recommended that for efficiency a compiled fast loading 493version be made and LOADed when required (see Sec.~18 of the REDUCE 494manual). If coordinate dependent differential and integral operators 495other than cartesian are needed, then VSTART must be used to reset 496coordinates and scale factors. 497 498Six simple examples are given in the Test Run Output file 499{\em orthovectest.log} to illustrate the working of ORTHOVEC. 500The input lines were taken from the file 501{\em orthovectest.red} (the Test Run Input), but could 502equally well be typed in at the Terminal. 503 504\example\index{Orthovec package@\textsc{Orthovec} package!example} 505 506Show that 507\begin{eqnarray*} 508({\bf a} \times {\bf b}) \cdot ({\bf c} \times {\bf d}) - ({\bf a} 509\cdot {\bf c})({\bf b} \cdot {\bf d}) 510 + ({\bf a} \cdot {\bf d})({\bf b} \cdot {\bf c}) \equiv 0 511\end{eqnarray*} 512 513\example\index{Orthovec package@\textsc{Orthovec} package!example}\label{ORTHOVEC:eqm} 514 515Write the equation of motion 516\begin{eqnarray*} 517\frac{\partial {\bf v}}{\partial t} + {\bf v} \cdot {\bf \nabla v} 518+ {\bf \nabla} p - curl ({\bf B}) \times {\bf B} 519\end{eqnarray*} 520in cylindrical coordinates. 521 522\example\index{Orthovec package@\textsc{Orthovec} package!example}\label{ORTHOVEC:taylor} 523 524Taylor expand 525\begin{itemize} 526\item $\sin(x) \cos(y) +e^z$ 527about the point $(0,0,0)$ to third order in $x$, fourth order in $y$ and 528fifth order in $z$. 529 530\item $\sin(x)/x$ about $x$ to fifth order. 531 532\item ${\bf v}$ about ${\bf x}=(x,y,z)$ to fifth order, where 533${\bf v} = (x/ \sin(x),(e^y-1)/y,(1+z)^{10})$. 534\end{itemize} 535 536\example\index{Orthovec package@\textsc{Orthovec} package!example} 537 538Obtain the second component of the equation of motion in 539example~\ref{ORTHOVEC:eqm}, and the first component of the final 540vector Taylor series in example~\ref{ORTHOVEC:taylor}. 541 542\example\index{Orthovec package@\textsc{Orthovec} package!example} 543 544Evaluate the line integral 545\begin{eqnarray*} 546\int^{{\bf r}_2}_{{\bf r}_1} {\bf A} \cdot d{\bf r} 547\end{eqnarray*} 548from point ${\bf r}_1 = (1,1,1)$ to point 549${\bf r}_2 = (2,4,8)$ along the path $(x,y,z) = (s, s^2, s^3)$ where 550\begin{eqnarray*} 551{\bf A} = (3x^2 + 5y) {\bf i} - 12xy{\bf j} + 2xyz^2{\bf k} 552\end{eqnarray*} 553and $({\bf i, j, k})$ are unit vectors in the ($x,y,z$) directions. 554 555\example\index{Orthovec package@\textsc{Orthovec} package!example} 556 557Find the volume $V$ common to the intersecting cylinders $x^2 + y^2 558= r^2$ and $x^2 + z^2 = r^2$ i.e. evaluate 559\begin{eqnarray*} 560V = 8 \int^r_0 dx \int^{ub}_0 dy \int^{ub}_0 dz 561\end{eqnarray*} 562where $ub = \overline{\sqrt { r^2 - x^2}}$ 563