Physics 315 Computational Physics Brad Hinaus B207 Science bhinaus@uwsp.edu 346-4872 Lecture: TT 2-3 A106 Science Lab: W 10-1 pm B112/A104 Science Office Hours MW :1-2pm F 9-11am Walk UP if Door Open Text Book from Text Rental: Computational Physics by Nicholas Giordano What is Computational Physics? Computational Physics is a branch of physics which uses computers to solve physics problems. Physicists use the computer to simulate complex physics situations. These simulations can be used to model experimental data to determine the physics that explains the data or to determine what happens under other experimental conditions. The computer can also be used in a pure numerical sense to compute an integral or a derivative. In any case the focus of computational physics is to gain in insight into the physics involved in a scenario through the use of a computer not on writing elegant compact code. Programming Software In this course we are going to learn how to write computer simulations in Fortran 77. There are numerous reasons why we are using FORTRAN. 1.) The syntax (how commands are typed) is relatively straightforward. 2.) The compiler we are going to use is free and you can put it on your home computer. 3.) According to those knowledgeable in the field, once you understand FORTRAN, it’s not too hard to learn C then C++. We will also use Microsoft Excel quite often. We will use it spreadsheet functions for quick calculations and use its graphing routines for visualization. During class you will receive a copy of the FORTRAN compiler on a CD so you may install it on your own computer. We will also use GNUPLOT for plotting. It is relatively easy to use for 2D and 3D plotting Learning Outcomes When you finish this course you should be able to do the following. See Appendix for more detail Demonstrate an understanding of physics principles and concepts both through written and oral communication. Solve physics problems that use differential equations, integration, or stochastic methods by using a computer. Program using a high level programming language. Model the physics in various complex systems using a computer. Grading You will be graded on the following: homework, papers (lab report and project reports) group projects, presentations, exams and an individual final project The final course grades will be weighted as follows Final Individual Project Exams Papers and Presentations Homework/In Class Work 20% 40% 20% 20% Exams, Homework, and In Class Work will receive numerical scores. Paper, presentations, and the final project will be given numerical scores out of 100 in 5 point increments. The following table shows the ranges of percentage points for final grades. Letter Range A AB+ B BC+ C CD F Percentage 93-100 90-92.9 87-89.9 83-86.9 80-82.9 77-79.9 73-76.9 70-72.9 60-69.9 0-59.9 Contents of the Course Section 1 Physics: One/Two/Three Dimensional Motion and Newton’s Laws. Writing Newton’s Second Law as a differential equation. Programming: Excel Numerical.: Solving Differential Equations w/ Euler Method Communication: Writing Papers, Writing Introduction and Method and Measurements, Giving a Presentation Section 2 Programming: Basics of Fortran, Simple Programs Numerical: Root Findings, Summations, Max/Mins. Communication: Rewriting a Previous Report Section 3 Physics: Pendulum, Faraday’s Law, Random Systems, Monte Carlo Simulations, 1-D Icing Models Programming: Intrinsic Functions, User Defined Functions and Subroutines Numerical: Methods for ODE, Integration, Random Numbers, Numerical Recipes Writing: Writing to an Audience, Analysis and Discussion Section 4 Physics: Quantum Mechanics, Solving Schrödinger’s Equation, Individual Capstone Projects Numerical: Boundary Value Problems and User Choice (Something interesting, something new, both in physics and computation) My Teaching Philosophy I think the college classroom should reflect basketball practice. Mentally picture what basketball practice looks like. What do you see? Its active, people are moving around and doing things. Players don’t spend 100% of their time watching their coach draw diagrams on the chalkboard then go on the floor and walk through the plays. The ball players spend a good portion of their time working on the skills themselves. That is what I want us to do, work on our skill during class with each other. Will we eliminate the lecture? No, but I hope to reduce the amount of time in that mode so we can practice and ask questions. (If basketball doesn’t work for you, substitute learning a musical instrument) Additional References: Computational Physics: Problem Solving with Computers by Rubin H. Landua and Manuel J. Paez. Internet Site: http://www.physics.orst.edu/~rubin/CPbook/ An Introduction to Computer Simulation Methods: Applications to Physical Systems by Harvey Gould and Jan Tobochnik Numerical Recipes in Fortran 77: The Art of Scientific Computing can be found on the internet at: http://lib-www.lanl.gov/numerical/bookfpdf.html Appendix A Spring 2012 Learning Outcomes 1. Numerically Solve Different Types of Physics Problems Using Multiple Techniques a. Ordinary Differential Equations i. Types of Differential Equations 1. 1st Order Differential Equation 2. 2nd Order Differential Equations 3. Differential Equations which need to be written in Component Form 4. Coupled Differential Equations ii. Techniques for Solutions of Ordinary Differential Equations 1. Euler Methods 2. Euler Cauchy Method 3. Euler Richardson Method 4. Verlet Method 5. 2nd Order Runge-Kutta 6. 4th Order Runge-Kutta iii. Types of Problems using Differential Equation 1. Initial Value 2. Boundary Value iv. Final Project b. Integrals i. Techniques for Solving 1. Endpoint Rule 2. Trapezoid Rule 3. Simpson’s Rule 4. Monte Carlo ii. Dealing with Singularities (Divergences) c. Stochastic (Random) Processes i. Uniform Random Number Generators ii. Small Sample vs. Large Sample iii. Generating Non Uniform Distributions 1. Transformation Method 2. Rejection Method iv. Monte Carlo Simulations 2. Understand the Fundamentals of a Programming Languages a. Useful Features on Microsoft Excel i. Absolute Reference vs. Relative Reference ii. Variable Naming iii. Graphing b. Fortran i. Understand the Structure of a Program by 1. Developing Flow Charts or Algorithms ii. Correctly use the Syntax of the Programming Language (Fortran) 1. Columns 2. Continuation 3. Comment Lines 4. Type Declaration 5. Arithmetic 6. Integer Division 7. Real Division 8. Do Loop 9. If Statements 10. Implicit Function calls 11. Explicit Function calls 12. Subroutines 13. Type change (i.e. changing an integer number to a real value) 14. Arrays iii. Synthesize the Algorithm and Syntax To write a Program iv. Ensure that programs are running correctly 1. working from known answers 2. working in limits 3. conceptual justifications (not always fool proof) 4. use of different methods/routines v. Debug any incorrectly running program 3. Effective Communication a. Write Clearly and Concisely to Communicate the Physics, Methods and Results of a Project i. An effective paper will 1. Be written to the appropriate audience 2. Briefly Summarize the entire paper 3. Describe the basics physics of the problem 4. Explain the appropriate numerical technique being used 5. Interpret and analyze the data 6. Present the results in an understandable format i.e. descriptions, tables or graphs 7. Justify the results are correct by using a conceptual explanation, limiting cases analysis, analytic solution, solution by multiple numerical techniques, etc. 8. Estimate limits of the solution 9. Convey an understanding of the broader application of the solution ii. Papers will include the following Sections 1. Title 2. Introduction/Abstract 3. Methods and Measurement Section 4. Results Analysis and Discussion 5. Conclusion iii. Critique the Writing of Peers 1. Offer Constructive Feedback on Points of Excellence and Points of Improvement b. Oral Presentations i. An effective talk will have the same elements as an effective paper ii. Presenters will be 1. Comfortable 2. Confident 3. Professional Appendix B Schedule until It Changes Wk Week Topics Tues Lecture Wed Lab Thurs Lecture 1 2 1/23 1/30 Euler’s Method with 1-D ODE’s Euler’s Method with 2-D ODE’s Write a Paper Peer Review Intro 3 4 5 6 2/6 2/13 2/20 2/27 3-D ODE with constrained motion No Lecture Practice Problems Approx. to deriv Solve a few probs with Euler method Time Steps Analytic Solutions •Intro to Newton’s Laws in 2-D •Writing Newton’s Laws in Differential form •Writing NL in component form. •Practice Problems Project Project Fortran/Exam •Columns •Type Declaration •Math •Assignment •Statement •Basic Structure Fortran Structures •Loops and • If Statements Paper Pencil Problems Intro/ Physics 101 Problems Drag Problem/NonLinear Spring Translate from Phys 101 to Differential Form Fundamental Theorem of Calc. Euler’s Method Initial Values Coupled Differential Equations How to Write a Paper Components What’s in each Comp. Example from AJP Hand in Drag Paper Project Handout •Magnus Force •Baseball •Coriolis Force •Electron Microscope •Magnus Force Golf with a side breeze Project Good Talk Bad Talk Presentations and Papers from Project Reflective Essays Exam Basic Problems Interactive •Loops and Play Computer Practice Loops Play computer Redneck Jumping Write Intro and Methods Section •Simple numerical problems i.e. Root finding, max and mins •Work on Pendulum Analysis 7 3/5 Practice Fortran •Intrinsic Functions •Counting number of occurrences 8 3/12 Alternative Solutions to ODE/Integration Array’s 9 10 11 3/26 4/2 4/9 Integration Function Calls Random Subroutines Examples of Monte Carlo Flux Computation and Paper Nuclear Decay Diffusion or 1-D Ising or Fractal 12 4/16 Boundary Value Problems Analytic Solutions Quantum Wells Exam 13 14 15 4/23 4/30 5/7 Final Projects Final Projects Final Projects Final Projects Final Projects Final Projects Final Projects Final Projects Final Projects Random Swinging Pendulum Analysis - Presentations Make Up Time Exam No Name Net Force Spring 2012 Comp In front of the University Center there was a crane that lifted material into the air when it was being remodeled. Let’s say the crane is lifting a box and the box is not on the ground. a.) Draw the two main vertical forces acting on the box. Label each force with what exerts the force and what feels the force. Box b.) The box is moving upward but begins to slow down as it approaches one of the floors where it is needed. As this happens, which of the two forces on the box is bigger, or are they the same. Explain your reasoning. Thinking In Extremes or in Baby Steps Jars Monte Hall Problem