Computational Physics (6810): Session 9

Similar documents
Computational Physics (6810): Session 8

Oscillatory Motion. Simple pendulum: linear Hooke s Law restoring force for small angular deviations. small angle approximation. Oscillatory solution

Oscillatory Motion. Simple pendulum: linear Hooke s Law restoring force for small angular deviations. Oscillatory solution

Chapter 2: Complex numbers

Chaotic motion. Phys 420/580 Lecture 10

MAS212 Assignment #2: The damped driven pendulum

Mechanical Resonance and Chaos

Computational Physics (6810): Session 2

PH 120 Project # 2: Pendulum and chaos

ENGR 2405 Chapter 8. Second Order Circuits

Driven, damped, pendulum

Chapter 14 Oscillations

I. THE PENDULUM. y 1 (t) = θ(t) (2) y 2 (t) = dθ(t) dt

221B Lecture Notes on Resonances in Classical Mechanics

Physics 351 Monday, January 22, 2018

Physics 235 Chapter 4. Chapter 4 Non-Linear Oscillations and Chaos

Lab 1: Damped, Driven Harmonic Oscillator

The damped driven pendulum and applications. Presentation by, Bhargava Kanchibotla, Department of Physics, Texas Tech University.

Lab 1: damped, driven harmonic oscillator

Midterm EXAM PHYS 401 (Spring 2012), 03/20/12

The Nonlinear Pendulum

The Nonlinear Pendulum

Theoretical physics. Deterministic chaos in classical physics. Martin Scholtz

1 Pushing your Friend on a Swing

Nonlinear Oscillators: Free Response

Introductory Physics. Week 2015/05/29

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 License.

Computer Problems for Methods of Solving Ordinary Differential Equations

CHAOS -SOME BASIC CONCEPTS

PHYSICS. Chapter 15 Lecture FOR SCIENTISTS AND ENGINEERS A STRATEGIC APPROACH 4/E RANDALL D. KNIGHT Pearson Education, Inc.

S12 PHY321: Practice Final

Earth s Magnetic Field Adapted by MMWaite from Measurement of Earth's Magnetic Field [Horizontal Component] by Dr. Harold Skelton

Transitioning to Chaos in a Simple Mechanical Oscillator

Control Systems I. Lecture 2: Modeling. Suggested Readings: Åström & Murray Ch. 2-3, Guzzella Ch Emilio Frazzoli

Linear and Nonlinear Oscillators (Lecture 2)

28. Pendulum phase portrait Draw the phase portrait for the pendulum (supported by an inextensible rod)

Project 6 - Calculating π and using building models for data

1 In-class part. 1.1 Problems. Practice Final, Math 3350

Solutions 2: Simple Harmonic Oscillator and General Oscillations

The Coupled Pendulum Experiment

Oscillations. Simple Harmonic Motion of a Mass on a Spring The equation of motion for a mass m is attached to a spring of constant k is

11/17/10. Chapter 14. Oscillations. Chapter 14. Oscillations Topics: Simple Harmonic Motion. Simple Harmonic Motion

Laboratory Instruction-Record Pages

Linear second-order differential equations with constant coefficients and nonzero right-hand side

MAS212 Assignment #2: The damped driven pendulum

Analyzing SHO of a double pendulum

Physics with Matlab and Mathematica Exercise #1 28 Aug 2012

Chaotic Motion (One or two weights)

Assignments VIII and IX, PHYS 301 (Classical Mechanics) Spring 2014 Due 3/21/14 at start of class

1 (2n)! (-1)n (θ) 2n

Rotational Number Approach to a Damped Pendulum under Parametric Forcing

Keble College - Hilary 2014 CP3&4: Mathematical methods I&II Tutorial 5 - Waves and normal modes II

NORMAL MODES, WAVE MOTION AND THE WAVE EQUATION. Professor G.G.Ross. Oxford University Hilary Term 2009

For a rigid body that is constrained to rotate about a fixed axis, the gravitational torque about the axis is

P441 Analytical Mechanics - I. RLC Circuits. c Alex R. Dzierba. In this note we discuss electrical oscillating circuits: undamped, damped and driven.

Lab 3: The Coupled Pendulum and a bit on the Chaotic Double Pendulum

Time Response of Systems

Chaos and R-L diode Circuit

INTRODUCTION. This is not a full c-programming course. It is not even a full 'Java to c' programming course.

Big-O Notation and Complexity Analysis

This is the number of cycles per unit time, and its units are, for example,

Modeling and Experimentation: Compound Pendulum

Classical Mechanics Phys105A, Winter 2007

LINEAR RESPONSE THEORY

Oscillations. Tacoma Narrow Bridge: Example of Torsional Oscillation

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Catie Baker Spring 2015

Lecture XXVI. Morris Swartz Dept. of Physics and Astronomy Johns Hopkins University November 5, 2003

THE FOURIER TRANSFORM (Fourier series for a function whose period is very, very long) Reading: Main 11.3

Analytical Mechanics ( AM )

Faculty of Computers and Information. Basic Science Department

