©@°Ø§N«o°ÝÃD
°ÝÃD
°²³]è¨R¦nªº©@°Ø¬OÄá¤ó 80 «×¡B¾A¦X¶¼¥Îªº·Å«×¬OÄá¤ó 45 «×¡A¤S°²³]¥[¤J¥¤ºë«á©@°Ø©T©w·|° 5 «×¡C°ÝÀ³¸Ó¥ý¥[¥¤ºëÁÙ¬O«á¥[¥¤ºë¤~·|¤ñ¸û¦³Ü±o¨ì©@°Ø¡H
ª«²z¶q
·Å«× T¡B®É¶¡ t ¡A§Ú̧Ʊ檾¹D T(t) ¡A¥H«Kª¾¹D¦b¬Y¯S©w©w t1 ®Éªº·Å«×¡C
¼Æ¾Ç¼Ò«¬¡]ª«²z¤½¦¡¡G¤û¹y§N«o©w«ß¡^
dT / dt = - r (T - Ts)
¨ä¤¤ T ¬O©@°Ø·Å«×¡B Ts ¬O«Ç¤º¡]ªÅ®ð¡^·Å«×¡B t ¬O®É¶¡¡A¥H¤Î r «h¬O§N«o«Y¼Æ¡A¥iµø¬°¤@Ó±`¼Æ¡C
«Ø¥ß©@°Ø¤§§N«o«Y¼Æªº¤èªk¡A±q¥H¤U¹êÅ窺ªí¡G
¥H¤U¬°¹ê´úÈ¡A·í®É«Ç·Å 17 «× C¡G
®É¨è¡]¤ÀÄÁ¡^ ¶Â©@°Ø·Å«×(«×C) ¥Õ©@°Ø·Å«×(«×C) 0 82.3 68.8 2 78.5 64.8 4 74.3 62.1 6 70.7 59.9 8 67.6 57.7 10 65.0 55.9 12 62.5 53.9 14 60.1 52.3 16 58.1 50.8 18 56.1 49.5 20 53.3 48.1 22 52.8 46.8 24 51.2 45.9 26 49.9 44.8 28 48.6 43.7 30 47.2 42.6 32 46.1 41.7 34 45.0 40.8 36 43.9 39.9 38 43.0 39.3 40 41.9 38.6 42 41.0 37.7 44 40.1 37.0 46 39.5 36.4
ºtºâªk¤Îµ{¦¡
¤@¶¥·L¤À¤èµ{¦¡ªºµ{¦¡
³Ì¤@¯ë§Î¦¡ªº¤@¶¥·L¤À¤èµ{¦¡¡A¬O¦p¤Uªº§Î¦¡¡G
dy/dx = f(x,y)
¨ä¤¤ f(x,y) ¥i¦¸¬O¥ô¦ó¥H x, y ¬°¦ÛÅܼƪºÅã¨ç¼Æ¡C¦b·L¤À¤èµ{¦¡ªº°ÝÃD¤¤¡Af(x,y) ¬°©Òµ¹©wªº¤wª¾¡A¦Ó y(x) «h¬O¥¼ª¾¥B§Æ±æ¨D±oªº¸Ñ¡C
§ÚÌn¦p¦ó¨D¸Ñ y(x) ¡H
Euler ¡]¶ø¨Ì°Ç¡^ºtºâªk
¦b Δx ¡÷ 0 ªº±¡§Î¤UΔy/Δx = dy/dx = f(x,y)¡A¤]´N¬O»¡Δy = f(x,y)Δx¡C
§â x ¤À¦¨³\¦hµ¥¶¡¹jªº¤p³æ¦ì¡A§YΔy ¡Ý yn+1 -yn¡BΔx ¡Ý xn+1 - xn¡A«h¤W¦¡¦¨¬°
yn+1 - yn = f(xn,yn)Δx¡A¤]´N¬O»¡
yn+1 = yn + f(xn,yn)Δx
¤W¦¡´N¬O Euler ºtºâªk¡A¥¦§i¶D§ÚÌ¥unª¾¹D²Ä n ®æªº y(x) È yn¡A´N¥i¥Hºâ±o¤U¤@®æªº y(x) È yn+1¡A ¬G¥unª¾¹D y(x) ¦b¬YÓ x0 ³Bªº°_©lÈ y(x0)
µ{¦¡¬yµ{¡Gµ¹©w§N«o«Y¼Æ¡B©@°Øªì©l·Å«×¡B«Ç·Å¡Aµe¥X T(t) ªº¹Ï
(0) ¶}©l
(1) Ū¤J§N«o«Y¼Æ¡B©@°Øªì©l·Å«×¡B«Ç·Å¡B¤p¶¡¹j®É¶¡³]©w¡B§Æ±æ¼ÒÀÀ¤§®É¶¡
(2) ¦b°j°é¤¤¡A¥H Euler ªk¹w´ú¤U¤@¤p¬q®É¶¡«áªº·Å«×¡A¨Ãµe¹Ï¡Aª½¨ì°j°é¶]§¹
µù¡G®Ö¤ßµ²ºc¦p¤U¡G
T = T_initial
do i = 1, 10000
T = T - r * (T - Ts) * dt
end do
(3) µ²§ô
½Ð¦Û¦æ¼¶¼gµ{¦¡
¼g¦nµ{¦¡«á½sĶ®É¡A¥Ñ©ó§Aªºµ{¦¡¤¤¦³¨Ï¥Î¨ì pgplot ø¹Ï°Æµ{¦¡¡A¦]¦¹½sĶ«ü¥On¹³³o¼Ë¤U¡G
gfortran -o my_prog.x my_prog.f -L /usr/local/pgplot -lpgplot -lX11
ª`·N¥H¤Wªº X ¬O¤j¼g¡B11 ¬O¼Æ¦r¡B¦³ -L ªº¦a¤è¤@©wn¥Î¤j¼g¡A«á±³sµ²µ{¦¡®w¥Îªº -lX11 »P -lpgplot ¤§ "-l" «h¬O^¤å¤p¼g l ¡C
§¹¦¨¹Ï¨Ò
½d¨Òµ{¦¡°Ñ¦Ò
µ¥¤£¤Î¤F¡A¥ýª±¤@¤U¦Ñ®v¤v¸g°µ¦n¤Fªº¥i°õ¦æÀÉ cooling.x
¤@¤U¤l¼g¤£¥X¨Ó¡A°½¬Ý¤@¤U¦Ñ®v½d¨Òµ{¦¡¤¤ªº¼gªk cooling.f
¡]¾¨¶q¥ý¦Û¤v¸Õ¸Õ¬Ý¡Aª`·N¥i°õ¦æÀɬO Linux Àô¹Ò¥Îªº¡^
·s¼W¡G¯Â¤å¦r·¥Â²ª©
¦A¥[¤Jø¹Ï¥\¯à
¨t¦C²ßÃD¡G
¤@¡B¨Ì·Ó¤û¹y§N«o©w«ß¡A¼g¤@Ó¹w´úª«Åé·Å«× T(t) ªºµ{¦¡¡A¨ä¤¤§N«o«Y¼Æ r¡Bªì©l·Å«× T(0)¡BÀô¹Ò·Å«× Ts¡A¥H¤Î·L¤p®É¶¡¶¡¹jΔt ¥Ñ¥~³¡Åª¤J¡C
A. §Aªºµ{¦¡¼g¦n¤F¡A¤]¶¶§Q¦a³q¹L½sĶ¨Ã²£¥Í¤@Ó¥i°õ¦æÀÉ¡A¤]´N¬O«ü¥Oªº»yªk³£¥¿½T¤F¡A¦ý§A«ç»òª¾¹D¥¦¦³¨S¦³ÅÞ¿è¤Wªº¿ù»~¡]µ{¦¡¤º³¡ªº¿ù»~³q±`¥s bug¡A¦]¬°¾ú¥v¤W´¿¦³ÂΤl¥d¦b¯uªÅºÞ¿N±¼¾ÉP¹q¸ôÉÅÞ¿è¿ù»~ªº¨Æ¥ó¡^¡^¡A©Î¤ñ¤è»¡¤£¤p¤ß§â + ¸¹¥´¦¨ - ¸¹¡H
B. ·L¤p®É¶¡¶¡¹jΔt ¬Oµ{¦¡¨Ï¥ÎªÌ¦Û¤v¥²¶·¨M©wªº¶q¡A½Ð¸Õ¸Õ¬Ý¤£¦P¼Æ¶q¯Åªº¤j¤p¡C§Aı±o¥Î¦h¤pªºÈ¤~°÷ºë½T¡H
ª`·N¡G¦pªGΔt ¥Î±o¤Ó¤j¡A°£¤Fµª®×«Ü¤£ºë½T¤§¥~¡A§ó¦³¥i¯à¾ÉP©@°Ø·Å«×¤ñÀô¹Ò·Å«×ÁÙ§Cªº¤£¦X²z±¡ªp¡C¡]¬Ý¬Ý¤½¦¡¡A¸ÕµÛ·Q¹³¤@ӫܤjªºΔt È·|¾ÉP¤°»òµ²ªG¡H¡^
¤G¡B±q¹êÅç¼Æ¾Ú¡]°Ñ¦Ò¤Uªí¡^«Ø¥ß©@°Ø¤§§N«o«Y¼Æªº¹ê§@
¢Ï¡D§A»{¬°¤û¹y§N«o©w«ß¯à¤£¯à´yz¤Wzªº¹êªp¡H¡]·Q·Q¬Ý§ÚÌn«ç»ò¼Ë¨Ó¦^µª³oÓ°ÝÃD¡C¡^
¢Ð¡D¦pªG§ÚÌÄ@·N±µ¨ü¥Î¤û¹y§N«o©w«ß¬°¼Ò«¬¨Ó´yz¹êªp¤¤ªº§N«o¹Lµ{¡A«h§An«ç»ò¼ËÀò±o¤@Ó¸û²Å¦Xªº§N«o«Y¼Æ r È¡H
¦Û¤v¥ý·Q¤@·Q¡A¦p¦ó©w¥X r È¡]·Q¤£¥X¨Ó¦A¬Ý¡^
¤T¡B°²³]¥[¤J¥¤ºë¥u·|²³æ¦a§â²~¤¤·Å«×°§CÄá¤ó¤«×¡A«h°Ý¤@²~è¨R¦nÄá¤ó 90 «×ªº©@°Ø¡An·Q§ÖÂI¹F¨ì¶}©l¥i¥H«~À|ªºÄá¤ó 45 «×¡A§A«Øij¥ý¥[¥¤ºë©Î¬O«á¥[¥¤ºë¡H
¥|¡B¤@Ó¶qªºÅܤƲv»P·í®É¸Ó¶q¤§¤j¤p¦³Ãöªº²{¶H¡AÁÙ¦³¤°»ò¨Ò¤l¡H¡]®Ö°IÅÜ¡^
¤¡Bºtºâªkªººë½T«×»Péw©Êªº°ÝÃD¡C¡]ì°Ñ¦Ò±Ð¬ì®Ñ¤º¤å¡^
§Q¥Î¹q¸£¶i¦æ¼ÆȹBºâ¡A¨ä»~®tªº¨Ó·½¦³¤G¡A¨ä¤¤¤@Ó¬O¥|±Ë¤¤J»~®t¡]¤S¥s±Ë¥h»~®t©Î±Ë¤J»~®t¡A^¤å¥s round-off error ©Î rounding error¡A¥¦¬Oµo¥Í¦b·í¹q¸£¦b§Q¥Î¨ä¦³ªº¦ì¤¸³B²z¦³¤p¼ÆÂIªº¼ÆÈ¡]¦p¹ê¼Æ¡A¤S¥s¯BÂI¼Æ¡^¶Í·|¦³»Ýn¥|±Ë¤¤Jªº±¡ªp¡A¤ñ¤è»¡Y¶È«O¯d¤p¼ÆÂI«á¤@¦ì¡A«h 1.1 ¼¥H 1.1 ªºµ²ªG´Nnªí¥Ü¦¨ 1.2 ¦Ó¤£¬O§ó¥¿½Tªº 1.21¡A¡F¥t¥~¤@ºØ»~®t¬O¨Ó¦ÛºtºâªkùØÀY©Ò¨Ï¥Îªºªñ¦ü¡A¥sºIÂ_»~®t©Î×°Å»~®t¡A^¤å¥s°µ truncation error¡A·|¦³³oºØ¦WºÙ¬O¦]¬°ºtºâªk±`¥ÎµL½a¯Å¼Æ®i¶}ªº§Î¦¡¡A¨ä¤¤«Ü¦³¦Wªº¤ñ¤è»¡®õ°Ç®i¶}¦¡¡]Tylar's expansion¡^¡C
ÃB¥~¨ÒÃD¡G
¶i¶¥¾\Ū¡G
Gould and Tobochnik, An Introduction to Computer Simulation Methods -- Applications to Physical Systems, Addison Wesley (1996) Chapter 2