MichaelBestehorn ComputationalPhysics Also of Interest ComputationalPhysics.MitBeispieleninFortranundMatlab MichaelBestehorn,2016 ISBN978-3-11-037288-5,e-ISBN(PDF)978-3-11-037303-5, e-ISBN(EPUB)978-3-11-037304-2 BiomedicalImaging.PrinciplesofRadiography,Tomographyand MedicalPhysics TimSalditt,TimoAspelmeier,SebastianAeffner,2017 ISBN978-3-11-042668-7,e-ISBN(PDF)978-3-11-042669-4, e-ISBN(EPUB)978-3-11-042351-8 DynamicsofSolidStructures.MethodsusingIntegrodifferential Relations GeorgyViktorovichKostin,VasilyV.Saurin,2017 ISBN978-3-11-051623-4,e-ISBN(PDF)978-3-11-051644-9, e-ISBN(EPUB)978-3-11-051625-8 ComputationalPhysicsofElectricDischargesinGasFlows SergeyT.Surzhikov,2012 ISBN978-3-11-027033-4,e-ISBN(PDF)978-3-11-027041-9 ComputationalSciences PonnaduraiRamasami(Ed.),2017 ISBN978-3-11-046536-5,e-ISBN(PDF)978-3-11-046721-5, e-ISBN(EPUB)978-3-11-046548-8 Michael Bestehorn Computational Physics | With Worked Out Examples in FORTRAN® and MATLAB® PhysicsandAstronomyClassificationScheme2010 05.10.Ln,05.45.-a,05.65.+b,07.05.Mh,44.05.+e,45.10.-b,47.11.-j,47.85.-g Author Prof.Dr.MichaelBestehorn BTUCottbus-Senftenberg Dept.ofStatisticalPhysicsandNonlinearDynamics Erich-Weinert-Str.1 03046Cottbus Germany [email protected] ISBN978-3-11-051513-8 e-ISBN(PDF)978-3-11-051514-5 e-ISBN(EPUB)978-3-11-051521-3 LibraryofCongressControlNumber:2018934247 BibliographicinformationpublishedbytheDeutscheNationalbibliothek TheDeutscheNationalbibliothekliststhispublicationintheDeutscheNationalbibliografie; detailedbibliographicdataareavailableontheInternetathttp://dnb.dnb.de. ©2018WalterdeGruyterGmbH,Berlin/Boston Coverimage:MichaelBestehorn Typesetting:le-texpublishingservicesGmbH,Leipzig Printingandbinding:CPIbooksGmbH,Leck ♾Printedonacid-freepaper PrintedinGermany www.degruyter.com Contents 1 Introduction|1 1.1 Goal,contents,andoutline|1 1.2 Theenvironmentrequiredforprogramdevelopment|4 1.2.1 Operatingsystem|4 1.2.2 Softwarepackages|5 1.2.3 Graphics|5 1.2.4 Programdevelopmentandasimplescript|6 1.3 Afirstexample–thelogisticmap|7 1.3.1 Map|7 1.3.2 FORTRAN|8 1.3.3 Problems|11 2 Nonlinearmaps|12 2.1 Frenkel–Kotorovamodel|12 2.1.1 Classicalformulation|12 2.1.2 Equilibriumsolutions|13 2.1.3 Thestandardmap|13 2.1.4 Problems|14 2.2 ChaosandLyapunovexponents|15 2.2.1 Stability,butterflyeffect,andchaos|15 2.2.2 Lyapunovexponentofthelogisticmap|16 2.2.3 Lyapunovexponentsformultidimensionalmaps|17 2.3 Affinemapsandfractals|20 2.3.1 Sierpinskitriangle|22 2.3.2 Aboutfernsandotherplants|23 2.3.3 Problems|24 2.4 Fractaldimension|25 2.4.1 Box-counting|25 2.4.2 Application:Sierpinskitriangle|26 2.4.3 Problem|27 2.5 Neuralnetworks|27 2.5.1 Perceptron|28 2.5.2 Self-organizedmaps:Kohonen’smodel|34 2.5.3 Problems|39 3 Dynamicalsystems|40 3.1 Quasilineardifferentialequations|40 3.1.1 Example:logisticmapandlogisticODE|41 3.1.2 Problems|42 VI | Contents 3.2 Fixedpointsandinstabilities|43 3.2.1 Fixedpoints|43 3.2.2 Stability|43 3.2.3 Trajectories|44 3.2.4 Gradientdynamics|45 3.2.5 SpecialcaseN=1|45 3.2.6 SpecialcaseN=2|45 3.2.7 SpecialcaseN=3|47 3.3 Hamiltoniansystems|50 3.3.1 Hamiltonfunctionandcanonicalequations|50 3.3.2 Symplecticintegrators|51 3.3.3 Poincarésection|56 4 OrdinarydifferentialequationsI|58 4.1 Newton’smechanics|58 4.1.1 Equationsofmotion|58 4.1.2 Themathematicalpendulum|59 4.2 Numericalmethodsofthelowestorder|60 4.2.1 Eulermethod|60 4.2.2 NumericalstabilityoftheEulermethod|60 4.2.3 Implicitandexplicitmethods|63 4.3 Higherordermethods|64 4.3.1 Heun’smethod|64 4.3.2 Problems|67 4.3.3 Runge–Kuttamethod|67 4.4 RK4applications:celestialmechanics|73 4.4.1 Keplerproblem:closedorbits|73 4.4.2 Quasiperiodicorbitsandapsidalprecession|76 4.4.3 Multipleplanets:isoursolarsystemstable?|76 4.4.4 Thereducedthree-bodyproblem|79 4.4.5 Problems|86 4.5 Moleculardynamics(MD)|86 4.5.1 Classicalformulation|86 4.5.2 Boundaryconditions|87 4.5.3 Microcanonicalandcanonicalensemble|88 4.5.4 Asymplecticalgorithm|89 4.5.5 Evaluation|90 4.5.6 Problems|94 4.6 Chaos|95 4.6.1 Harmonicallydrivenpendulum|95 4.6.2 Poincarésectionandbifurcationdiagrams|97 Contents | VII 4.6.3 Lyapunovexponents|98 4.6.4 Fractaldimension|106 4.6.5 Reconstructionofattractors|109 4.7 ODEswithperiodiccoefficients|111 4.7.1 Floquettheorem|111 4.7.2 Stabilityoflimitcycles|112 4.7.3 Parametricinstability:pendulumwithanoscillatingsupport|112 4.7.4 Mathieuequation|114 4.7.5 Problems|116 5 OrdinarydifferentialequationsII|117 5.1 Preliminaryremarks|117 5.1.1 Boundaryconditions|117 5.1.2 Example:ballisticflight|118 5.2 Finitedifferences|118 5.2.1 Discretization|119 5.2.2 Example:Schrödingerequation|122 5.3 Weightedresidualmethods|128 5.3.1 Weightandbasefunctions|128 5.3.2 Example:Starkeffect|130 5.4 Nonlinearboundaryvalueproblems|132 5.4.1 Nonlinearsystems|132 5.4.2 Newton–Raphson|133 5.4.3 Example:thenonlinearSchrödingerequation|134 5.4.4 Example:amoonshot|136 5.5 Shooting|140 5.5.1 Themethod|140 5.5.2 Example:freefallwithquadraticfriction|141 5.5.3 Systemsofequations|142 5.6 Problems|143 6 PartialdifferentialequationsI,basics|144 6.1 Classification|144 6.1.1 PDEsofthefirstorder|144 6.1.2 PDEsofthesecondorder|147 6.1.3 Boundaryandinitialconditions|149 6.2 Finitedifferences|153 6.2.1 Discretization|153 6.2.2 EllipticPDEs,example:Poissonequation|156 6.2.3 ParabolicPDEs,example:heatequation|162 6.2.4 HyperbolicPDEs,example:convectionequation,waveequation|167 VIII | Contents 6.3 Alternativediscretizationmethods|173 6.3.1 Chebyshevspectralmethod|173 6.3.2 SpectralmethodbyFouriertransformation|178 6.3.3 Finite-elementmethod|182 6.4 NonlinearPDEs|186 6.4.1 RealGinzburg–Landauequation|186 6.4.2 Numericalsolution,explicitmethod|188 6.4.3 Numericalsolution,semi-implicitmethod|189 6.4.4 Problems|190 7 PartialdifferentialequationsII,applications|193 7.1 Quantummechanicsinonedimension|193 7.1.1 Stationarytwo-particleequation|193 7.1.2 Time-dependentSchrödingerequation|196 7.2 Quantummechanicsintwodimensions|202 7.2.1 Schrödingerequation|202 7.2.2 Algorithm|202 7.2.3 Evaluation|203 7.3 Fluidmechanics:flowofanincompressibleliquid|204 7.3.1 Hydrodynamicbasicequations |204 7.3.2 Example:drivencavity|206 7.3.3 Thermalconvection:(A)squaregeometry|211 7.3.4 Thermalconvection:(B)Rayleigh–Bénardconvection|218 7.4 Patternformationoutofequilibrium|225 7.4.1 Reaction-diffusionsystems|225 7.4.2 Swift–Hohenbergequation|234 7.4.3 Problems|238 8 MonteCarlomethods(MC)|240 8.1 Randomnumbersanddistributions|240 8.1.1 Randomnumbergenerator|240 8.1.2 Distributionfunction,probabilitydensity,meanvalues|241 8.1.3 Otherdistributionfunctions|242 8.2 MonteCarlointegration|245 8.2.1 Integralsinonedimension|245 8.2.2 Integralsinhigherdimensions|247 8.3 Applicationsfromstatisticalphysics|250 8.3.1 Two-dimensionalclassicalgas|250 8.3.2 TheIsingmodel|255 8.4 Differentialequationsderivedfromvariationalproblems|265 8.4.1 Diffusionequation|265 8.4.2 Swift–Hohenbergequation|267 Contents | IX A Matricesandsystemsoflinearequations|270 A.1 Realmatrices|270 A.1.1 Eigenvaluesandeigenvectors|270 A.1.2 Characteristicpolynomial|270 A.1.3 Notations|271 A.1.4 Normalmatrices|271 A.2 Complexmatrices|272 A.2.1 Notations|272 A.2.2 Jordancanonicalform|273 A.3 Inhomogeneoussystemsoflinearequations|274 A.3.1 Regularandsingularsystemmatrices|274 A.3.2 Fredholmalternative|275 A.3.3 Regularmatrices|275 A.3.4 LUdecomposition|276 A.3.5 Thomasalgorithm|278 A.4 Homogeneoussystemsoflinearequations|279 A.4.1 Eigenvalueproblems|279 A.4.2 Diagonalization|279 A.4.3 Application:zerosofapolynomial|282 B Programlibrary|284 B.1 Routines|284 B.2 Graphics|285 B.2.1 init|285 B.2.2 contur|285 B.2.3 contur1|285 B.2.4 ccontu|286 B.2.5 image|286 B.2.6 ccircl|286 B.3 Runge–Kutta|286 B.3.1 rkg|286 B.3.2 drkg|287 B.3.3 drkadt|287 B.4 Miscellaneous|287 B.4.1 tridag–Thomasalgorithm|287 B.4.2 ctrida|287 B.4.3 dlyap_exp–Lyapunovexponents|288 B.4.4 schmid–orthogonalization|288 B.4.5 FUNCTIONvolum–volumeinndimensions|288 B.4.6 FUNCTIONdeter–determinant|289 B.4.7 random_init–randomnumbers|289