Chapter 3. Periodic functions

Massachusetts Institute of Technology Department of Physics. Final Examination December 17, 2004

Lecture V : Oscillatory motion and spectral analysis

Damped & forced oscillators

Chaotic motion. Phys 750 Lecture 9

Vibrations and Waves MP205, Assignment 4 Solutions

In the presence of viscous damping, a more generalized form of the Lagrange s equation of motion can be written as

Mechanical Oscillations

Chaotic Motion of the Double Pendulum

Problem Set Number 01, MIT (Winter-Spring 2018)

Driven Harmonic Oscillator

The Harmonic Oscillator

Forced Oscillation and Resonance

Mass on a spring: including a driving force, and friction proportional to velocity (eg, from a dashpot).

Lab 11 - Free, Damped, and Forced Oscillations

APPPHYS 217 Tuesday 6 April 2010

Differential Equations 2280 Sample Midterm Exam 3 with Solutions Exam Date: 24 April 2015 at 12:50pm

Linear Control Systems Solution to Assignment #1

4. Complex Oscillations

4. Sinusoidal solutions

x(t+ δt) - x(t) = slope δt t+δt

4.1 KINEMATICS OF SIMPLE HARMONIC MOTION 4.2 ENERGY CHANGES DURING SIMPLE HARMONIC MOTION 4.3 FORCED OSCILLATIONS AND RESONANCE Notes

Taking Stock. IE170: Algorithms in Systems Engineering: Lecture 3. Θ Notation. Comparing Algorithms

Timeline of a Vulnerability

The Big Picture. Python environment? Discuss Examples of unpredictability. Chaos, Scientific American (1986)

Lab 10: Harmonic Motion and the Pendulum

Physics Mechanics. Lecture 32 Oscillations II

Experiment A11 Chaotic Double Pendulum Procedure

Dynamic logic for Hybrid systems

Dynamic Phasors in Modeling, Analysis and Control of Energy Processing Systems

Transcription:

Computational Physics (6810): Session 9 Dick Furnstahl Nuclear Theory Group OSU Physics Department March 3, 2014 Session 8 Stuff Session 9 Overview

Session 8 Stuff Damped, driven harmonic oscillator ẍ + γẋ + ω0x 2 = f (t) ẋ dx/dt, ẍ d 2 x/dt 2 linear equation = only single powers of ẍ, ẋ, x = important for superposition: x total (t) = x homogeneous (t) + x particular (t) x homogeneous (t) will always be damped = transient! particular solution will have x e iωextt = ( ωext 2 + iω ext γ + ω0) 2 e iωextt = A e iωextt so the driving frequency ω ext is the frequency in the linear domain = green dots are on top of each other What if nonlinear? More interesting possibilities!

Chaos Characteristics of chaos (see Session 8 notes) past behavior not repeated (not periodic) deterministic but not predictable, because uncertainty (or imprecision) in initial conditions grows exponentially in time system has distributed power spectrum (see Mathematica notebooks) Necessary conditions for chaos dθ dt 3 independent variables and the equations have nonlinear terms coupling Three equations for the pendulum (with φ = ω ext t) = ω dω dt = αω ω 2 0 sin θ f ext cos φ }{{} nonlinear couplings Session 10: Mathematica notebook pendulum.nb dφ dt = ω ext gives results for Session 8 Looking for Chaos power spectrum: what frequencies are in the θ(t) plot?

Session 9 Stuff Using the GDB debugger GDB is broken on Macs, incomplete on Cygwin = Linux You can run from a Mac or Windows machine by using ssh to the machine called fox (as described) Introduction to concept of debuggers; others will be available Contrived example to expose you to segmentation faults Use the debugger to track down where seg faults occur Segmentation faults From accessing memory that doesn t belong to your program double x[10]; x[10] = 5; // why does this seg fault? Other segfaults: stack overflow; dereferencing unassigned pointers: int *my_ptr=0; *my_ptr = 3;

Session 9 Stuff (cont.) Profiling: finding out where your program spends its time Code first for correctness and clarity; then worry about speed 90/10 rule: 90% of the time is spent in 10% of the code, and only 10% of the time in the remaining 90% of the code So find out where the program spends its time gprof counts statistically; subject to fluctuations but usually you only care about the coarse distribution of time Optimization by the compiler Knuth: We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil See Wikipedia Compiler Optimization for good background discussion It matters a lot Use -O0 (no optimization) when debugging Use (at least) -O2; be careful with -O3 and higher Default optimization is compiler/installation dependent = specify in makefile

Session 9 Stuff (cont.) Example optimizations done by you or behind the scenes -fgcse global/local common subexpression elimination a = b*c + g; d = b*c*d; tmp = b*c = a = tmp + g; d = tmp*d switch loops to improve locality of reference e.g., use fast memory sequentially branching (e.g., if statements) can prevent prefetching of instructions = cut down to enhance predictability Revisiting area.cpp with a C++ class Where are objects created and destroyed? Extending the class private vs. public variables rsync: backup/mirror files but only the differences!