PH130 Mahemaical Mehods Lab 3 This scrip shold keep yo bsy for he ne wo weeks. Yo shold aim o creae a idy and well-srcred Mahemaica Noebook. Do inclde plenifl annoaions o show ha yo know wha yo are doing, where yo have eperimened, and wha yo have learned. Yo shold hen find yor noebooks sefl o yo laer on when yo are working on oher problems. A. Parial differeniaion In he firs par of his eercise yo will gain pracice in sing Mahemaica for he evalaion of parial derivaives. Mos of he eercises will be aken from problem shees yo worked on las year. Yo shold recall how yo evalaed he derivaives and he edios calclaion someimes reqired. Here yo will see how easy i is o ge Mahemaica o do he donkey work for yo. B do appreciae ha Mahemaica can be no sbsie for knowing how o do he calclaion. z 1. Given ha f1, y, 6= ye + cosz yz, find 3 3 f f f f f,,,, y yz yz. Yo shold invesigae some of he feares of Mahemaica s D[..] fncion, sing he Help faciliy, o find an easy way of performing mliple differeniaion.. For (i) f1, y6= y lny and (ii) f1, y6= siny+ y, find f and f y and f. Recall ha f is a compac noaion indicaing parial differeniaion wih respec o. 3. If f y ye / 1, 6= y, find he slopes f and f y when = 0, y = 0. Here yo shold be aware of Mahemaica s sbsiion syna /. 4. Find he slopes in he and y- direcions (i.e. f and f y ) of each of he following (k is a consan): y 3 k 3 y y k y 1 y y ye +,, sin, cos, + 7ln, ln,, y y y y e, k y e, ln ky, yln k y, ln k y, sinh + 7 1 + 6 1 6 1 6 7. Remember ha Mahemaica ses he syna Log[ ] o denoe he naral logarihm. 5. For he above epressions, evalae 3 3 f f f f,,,. y yz yz Yo will find i convenien o se he Windows c and pase faciliies o do his speedily and painlessly. = 3 4 saisfies he parial differenial eqaion 6. Show ha f r, θ r sin θ f + 3 r f θθ rr rf + r f = 0. PH130 Mahemaical Mehods Lab 3 1
n n 7. Show ha V = r cosnθ and V = r 1 cosnθ boh saisfy Laplace s eqaion in polar coordinaes in wo dimensions: 1 V r V 1 r V rr + r + = 0 θθ. 8. If y 1, 6= ln + y, show ha y 1, 6 saisfies Laplace s eqaion in Caresian coordinaes in wo dimensions: + =0. 9. Show ha Ψ= Asin ω + k eqaion yy + and Ψ= k + ω e k ω 0 5 each saisfies he wave Ψ ω Ψ =. k Yo shold be able o idenify he speed of propagaion of he waves; if no, have a look a yor lecre noes. 10. Show ha U = Asin k+ Bcosk e k D saisfies he diffsion eqaion U 1 U =. D Plo his for siably chosen A and B. i p E 0 5/ = 11. Show ha Ψ, = Ae saisfies Schrödinger s eqaion for a free paricle = Ψ Ψ = i= m if E = p / m. Wha does p represen in he epression for Ψ? y 1. If = +, where =, y = 1/, z =, find / in erms of. y z This is a nice eample of he idy se of Mahemaica. 13. If = e cos v and y = e sin v, show ha / v = y and y/ v =. Find. 14. Show ha / y yields he same resl as / y when operaing on fncions of and y. Yo shold inven some on fncions of and y o ry his o on. The independence of he order of differeniaion is an imporan resl which yo will make se of in Thermodynamics. PH130 Mahemaical Mehods Lab 3
B. Defining yor own fncions In he second par of he eercise yo will learn how o define yor own fncions in Mahemaica. This will hen be eended, in he ne secion, o he definiion of he Laplacian operaor and he invesigain of some solions of Laplace's eqaions. The Mahemaica syna for defining a fncion is demonsraed in his simple eample sqare[_] := ^ which will sqare whaever argmen yo give i. Ths yping sqare[]will rern 4, while sqare[a+b]will rern a +ab + b. In his eample sqare is he name yo have chosen for yor fncion. Remember i is preferable no o sar he fncion name wih a capial leer o avoid any poenial conflic wih Mahemaica s bil-in fncions yo migh no be aware of. As epeced, he argmen of he fncion is conained in sqare brackes. However noe ha he argmen is wrien wih an nderscore: _. This indicaes ha he here is a dmmy variable; he fncion will operae on any argmen yo give i, no js on. On he righ hand side, however, in he fncion definiion, yo js se. Finally, noe ha he eqaliy symbol sed here is he Pascal/Algol assignmen :=. This ells Mahemaica o evalae he righ hand side each ime on demand raher han once and for all. Oherwise he same answer wold be rerned every ime he fncion was called, regardless of he new argmen. (Don worry if yo don ndersand his; js be sre o se := when defining a fncion ) Try a few eamples of defining yor own fncions. A fncion can ake more han one argmen; he syna is a naral eension: dis[_, y_] := Sqr[^ + y^] Wha cold his be sed for? Define yor own fncion o give he roos of a qadraic eqaion from is hree coefficiens. Some forehogh and planning will pay dividends here. PH130 Mahemaical Mehods Lab 3 3
C. The laplacian operaor Yo shold recall from he lecres ha he laplacian operaor is given, in recanglar caresian coordinaes, by = + + y z. Laplace s eqaion for Ψ is wrien simply as Ψ = 0. Yo can define yor own laplacian operaor in Mahemaica by: laplacianyz[f_] := D[f,{,}] + D[f,{y,}] + D[f,{z,}] The name laplacianyz has been chosen o indicae ha i epecs he caresian coordinaes, y, and z o operae on. Be sre yo are happy wih his definiion. Using yor own defined laplacian operaor, check wheher he following fncions obey Laplace s eqaion: 1. Ψ1y, 6= y,. Ψ1y, 6 = 3 3 y 4, 3. Ψ1y, 6 = 6 y, 4. Ψ1y, 6 = esin1y6, 5. Ψ1y, 6= sinsinhy, 6. Ψ1y, 6 = arcan 1y/ 6, 7. Ψ yz 1,, 6= / + y 1 + z. In places yo will find i sefl/necessary o se Mahemaica s Simplify commands. 7 Verify ha Ψ y, = aln + y + bsaisfies Laplace s eqaion, and deermine a and b so ha Ψ saisfies he bondary condiions Ψ=0 on he circle + y = 1, and Ψ=5 on he circle + y = 9. Think careflly before doing he second par; yo don wan o end p wih somehing messy. And be sre o eplain in yor Mahemaica noebook wha yo are doing. PH130 Mahemaical Mehods Lab 3 4
D. The d alemberian operaor The wave eqaion reas space and ime on an eqal fooing (almos). Using he laplacian operaor allows he wave eqaion + + Ψ Ψ Ψ 1 Ψ = 0 y z v o be wrien in he mch more compac form 1 Ψ Ψ = 0. v B his can be aken one sep frher, by combining he space and ime differeniaion ino a single symbol. In his way he d alemberian operaor is defined as f 1 =. v And hen he wave eqaion akes on he remarkably compac form f Ψ = 0. Define yor own d alemberian operaor in Mahemaica. Using his operaor, verify ha he following fncions obey he wave eqaion for a siable choice of v: 1. Ψ, 6= + 4,. Ψ1, 6= 3 + 3, 3. Ψ1, 6= sinvsin, 4. Ψ1, 6= cos4 sin, 5. Ψ1, 6= cosvsin, 6. Ψ1, 6= sinωvsinω. E. Diffsion Yo ms hink how o answer he ne qesions. Eplain clearly wha yo are doing. Verify ha he following fncions are solions of he diffsion eqaion for a siable vale of D: =,. Ψ16 = e, 3. Ψ16 = e 3, 1. Ψ, e cos, cos, sin 4. Ψ1, 6= e 4 cosk, 5. Ψ1, 6= e 16 cos k D, 6. Ψ1, 6= e sin k. PH130 Mahemaical Mehods Lab 3 5