(*^ ::[ frontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.1"; macintoshStandardFontEncoding; paletteColors = 128; automaticGrouping; currentKernel; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; ; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; ; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = leftheader, inactive, L2, 12, "Times"; ; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; ; fontset = leftfooter, inactive, L2, 12, "Times"; ; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; ; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; ; ] :[font = title; inactive; Cclosed; preserveAspect; startGroup; ] Chapter 1 Introduction ;[s] 2:0,0;10,1;23,-1; 2:1,25,18,Times,1,24,0,0,0;1,25,18,Times,0,24,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] 1.4 Mathematical Preliminaries :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Example 1.3 :[font = text; inactive; preserveAspect; ] The evaluation of the Wronskian is straightforward if only two functions are involved, but can become quite cumbersome for a larger number of functions. Mathematica can be used to carry out the required operations. The array of functions fk[x] is first defined as the vector F. In the example below, this is carried out for three functions, though the procedure can be extended to any number of functions. ;[s] 7:0,1;154,2;165,1;239,2;245,1;277,2;278,1;409,-1; 3:0,13,9,Times,0,12,0,0,0;4,15,11,Times,0,14,0,0,0;3,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] F={f1[x],f2[x],f3[x]} :[font = output; output; inactive; preserveAspect; endGroup; ] {f1[x], f2[x], f3[x]} ;[o] {f1[x], f2[x], f3[x]} :[font = text; inactive; preserveAspect; ] The functions f1[x], f2[x], and f3[x] are generic; specific functions will be used below. The Wronskian is then assembled as a Table: ;[s] 10:0,0;1,1;15,2;20,1;22,2;27,1;33,2;38,1;129,2;134,1;137,-1; 3:1,13,9,Times,0,12,0,0,0;5,15,11,Times,0,14,0,0,0;4,15,11,Times,2,14,0,0,0; :[font = input; preserveAspect; ] Wronskian[F_]:=Table[D[F,{x,i-1}],{i,3}] :[font = text; inactive; preserveAspect; ] This table of terms can be displayed as a matrix using MatrixForm: ;[s] 4:0,0;1,1;56,2;66,1;69,-1; 3:1,13,9,Times,0,12,0,0,0;2,15,11,Times,0,14,0,0,0;1,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] MatrixForm[Wronskian[F]] :[font = output; output; inactive; preserveAspect; endGroup; ] MatrixForm[{{f1[x], f2[x], f3[x]}, {Derivative[1][f1][x], Derivative[1][f2][x], Derivative[1][f3][x]}, {Derivative[2][f1][x], Derivative[2][f2][x], Derivative[2][f3][x]}}] ;[o] f1[x] f2[x] f3[x] f1'[x] f2'[x] f3'[x] f1''[x] f2''[x] f3''[x] :[font = text; inactive; preserveAspect; ] and the determinant can be evaluated with Det. To carry out a specific evaluation, we take as an example the three functions f1[x]=Sin[x], f2[x]=Cos[x] and f3[x]=Exp[x]. Then, ;[s] 12:0,0;1,1;43,2;46,1;127,3;139,1;141,3;153,1;158,3;170,1;178,2;179,1;180,-1; 4:1,13,9,Times,0,12,0,0,0;6,15,11,Times,0,14,0,0,0;2,15,11,Courier,0,14,0,0,0;3,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] Simplify[Det[Wronskian[{Sin[x],Cos[x],Exp[x]}]]] :[font = output; output; inactive; preserveAspect; endGroup; ] -2*E^x ;[o] x -2 E :[font = text; inactive; preserveAspect; ] which clearly does not vanish over any finite part of the real line. As a second example, suppose the trigonometric functions in the preceding example are replaced with their hyperbolic counterparts: f1[x]=Sinh[x], f2[x]=Cosh[x] and f3[x]=Exp[x]. The corresponding evaluation yields: ;[s] 8:0,0;1,1;202,2;215,1;217,2;230,1;235,2;247,1;289,-1; 3:1,13,9,Times,0,12,0,0,0;4,15,11,Times,0,14,0,0,0;3,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] Simplify[Det[Wronskian[{Sinh[x],Cosh[x],Exp[x]}]]] :[font = output; output; inactive; preserveAspect; endGroup; ] 0 ;[o] 0 :[font = text; inactive; preserveAspect; endGroup; ] The Wronskian vanishes because Exp[x]=Cosh[x]+Sinh[x]. ;[s] 4:0,0;1,1;32,2;54,1;56,-1; 3:1,13,9,Times,0,12,0,0,0;2,15,11,Times,0,14,0,0,0;1,15,11,Times,2,14,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Example 1.4 :[font = text; inactive; preserveAspect; ] This Gauss test is most easily applied by making the transformation k->1/n, expanding the resulting expression to second order in n and then comparing with (1.28). The first step is carried out as follows: ;[s] 3:0,1;68,2;74,1;209,-1; 3:0,15,10,Symbol,0,14,0,0,0;2,15,11,Times,0,14,0,0,0;1,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] Simplify[((n+a)(n+b))/((n+c)(n+1))/.n->1/m] :[font = output; output; inactive; preserveAspect; endGroup; ] ((1 + a*m)*(1 + b*m))/(1 + m + c*m + c*m^2) ;[o] (1 + a m) (1 + b m) ------------------- 2 1 + m + c m + c m :[font = text; inactive; preserveAspect; ] The expansion in powers of m can now carried out with Series and the substitution m->1/n made afterwards: ;[s] 6:0,0;1,1;55,2;61,1;83,2;89,1;108,-1; 3:1,13,9,Times,0,12,0,0,0;3,15,11,Times,0,14,0,0,0;2,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] Series[%,{m,0,2}]/.m->1/n :[font = output; output; inactive; preserveAspect; endGroup; ] SeriesData[n^(-1), 0, {1, -1 + a + b - c, a*b + (a + b)*(-1 - c) - c + (1 + c)^2}, 0, 3, 1] ;[o] -1 + a + b - c 1 + -------------- + n 2 a b + (a + b) (-1 - c) - c + (1 + c) 1 3 ------------------------------------- + O[-] 2 n n :[font = text; inactive; preserveAspect; endGroup; ] This expression is readily seen to be of the form (1.28), with the identifications delta=-(a+b-c-1) beta=1-a+(a-1)b-(a+b-1)c+c^2 and with delta=1. Thus, we conclude that the series (1.29) converges for x=1 if c-a-b>0 and diverges otherwise. ;[s] 10:0,0;1,1;85,2;131,1;143,2;150,1;208,2;211,1;215,2;222,1;248,-1; 3:1,13,9,Times,0,12,0,0,0;5,15,11,Times,0,14,0,0,0;4,15,11,Times,2,14,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Cauchy Product of Infinite Series :[font = text; inactive; preserveAspect; ] The structure of the product of two series can be determined symbolically in Mathematica. We first define the partial sums A[n] and B[n]: ;[s] 7:0,1;78,2;89,1;124,2;129,1;134,2;138,1;141,-1; 3:0,13,9,Times,0,12,0,0,0;4,15,11,Times,0,14,0,0,0;3,15,11,Times,2,14,0,0,0; :[font = input; preserveAspect; ] A[n_]:=Sum[a[k]x^k,{k,0,n}]; B[n_]:=Sum[b[k]x^k,{k,0,n}] :[font = text; inactive; preserveAspect; ] The product in (1.34) is now constructed using Expand and the coefficients of powers of x are assembled with Coefficient. The results for the first four terms are shown below: ;[s] 7:0,1;48,2;54,1;89,2;90,1;110,2;121,1;179,-1; 3:0,13,9,Times,0,12,0,0,0;4,15,11,Times,0,14,0,0,0;3,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] Do[Print[Coefficient[Expand[A[4]B[4]],x^j]],{j,1,4}] :[font = print; inactive; preserveAspect; endGroup; ] a[1] b[0] + a[0] b[1] a[2] b[0] + a[1] b[1] + a[0] b[2] a[3] b[0] + a[2] b[1] + a[1] b[2] + a[0] b[3] a[4] b[0] + a[3] b[1] + a[2] b[2] + a[1] b[3] + a[0] b[4] :[font = text; inactive; preserveAspect; endGroup; ] These coefficients are precisely of the form shown on the right-hand side of Equation (1.37). ;[s] 3:0,0;1,1;94,0;95,-1; 2:2,13,9,Times,0,12,0,0,0;1,15,11,Times,0,14,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Example 1.7 :[font = text; inactive; preserveAspect; ] The results obtained in this section can be used to write a few simple commands in Mathematica to determine various vector operations for any orthogonal curvilinear coordinate system. The package VectorAnalysis.m could also be used to obtain these quantities directly, but the explicit constructions carried out below are a useful illustration of the interplay between scalar and vector quantities in Mathematica. We consider the spherical polar coordinates as an example. We first define the vectors u and h, whose entries u[[i]] and h[[i]] are the coordinates, u_i, and the scale factors, h_i, respectively: ;[s] 19:0,1;83,2;94,1;198,2;214,1;403,2;414,1;506,2;507,1;512,2;513,1;529,2;535,1;540,2;546,1;568,2;571,1;596,2;599,1;616,-1; 3:0,13,9,Times,0,12,0,0,0;10,15,11,Times,0,14,0,0,0;9,15,11,Times,2,14,0,0,0; :[font = input; preserveAspect; ] u:= {r,theta,phi}; h:= {1,r,r Sin[theta]} :[font = text; inactive; preserveAspect; ] The entries of h must be in the same order as those of u, i.e. h[[1]]=h_r, h[[2]]=h_theta and h[[3]]=h_phi. We then calculate the Jacobian using Equation (1.58) and construct the expressions for, say, the gradient of a scalar function in Equation (1.66) and the divergence of a vector function obtained in Problem 12: ;[s] 10:0,0;1,1;56,2;57,1;64,2;74,1;77,2;91,1;96,2;108,1;321,-1; 3:1,13,9,Times,0,12,0,0,0;5,15,11,Times,0,14,0,0,0;4,15,11,Times,2,14,0,0,0; :[font = input; preserveAspect; ] J=h[[1]]h[[2]]h[[3]]; Grad[f_]:=Table[D[f,u[[i]]]/h[[i]],{i,1,3}]; Div[f_]:=(1/J)Sum[D[(J f[[i]])/h[[i]],u[[i]]],{i,1,3}]; :[font = text; inactive; preserveAspect; ] Notice that Grad returns a vector function, as indicated by the construction of a Table, and that Div operates on vector functions with components given by f[[i]]. The expression for the gradient of a function in spherical polar coordinates is then obtained as ;[s] 10:0,0;1,1;12,2;17,1;83,2;88,1;99,2;102,1;157,2;163,1;264,-1; 3:1,13,9,Times,0,12,0,0,0;5,15,11,Times,0,14,0,0,0;4,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] Grad[f[r,theta,phi]] :[font = output; output; inactive; preserveAspect; endGroup; ] {Derivative[1, 0, 0][f][r, theta, phi], Derivative[0, 1, 0][f][r, theta, phi]/r, (Csc[theta]*Derivative[0, 0, 1][f][r, theta, phi])/r} ;[o] (0,1,0) (1,0,0) f [r, theta, phi] {f [r, theta, phi], -----------------------, r (0,0,1) Csc[theta] f [r, theta, phi] ----------------------------------} r :[font = text; inactive; preserveAspect; ] which is the expression obtained in (1.74). We can also combine Div and Grad to obtain the Laplacian of a scalar function f by taking the divergence of the gradient of f: ;[s] 10:0,0;1,1;66,2;69,1;74,2;78,1;124,2;125,1;170,2;171,1;174,-1; 3:1,13,9,Times,0,12,0,0,0;5,15,11,Times,0,14,0,0,0;4,15,11,Times,2,14,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup; ] Expand[Div[Grad[f[r,theta,phi]]]] :[font = output; output; inactive; preserveAspect; endGroup; ] (Csc[theta]^2*Derivative[0, 0, 2][f][r, theta, phi])/r^2 + (Cot[theta]*Derivative[0, 1, 0][f][r, theta, phi])/r^2 + Derivative[0, 2, 0][f][r, theta, phi]/r^2 + (2*Derivative[1, 0, 0][f][r, theta, phi])/r + Derivative[2, 0, 0][f][r, theta, phi] ;[o] 2 (0,0,2) Csc[theta] f [r, theta, phi] ----------------------------------- + 2 r (0,1,0) Cot[theta] f [r, theta, phi] ---------------------------------- + 2 r (0,2,0) (1,0,0) f [r, theta, phi] 2 f [r, theta, phi] ----------------------- + ------------------------- + 2 r r (2,0,0) f [r, theta, phi] :[font = text; inactive; preserveAspect; endGroup; endGroup; endGroup; ] which agrees with (1.75) when the derivatives are carried out. ;[s] 2:0,0;1,1;64,-1; 2:1,13,9,Times,0,12,0,0,0;1,15,11,Times,0,14,0,0,0; ^*)