================================================================================ Mathematica For Physics: 2nd Edition Robert L. Zimmerman and Fredrick I. Olness WebSite: www.physics.smu.edu/~olness darkwing.uoregon.edu/~phys600/ MathSource Number: 0206-862 ISBN 0-201-53796-6 ================================================================================ Contents 1 Getting Started 2 1.1 Introduction 2 1.1.1 Computers as a Tool ....2 1.1.2 A Note about Notation and Style ....3 1.1.3 Notation and Symbols ....3 1.2 Arithmetic and Algebra 5 1.2.1 Arithmetic and Notation ....5 1.2.2 Algebraic Manipulations ....7 1.2.3 PowerExpand ....10 1.2.4 Simple Rules ....10 1.2.5 A Homemade Complex Conjugate with SuperStar ....11 1.2.6 Immediate and Delayed Substitutions ....12 1.2.7 Selecting Parts of Expressions ....13 1.2.8 Algebraic Equations ....13 1.3 Functions and Procedures 15 1.3.1 Built-In Functions ....15 1.3.2 User-Defined Functions ....16 1.3.3 Pure Functions ....18 1.3.4 Assigning Rules and Restrictions to Functions ....19 1.3.5 Module ....21 1.3.6 rootPlot ....22 1.4 Packages 24 1.4.1 Loading Packages ....24 1.4.2 Contexts ....26 1.4.3 Shadowing ....27 1.5 Calculus 28 1.5.1 Derivatives and Integrals ....28 1.5.2 Differential Equations ....30 1.5.3 Changing Variables and Pure Functions ....30 1.5.4 Numerical Solutions of Differential Equations ....31 1.6 Graphics 33 1.6.1 Using the Plot Command ....33 1.6.2 Animated Plots ....35 1.6.3 Vector Field Plots ....36 1.6.4 Three-Dimensional Graphics Using Plot3D and ParametricPlot3D ....38 1.7 Exercises 40 2 General Physics 45 2.1 Introduction 45 2.2 Newtonian Mechanics in Inertial Frames 45 2.2.1 Overview ....45 2.2.1 Escape Velocity ....46 2.2.2 Projectile in a Uniform Gravitational Field ....48 2.2.3 Reflecting Trajectories ....53 2.2.4 Falling Projectile with Linear Air Resistance Drag ....55 2.2.5 Falling Projectile with Quadratic Air Resistance Drag ....64 2.2.6 Rocket with Varying Mass ....69 2.2.7 Keplerian Orbits ....76 2.3 Newtonian Mechanics in Rotating Frames 81 2.3.1 Overview ....81 2.3.1 Projectile Motion as Measured by an Observer on Earth ....81 2.3.2 Foucault Pendulum ....90 2.4 Electricity and Magnetism 98 2.4.1 Overview ....98 2.4.1 Charged Disk ....99 2.4.2 Uniformly Charged Sphere ....101 2.4.3 Electric Dipole ....107 2.4.4 Magnetic Vector Potential for a Long Straight Wire ....113 2.4.5 Motion of a Charged Particle in a Uniform B Field ....116 2.4.6 Motion of a Charged Particle in a Uniform B Field and Time Varying E Field ....119 2.5 Modern Physics 122 2.5.1 Carbon Dating ....122 2.5.2 Stable Isotopes ....124 2.5.3 The Bohr Atom ....129 2.5.4 Relativistic Collision ....132 2.6 Exercises 133 3 Oscillating Systems 131 3.1 Introduction 131 3.2 Linear Oscillations 132 3.2.1 Overview ....132 3.2.2 Initialization of User-Defined Functions ....133 phasePlot for One-Dimensional System ....133 timePhasePlot: Time Behavior of Phase Plot for a One-Dimensional System ....133 doublePlot: Combination of the Phase Plot and the Time B Behavior of the Phase Plot ....134 Protect Commands ....135 3.2.1 Linear Oscillator ....135 3.2.2 Series Expansion Solution ....138 3.2.3 Potential and Phase Diagrams for the Linear Oscillator ....141 3.2.4 Damped Linear Oscillator ....145 3.2.5 Damped Harmonic Oscillator and Driving Forces ....151 3.3 Small Oscillations 159 3.3.1 Overview of Small Oscillations and Normal Modes ....159 3.3.2 Initialization of User-Defined Funtions for Small Oscillations and Normal Modes ....160 Eigenvalues and Eigenvectors for Small Oscillating Systems ....160 3.3.1 Two Coupled Oscillators along a Line ....161 3.3.2 Three Coupled Oscillators along a Line ....168 3.3.3 Three Coupled Oscillators along a Circle ....174 3.3.4 Double Pendulum ....178 3.3.5 Understanding the User-Defined Procedure smallOsc[ ] ....182 3.4 Oscillating Circuits 185 3.4.1 Overview ....185 3.4.1 Series RC Circuit ....185 3.4.2 Series RL Loop ....187 3.4.3 RLC Loop ....190 3.5 Exercises 194 4 Nonlinear Oscillating Systems 193 4.1 Introduction 193 4.2 Nonlinear Pendulum 195 4.2.1 Overview ....195 4.2.2 Initialization of User-Defined Functions ....196 User-Defined Procedure for the Pendulum s Angle-Time Graph ....196 User-Defined Procedure for the Pendulum s Phase Diagram ....196 User-Defined Procedure for the Pendulum s Poincare Diagram ....197 User-Defined Procedure to Map the Pendulum to the Interval -Pi and Pi ....198 User-Defined Procedure for the Pendulum s Reduced Angle-Time Graph ....198 User-Defined Procedure for the Pendulum s Reduced Phase Diagram 199 User-Defined Procedure for the Pendulum s Reduced Poincare Diagram ....199 Protect User-Defined Procedures ....200 4.2.1 Analytic Solution for the Planar Pendulum ....200 4.2.2 Damped Pendulum ....211 4.2.3 Periodic Solutions for the Driven Pendulum ....218 4.2.4 Looping Solutions for the Driven Pendulum ....221 4.2.5 Chaotic Motion for the Driven Pendulum ....225 4.3 Duffing Equation 233 4.3.1 Overview ....233 4.3.2 Initializations for the Duffing Equation ....234 User-Defined Procedure to Plot the Duffing Displacement Motion ....234 User-Defined Procedure to Plot the Duffing Phase ....234 User-Defined Procedure to Plot the Duffing Poincare Map ....235 Protect User-Defined Procedures ....235 4.3.1 Potential and Phase Diagrams for the Duffing Oscillator ....235 4.3.2 Phase Diagram and Orbits for the Damped Duffing Equation ....244 4.3.3 Driven Duffing Orbits with No Damping ....248 4.3.4 Two Well Driven Duffing Oscillators with Damping ....253 4.4 Exercises 256 5 Discrete Dynamical Systems 258 5.1 Introduction 258 5.2 Logistic Map 261 5.2.1 Overview ....261 5.2.1 Logistic Map ....261 5.2.2 Logistic Fixed Points ....266 5.2.3 Logistic Cobwebs ....271 5.2.4 Logistic Bifurcations ....273 5.2.5 Logistic Lyapunov Exponent and Entropy ....274 5.3 Other Maps 277 5.3.1 Overview ....277 5.3.1 Salmon Map ....278 5.3.2 Sine-Circle Map ....282 5.3.3 Taylor-Greene-Chirikov Map ....287 5.3.4 Henon Map ....290 5.4 Fractals 292 5.4.1 Overview ....292 5.4.1 Mandelbrot Set ....293 5.4.2 Julia Set ....295 5.5 Exercises 297 6 Lagrangians and Hamiltonians 298 6.1 Introduction 299 6.2 Lagrangian Problems without Lagrange Multipliers 300 6.2.1 Overview ....300 6.2.2 Initialization for Lagrangian Problems ....301 6.2.1 Particle Sliding on a Movable Incline ....302 6.2.2 Bead Sliding on a Rotating Wire ....304 6.2.3 Bead on a Rotating Hoop ....309 6.2.4 Springs Mounted on Top of a Carriage ....319 6.2.5 Mass Falling through a Hole in a Table ....324 6.2.6 Spring Pendulum ....329 6.3 Lagrangian Problems with Lagrange Multipliers 338 6.3.1 Overview of Nonholonomic Constraints and Lagrange Multipliers ....338 6.3.1 Atwood Machine ....338 6.3.2 Hoop Rolling on an Incline ....340 6.3.3 Sphere Rolling on a Fixed Sphere ....343 6.4 Hamiltonian Problems 347 6.4.1 Overview of Hamilton s Equations ....347 6.4.1 Harmonic Oscillator ....349 6.4.2 Nonlinear Oscillator ....351 6.4.3 Cylindrical Coordinates ....356 6.4.4 Swinging Atwood Machine ....360 6.4.5 Spherical Pendulum ....364 6.5 Hamilton-Jacobi Problems 368 6.5.1 Overview ....368 6.5.1 Harmonic Oscillator ....370 6.5.2 Particle in a Constant Gravity Field ....373 6.5.3 Kepler's Problem and Hamilton-Jacobi Equations ....375 6.6 Exercises 378 7 Orbiting Bodies 377 7.1 Introduction 378 7.2 The Two-Body Problem 379 7.2.1 Overview ....379 7.2.1 Equivalent One-Body Problem ....379 7.2.2 Kepler Orbits ....385 7.2.3 Precessing Ellipse ....389 7.2.4 Numerical Solution ....394 7.3 Restricted Three-Body Problem 398 7.3.1 Overview of the Three-Body Problem and Initialization of PMotion and Mgraph ....398 7.3.2 Problems on the Equal Mass Primaries (m = 1/2) ....401 7.3.1 Lagrangian Points for Equal Mass Binaries (m = 1/2) ....401 7.3.2 Looping Motion in an Equal Mass Binary System (m = 1/2) ....406 7.3.3 Symmetric Orbits about the y-Axis for m = 1/2 ....413 7.3.4 Mass Exchange between Equal Mass Binaries ....414 Problems on the Sun Jupiter System (m = .000954) ....417 7.3.5 Lagrangian Points for the Sun Jupiter System ....417 7.3.6 Numerical Solution for the Trojan Asteroids ....420 7.3.7 Perturbative Solution for the Trojan Asteroids ....424 7.3.3 Problems on the Earth Moon System (m = .01215) ....429 7.3.8 Lagrangian Points for the Earth Moon System ....429 7.3.9 Motion about L[4] in the Earth Moon System ....432 7.3.10 Orbit around the Earth and Moon ....434 7.4 Exercises 436 8 Electrostatics 436 8.1 Introduction 436 Mathematica Commands for All Sections ....437 8.2 Point Charges, Multipoles, and Image Charges 438 8.2.1 Overview ....438 Mathematica Commands for Section 8.1 ....439 8.2.1 Superposition of Point Charges ....442 8.2.2 Point Charges and Grounded Plane ....449 8.2.3 Point Charges and Grounded Sphere ....452 8.2.4 Line Charge and Grounded Plane ....457 8.2.5 Multipole Expansion of a Charge Distribution ....460 8.3 Laplace s Equation in Cartesian and Cylindrical Coordinates 469 8.3.1 Overview of Cartesian and Cylindrical Coordinates ....469 8.3.1 Separation of Variables in Cartesian and Cylindrical Coordinates ....470 8.3.2 Potential in a Rectangular Groove ....473 8.3.3 Rectangular Conduit ....477 8.3.4 Potential Inside a Rectangular Box with Five Sides at Zero Potential ....481 8.3.5 Conducting Cylinder with a Potential on the Surface ....485 8.4 Laplace s Equation in Spherical Coordinates ....490 8.4.1 Overview of Spherical Coordinates ....490 8.4.1 A Charged Ring ....490 8.4.2 Grounded Sphere in an Electric Field ....497 8.4.3 Sphere with an Axially Symmetric Charge Distribution ....501 8.4.4 Sphere with a Given Axially Symmetric Potential ....506 8.4.5 Sphere with Upper Hemisphere V0 and Lower Hemisphere -V0 ....510 8.5 Exercises 513 9 Quantum Mechanics 513 9.1 Introduction 513 9.2 One-Dimensional Schr¨ odinger s Equation 516 9.2.1 Particle Bound in an Infinite Potential Well ....516 9.2.2 Particle Bound in a Finite Potential Well ....519 9.2.3 Particle Hitting a Finite Step Potential ....531 9.2.4 Particle Propagating Toward a Rectangular Potential ....539 9.2.5 The One-Dimensional Harmonic Oscillator ....548 9.3 Three-Dimensional Schr¨ odinger s Equation 552 9.3.1 Three-Dimensional Harmonic Oscillator in Cartesian Coordinates ....552 9.3.2 Schrodinger s Equation for Spherically Symmetric Potentials ....556 9.3.3 Particle in an Infinite, Spherical Well ....561 9.3.4 Particle in a Finite, Spherical Well ....566 9.3.5 The Hydrogen Atom in Spherical Coordinates ....574 9.4 Exercises 579 10 Relativity and Cosmology 578 10.1 Introduction 579 10.2 Special Relativity 580 10.2.1 Overview ....580 10.2.1 Decay of a Particle ....582 10.2.2 Two-Particle Collision ....584 10.2.3 Compton Scattering ....587 10.2.4 Moving Mirror and Generalized Snell s Law ....590 10.2.5 One-Dimensional Motion of a Relativistic Particle with Constant Acceleration ....592 10.2.6 Two-Dimensional Motion of a Relativistic Particle in a Uniform Electric Field ....595 10.3 General Relativity 599 10.3.1 Overview ....599 10.3.1 Killing Vectors and Spherical Symmetry ....601 10.3.2 Schwarzschild Solution ....605 10.3.3 Geodesics for the Schwarzschild Metric ....610 10.3.4 Time It Takes to Fall into a Black Hole ....614 10.3.5 Circular Geodesics for the Schwarzschild Metric ....618 10.3.6 Precession of the Perihelion ....620 10.4 Cosmology 625 10.4.1 Overview of Friedmann, Robertson, and Walker Cosmology ....625 10.4.1 Field Equations for Friedmann Robertson Walker Cosmology ....627 10.4.2 Zero-Pressure (Dust) Cosmological Models ....632 10.4.3 The Expansion and Age for the Friedmann Robertson Walker Models ....637 10.5 Exercises 643