### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Science and Computers I PHY 307

Syracuse

GPA 3.93

### View Full Document

## 11

## 0

## Popular in Course

## Popular in Physics 2

This 99 page Class Notes was uploaded by Ms. Bryce Wisoky on Wednesday October 21, 2015. The Class Notes belongs to PHY 307 at Syracuse University taught by Staff in Fall. Since its upload, it has received 11 views. For similar materials see /class/225633/phy-307-syracuse-university in Physics 2 at Syracuse University.

## Reviews for Science and Computers I

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/21/15

NOTES ON LOOPS amp ANIMATION Some comments on thon and programming variables are the names associated with objects Variable names are any string of letters numbers and underscores eg myvariable43 but can t start with a number 3bin is illegal Some objects are simple like integers 123 29 oats 31415 Some are more complicated and have many attributes like a box object in Visual key words or reserved words are little words like for in while print etc that are illegal variable names since they have special meanings procedures or functions are things that look like variables but have parentheses in addition like range10 range2003002 sin43 b0xx9c010rc010rgreen The stuff if any inside the parentheses are the arguments to the function The meaning of the arguments is determined either by position like in range or by name like in box These procedures do things like make a list or make a box or calculate a mathematical function We will see examples as we go along for loops Loops are crucial to writing computer programs The purpose is to have a computer do something maybe hundreds of times maybe billions of times without having to write out the same command hundreds or billions of times You need to be able to set up repetitive tasks like check my e mail every second all day long for new mail or simulate the future of the solar system by calculating the position of the Earth every year for the next billion years Loops are in all computer languages How do they look in Python In outline form they look like the following for in statementl statementZ statement3 etc The for in and are required to say to Python this is a for loop In the first blank goes a variable name which can be any legal name such as i myvariable kristy a d00mumber3 or uv40 for example In the second blank goes a LIST A list can be made up by hand as in mylist 12310 anotherlist a 439 7 Note that a list is a list of objects separated by commas and enclosed by square brackets Another way to make a list is to use a FUNCTION that makes lists An example of such a function that is built into Python is range For example the expression or function call range10 makes a list with 10 items namely 0123456789 while the Jnction call range2163 counts from 2 to just less than 16 by 3 s 2581114 The indented statements or single statement a er the for statement is what gets repeated over and over So if you run the following program for j in range10 print Hello you will get 10 line of Hello printed out This is because this set of statements means the following 7 Compute what range10 means This gives the list 0123456789 Set j to the rst item in the list That is j0 Execute the block statement that is print out Hello Set j to the second item in the list That is j1 Again execute the block statement print out Hello And so on until the computer is done with the list Note that in this last example the value of j was not used in the block It was just a placeholder whose value was not used x x x x x We can also write a for loop that does use the value of the index variable Look at this for j in range10 print i This will print out the numbers from 0 to 9 Consider updating a bank balance for a year where each month you pay 230 rent and earn 5 in interest Suppose you have both a checking and savings account You could keep track by trying this program checking 450000 initial checking balance savings 50000 initial savings balance now de ne the monthly changes rent 23000 interest 500 use a for loop to update these balances over 12 months for month in range12 checking checking rent savings savings interest print Checking balance checking Savings balance savings This program will print out a series of 12 reports 1 line each on the status of the checking and savings balances After setting up the initial amounts and setting how quickly the balances change the changes are applied 12 times The block consists of the last 3 statements What happens is 7 range12 gives the list 01234567891011 7 month is set to the first item in the list so month 0 7 checking is updated 7 savings is updated 7 The balances are printed out 7 month is set to 1 7 checking is updated 7 savings is updated 7 The balances are printed out 7 month set to 2 7 and so on until all of the list items have been gone through Ifyou are having trouble with loops I suggest you try the above program out and modify it some 7 changing the number of months printing out the month number in addition or other changes Changing objects When we are using Python objects such as the box and sphere objects in VPython we want to be able to modify their attributes such as color or position or size For example to make a sphere and then change its radius we can use the program from visual import a sphereradius2 make a sphere of radius 2 assign it to a aradius 3 now change its radius to 3 This will do the trick but note that it will happen too fast to see So let s use a for loop to make a growing sphere Here s a program that will do that from visual import a sphereradius2 for j in range1000 rate20 aradius aradius 001 This is just like the checking balance program in that the value of something is being changed except we can see the change via Visual 20 times a second the radius of the sphere a will be increased by 001 Summarize in English this program means to the computer Import the visual tools so I can draw Then make a sphere of radius 2 named a Repeat this action 1000 times increase the radius of a by 001 But the rate20 statement reminds me to do this at most 20 times a second so those slow humans can see it happen MAPS Time moves forward As time moves forward things change Ifwe believe in physical determinism the future is solely determined by the present If I know where the planets are today I can predict where they will be tomorrow The idea of a map is based on this ability to predict some time into the future For example if I know that the water level in a lake decreases by 05 meters a year I can write a map to compute next year s water level based on the current water level next year 3 water level this year 3 level 7 05 In Python I might write waterlevel waterlevel 05 to update the water level value Using a loop like for the bank balance would then let me follow the water level over time waterlevel 50000 for year in 19002050 print At the start of year year the waterlevel is waterlevel waterlevel waterlevel 05 When plotted as a lnction of year the water level simply decreases linearly in time as a straight line Another example of a map might be a slowing car Suppose that the car s speed decreases by 10 each second That is the new speed is the old speed multiplied by 09 How would we calculate its speed in a loop over 20 seconds Another example is interest rates consider a bank account that grows by 5 each year The magnitude of the balance increases in time in a predictable fashion The maps that we have discussed so far are not chaotic They do not have a butter y effect The lab today will look at how we do not see a butter y effect Stalting next time we will look at maps that do have chaotic behavior PHY307 Science and Computers I Lab 3 September 10 2002 due by end of lab period Playing with Maps Summag of what you will do You will use loops to compute the effects of maps The maps will be simple you will see how to visualize the maps and to see for yourself that the maps are non chaotic You will also have time to polish your programming knowledge PYTHON NOTES Graphing will be introduced here We will also visualize the maps using hopping objects When watching hopping objects set sceneautoscale 0 so that you can see what happens more clearly if you don t do this the camera viewpoint will be changing LOOPING Log in to your workstation using your CMSSUniX name amp password Open up some editor or word processor to start your report Put in atitle your name and date As you write the report make it clear what each section is At the end of the lab print your report out staple it together and hand it in Get IDLE for VPython going by going through the Menu Start SU Academic Departments Physics Open a proglam le editor by New under the File menu and save your currently empty work to your 1 or K drive as looplpy or a similar name Write a program that will make a cone that hops around The x position of the cone will be the negative of the old x position For a map we write this as X goes to 7X or X X Have the cone hop 6 times a second Start the cone at position x5 Does the butter y effect show up in this map Create two cones say a and b separated by a small distance say x50 and x51 Have both cones hop in the for loop set ax ax and bx bx Remember to have arate limiting statement inside your for loop Do the cones stay together or diverge In your report include your program and describe what you see Now do the same with another map In this map have the cones x position multiplied by 099 each time step In your report include your program and describe what you see Now we will repeat these same two maps but plotting at the same time the positions on a graph I ll lecture on how to do this today N E 4 V39 0 l 00 Lec9 mini lecture o More fractals Julia sets Julia sets Consider the very simple non linear map 2 a CL n l l n 4 For most starting values of 1 the final 1 2 00 In fact 1 only remains bounded if x lt 32 See by drawing graphs of y 1 and y 2 o The boundary between the two regions in 1 diverging and non diverging is called the Julia set of the map and contains seem ingly 2 points 1 and 1 2 o Things much more interesting if we allow ourselves to consider complex numbers Complex numbers Summary Complex number has 2 parts real and imaginary zx7 y Needed to give answer to question what is square root of a negative number Addsubtract by addingsubtracting corre sponding parts Multiply out using usual rules and collect terms together with the simple rule 72 1 Magnitude z W Maps of complex numbers Consider previous map for complex numbers Zn1ZZnZn Z o What is now the region in which z diverges under iteration of the map o The region of convergence is called the filled in Julia set 8 and the boundary be tween between diverging and non diverging sets is the true Julia set of the map 0 Remarkably it is a fractal o The boundary is rough on all scales Other Julia sets Try general maps f2 z a with o a O85 0187 0 a 124 0157 0 a O16 0747 In lab will add zooming feature which will demon strate this structure on all length scales LeclO o Self organized critical phenomena o Earthquakes sand piles Selfsimilarity and criticality We have so far seen several examples of sys tems which exhibit power law behavior eg a Fractal dimensions Number of cells needed to cover points of fractalstrange attractor N5 N SDF a Size of percolating cluster as a function of number of lattice points a Systems exhibiting phase transitions Later In general power laws such as these indicate that the system is a self similar property Looks same under change of scale Mathematics of selfsimilar systems Mathematically N5 N 5 If 5 gt 25 form of this function doesn t change Contrast with behavior like N3 N 6 8 Systems are said to be critical Do not exhibit a characteristic length scale May exhibit universal features Selforganized critical systems 0 Usually one needs to tune external param eters eg the percolation probability p to achieve this critical condition or the tem perature T in a thermal phase transitions 0 Occasionally systems will automatically or ganize themselves into a critical state with out any tuning Such systems are said to be self organized Examples o Earthquakes o Sand dunes Sand piles 0 Discuss simple model showing self organization o Ignore details of motionforces on sand grains Just focus on essence of problem Add sand slowly at one point Allow system to topple at some point when height of local sand pile gets too big Transfer excess sand to neighbor points Reaxamine stability of neighbor points Model a One dimension Start with flat surface 0 Add single grain at LHS Check if local slope exceeds some value 1 here If so topple the sandpile by some amount say 2 grains and add to next 2 neighbors Recheck stability of all points and re peat until no further toppling a Add more sand and repeat Observations After some time distribution becomes station andoes not Change m UitHne on the aver age Fhen ask gueonn vvhatis the average dh U bqun ofzn nanchestopphng eventsin the systeniaftera shm e grahiis added Seepowermm o What is power Is it universal ie can I tweak the details of the toppling rules to Changeit oIs thesamefOranmwera s c2drnodd etc Earthquake model Earthquakes results from the complex relative motion of separate pieces of the Earth s crust They appear to happen quasi randomly and their magnitudes have been observed to sat isfy the Gutenberg Richter law NE N E b where b N 05 Here E is the Earthquake magnitude rogth the amount of energy released during the quake o This power law suggests that they may have self organizing characteristics a Indeed we can construct a very simple model similar to the sandpile for discussing them Model Consider the surface to be represented by blocks with 2d coordinates 7j Each block can move independently of its neigbors with F7Lj representing the net force on that block Start from some random initial state a Increase F everywhere by a small amount AF 2 000001 0 Check if F gt FC 2 4 critical threshold for slipping o If one or more blocks unstable go to a Let F7Lj F7Lj FC Relaxation ac companied by Fii 1j i 1 Fii 1j i 1 1 Results After many iterations system approaches steady state Earthquakes measured by number of slipping blocks of all sizes are seen Notice that again have ignored almost all de tails of problem This is justified after the fact by recognizing that we are searching for self organized univer sal behavior which should be independent of such detaHs But note that this model will not give an ac curate description of individual earthquakes merely what happens to very many of them 10 Lec6 More fractals Dimensions Julia and Mandelbrot fractals Event driven progra mming Arrays Recap 0 Nonlinear systems can exhibit chaotic be havior Apparently random non repeating mo tion Extreme sensitivity to initial conditions Motion falls on strange attractor o Examples nonlinear driven pendulum lo gistic map a Strange attractors fractals Self similar object non integer dimension 0 Eg Sierpinski triangle Key point All fractas associated with Chaotic dynamics Complex in python Python contains an intrinsic complex type complex eg ccomplex0 1 02 cab etc works transparently AISO conjugate Crealcimag etc And absz Coding complex maps trivial Arrays in python 0 Similar to lists eg x2 is 2nd element of an array x o Restricted to reals and integers eg a array2 2 Float a zeros5 Int x zer08N N o Allows one to use powerful fast functions to do array processing eg xy01 adds 01 to all elements of arrays x and y which must obviously be of the same size and shape Other Julia sets Try general maps fz z a with o a O85 018139 c a 124 015139 c a O16 074139 In practice if abszgt2 iterations will always ex blode Try fixed number Close to boundary need very large number to know Useful to zoom 10 Zooming Julia sets as seen from the complex plane look quite fractal that is they exhibit lots of structure at small scales One way to see this more clearly would be examine some portion under high magnification Would be nice to be able to zoom in This can be done picking out some point and recomputing the Julia set on a small region around that point This point can be selected by clicking with the mouse Requires new event programming techniques 11 Event programming event loop while1 look for mouse clicksdrags if scenemouseevents myeventscenemousegetevent if left click increase scale factor if myeventpress left scalefactorzoom get screen coordinates targetmyeventpos 12 More events Can also collect keyboard events textbox events scrollbar events etc Very important in designing graphical user interfaces GUI Allows one to build interactive programs which can be modified while running In this course only used occasionally how ever see the zooming code juliazoompy 13 llore fractals Mandelbrot 0 Can play a new game Set initial z0 and it erate the Julia set map with variable con stant a 0 New famous fractal the Mandelbrot frac tal 14 Lecture 4 Recap many particles Nonlinear systems chaos Phase space Poincare maps strange at tractors Period doubling Lorenz model balls in boxes Many particles Consider two masses a and b interacting via some mutual force Denote force on a due to b as Fab Likewise force on b due to a as Fba By Newton s third law Fab Fba vector statement Given a specific force law can we solve Newton s 2nd law for both particles numer ically simulate the system Python lists Useful to introduce a list to store the objects which are interacting systemballaballb In general lists can comprise numbers or arbi trary abstract objects enclosed in square brack ets eg a123 b456 crange110 The statement cab concatenates the lists for loops To carry out a sum over all balls use for com mand eg for ball in system ballposballposballve1dt 0 Note indentation all statements at same level are executed before passing to next element of list a Note give each ball a position velocity and 2 accelerations 0 Use leapfrog to update 0 Add elastic force for walls of container reverse velocity if hits wall integrate module from visual import A100 r0005 def newforceab diff10r0aposbpos return Anormdiffexpdiffmag2 def totalforceaobjlist forcevector000 for ball in objlist no selfinteraction if balla forceforcenewforceaball return force Summary so far Learnt how to solve Newton s laws of mo tion for simple mechanical systems 1 or more particles in 1 or more dimensions Example molecular model of gas Motions are deterministic nevertheless mo tion can appear complicated or even ran dom many particles But it cannot be truly random In fact it is chaotic Plotting graphs o Additional displays to show 2D plots are easily created picgdisplay myplotgcurvegdisplaypic a Data is plotted with the command myplotplotposxy a Can specify how big is display and where it appears on computer screen Also labels axes etc a Multiple windowsdisplays allowed 10 Simple observations Initially transients seen remnant of decay ing natural oscillation Small driving force small amplitude mo tion in step with driving force like har monic case Larger F apparently random or Chaotic behavior seen Windows of regular motion found at larger F Cannot be truly random motion deter ministic Something more subtle happen ing 11 Sensitivity to initial conditions Two identical pendula with slightly different initial conditions In regular regime motions converge with time o In chaotic regime diverge o In first case poor knowledge of initial con ditions is irrelevant to predicting long time motion 0 In other case implies no predictability at long times eg weather 12 Phase space Useful to examine motion not as t0 and tw but in phase space 9w 0 Regular non chaotic motion yields simple closed curve a Chaotic motion much structure Many nearly closed orbits sudden departures to new orbits never repeating 13 Poincare plots Instead of plotting entire phase space trajec tory plot 9w only at multiples of time period of driving force a For regular motion single point seen a For chaotic motion non space filling struc ture seen Does not depend on initial con ditions o Predictable aspect of chaotic motion called a strange attractor o All chaotic motions of system approach a motion on the attractor a Not a 1D curve in general fractal object later 14 Lec8 Many degrees of freeedom statistical physics Phase transitions critical phenomena Magnetic systems Ising model Mean field theory correlations Simple example Ising Model a Can use these methods to study molecular systems complementary to molecular dy namics simulations considered earlier But easier o Consider magnetic materials at atomic level these consist of stationary magnetic dipoles or spins which form lattice o Spins can point up or down N or S and in a ferromagnet the energy of the system is lowered if neighboring spins point in same direction a 2D Ising model replace spins by variable 5i 2 i1 living on sites of 2D lattice with energy given by EZ J Z SiSj HZSZ i ltijgt Mean field approximation Go back to original 2D Ising system Replace the sum over nearest neigbor spins by the in teraction with an effective magnetic field JZZSZ Sj gt 4J lt 8 gt 281 j z 1 Now solve the equation lt 8 gt tanh 4J lt s gt kT Graphically see 2 solns o T gt TC lt 8 gt 0 o T lt TC 2 solns One with lt 5 gt72 0 N umerical Solution Use bisection algorithm to solve for lt s gt eg To solve equation f13 0 find 2 points x1 and 2 at which f has opposite sign Root ies somewhere between Examine the midpoint 131 x22 and hence determine new interval to search Note interesting region Close to kTJ kTCJ 4 Phase transitions Ising system can exist in two phases lt S gt2 O magnetized and lt 8 gt72 0 unmagnetized Controlled by temperature Close to TC system exhibits power law be havior Many examples of systems exist with sev eral phases characterized by macroscopic state eg Solid liquid transition at some critical TC Ferromagnetic phase transitions Earthquakes and sandpiles Critical Phenomena Close to the phase transition T N TC the system exhibits critical behavior eg spe cific heat C N T TC 0 The critical exponent or is universal it is the same for many different materials The underlying reason for this universal ity is that the critical system exhibits very long range correlations between individual molecular constituents The distance over which these correlations take place is called the correlation length gt 00 This washes out details on scale of lattice spacing correlation function lt sosi gt 6 15 11 Phase transitions in Ising model a Simplest case two dimensions c Find for T TC 2269 fluctuations in M have a peak oMOfOFTgtTc MOforTltTC a Close to TC X N T TC1 875 in 2 dimen sions M N T TCO395 13 Lecture 5 Chaos logistic map Period doubling strange attractors frac tals Sierpinski triangle chaotic dynamics Fractal dimension Logistic lVlap Simplest example of chaotic dynamical sys tem Exhibits period doubling approach to chaos In chaotic regime motion confined to strange attractor Fractal object dimension non integer Model Model for population growth after n steps of reproduction Let Pn represent population in generation n o a represents unlimited reproduction rate a b represents competition limited growth Rescale xn1 4rxn1 am Single parameter 7 controls dynamics To keep am positive impose O lt r lt 1 and O lt x0 lt 1 Strange attractors In chaotic regime values of 1 never repeat Motion looks random yet cannot be Some regions in O lt a lt 1 never visited Set of points is a fractal Such an object looks same under magnification Not a standard geometrical object has an non integer effective dimension Note independent of mo dynamics leads to motion on this fractal strange attractor Logistic lVlap attractor Points on attractor live in O lt a lt 1 Divide this segment into 2P equal pieces Count how many points lie in each cell Define one dimension by plotting num ber of cells needed to cover fractal against length of cell Gradient of straight line dF Comments 0 Notice dF lt 1 Does not fill embedding space Holes of all sizes seen Fills vanish ing fraction of all points in O lt x lt 1 0 Infinite number of points on fractal but represent a vanishing fraction of all points in O lt a lt 1 Like eg number of ratio nal numbers pq Infinite in number but a vanishing fraction of all real numbers o Other definitions ofdimension possible Mul tifractals Other fractals Sierpinski triangle Example of regular fractal Looks exactly the same on all scales Can be defined recursivey Exploits self similar nature of fractal But can also be seen as the strange attrac tor of a special nonlinear dynamics Exhibits a fractal dimension dp log3log2 10 Sierpinski dynamics Points 13y on triangle originate from dynam ics a a3 by e y 2 ca dy f where set a b c def comes in three flavors Which set is used for a given update is chosen at random This is how what looks like a linear update be comes effectively a nonlinear dynamics 11 Lec3 Many particles Recap of lec2 Many particles balls in boxes Python lists for loops t05 ballvelballvel1ballmassoldforce forceballposballveldt05 Many particles Consider two masses a and b interacting via some mutual force Denote force on a due to b as Fab Likewise force on b due to a as Fba By Newton s third law Fab Fba vector statement Given a specific force law can we solve Newton s 2nd law for both particles numer ically simulate the system Python lists and for Useful to introduce a list to store the objects which are interacting systemballaballb In general lists can comprise numbers or arbi trary abstract objects enclosed in square brack ets eg a123 b456 crange110 The statement cab concatenates the lists More for loops To carry out a sum over all balls use for com mand eg for ball in system ballposballposballve1dt 0 Note indentation all statements at same level are executed before passing to next element of list a Note give each ball a position velocity and 2 accelerations 0 Use leapfrog to update 0 Add elastic force for walls of container reverse velocity if hits wall Integrate module a Change force function to newforce Latter is passed the labels to two individual balls and computes mutual force vector 0 Function totalforce gets total force on a single ball Comments Notice that in absence of repulsion force trajectories of balls are regular and repeat ing But fill all of space when interaction included Note code works just as well for any num ber of balls Just need to initialize all their positions and velocities Straightforward to model other force laws eg inverse square Just change definition Of newforce Can use to model molecules in a gas Study freezing transition 10 Summary 0 Discussed improved integration algorithms 0 Developed code to study multiparticle sys tems here hard spheres 0 Hard sphere repulsion leads to Chaotic tra jectories 11 PHY307 Revision Sheet You should look over carefully all posted lecture notes Additionally I would recommend looking at your lab writeups including a brief review of the main elements in your nal lab codes The questions will be mostly short reponse questions write out your answer in the format requested eg up to 4 lines of code7 a few short sentences or a single name They will be designed to test basic understanding of both programing and physics issues 7 there will be no long calculations or dif cult code to interpret To try and clarify the kinds of things I will expect you to be able to handle please study the examples below if you don7t understand something I suggest you go back to the appropriate lecture H 3 9 7 Python Know how to assign and do arithmetic operations on simple variables in Python eg N N NH ltOO X pr int 2 Know how to create a list 0 Explicitly eg X102030 0 Using the arangeO function eg Xarange104010 Notice the latter yields real oating point numbers 1020730 but not 40 For an integer list use the simple rangeO function Know how to access an element of a list eg X2 which would yield the result 30 on the above list Remember list elements start with index 0 not 1 Know how to loop over all elements of a list for i in range04 Xixi30 CT CT I 00 K O H Again7 notice that range04 produces the list 013 Know how to create an array Arrays are like lists but are more ef cient in numerical work A 1D array can be de ned by passing it a list eg yarray1020307 or yarrayarange104010 If we want to de ne a one dimensional array of say 100 oats which are initially zero we can say yzeros100 Float A two dimensional array ofsize 100100 is de ned similarly yzeros 100 100 Float Elements may be accessed using the command yi j or yij Example of using an array in conjunction with a for loop for i in range 0100 for j in range 0100 yi jyi j10 while loops Eg the main loop of a simulation might read while1 tt dt updatey iftgt100 finishup Note tabbing crucial in Python In above code everything at same tab level is executed each time around the while loop But only if the if statement is true does control pass to the function finishup The latter is said to be under control of the if statement if statements allow ow through program to depend on logical tests see above Functions Take arguments Compute one or more values Must be de ned either in a separate module or earlier in the code before being used Simpi es reading of longcomplex code def update y for i in range 0100 for j in range 0100 yijyij1o 2 H D H 4 Modules eg mymodule py containing Python code and functions may be included using the line from mymodule import at beginning of main module Most important of these is the visual module which allows us to use code for manipulating 3D objects in a 3D visual environment Know how to create eg sphereO objects and give them certain at tributes eg ballspherepos000Colorcolorred radius01velocityvector012 Accessing these features is easy eg ballvelocityballvelocityforcedt In above force is a vector object Syntax to create and plot pairs of values to a simple 2D graph eg mygraphgdisplay width400 height400 xmin0 O xmaX10 myplotgcurve mygraph colorcolor blue myplot plot Xy Random numbers the random and randintab functions in the random module t0 5 pn1pndt05anan1 Metropolis algorithm For simulating system with many dof undergo ing thermal uctuations Update system according to probability e AH where H is energy Box counting method for computing fractal dimensions Find the num ber of boxes Ns of side length 5 needed to cover all points of a fractal dF hilN s Physics H Planetary motion Simple orbits for 2 bodies using inverse square law 7 circles and ellipses For three or more bodies more complicated motions 7 precession of elliptical orbit True for Earth and inner planets due to Jupiter Also correction due to General Relativity D Chaos Nonlinear system can exhibit apparently random behavior Ex ample nonlinear driven pendulum Features 0 Motion never repeats 0 Extreme sensitivity to initial conditions 0 Motion at large times con ned to strange attractor 0 Period doubling one common approach to chaos Period of motion keeps doubling as some control parameter is tuned to a nite limit 0 What is a Poincare section 7 3 Strange attractor is a fractal object Non integer dimension Know how to compute dimension by box counting 4 Properties of fractals o Self similar o Non integer fractal dimension 0 Structure at all length scales 0 Examples simple non linear systems Julia sets7 Henon map Sierpinski triangle know how to construct by recursive drawing Cf Know de ning map of Julia set 2 n1 2 11 z n a Check for 7 00 as n 7 oo 03 Self organized critical system Know properties power law distribu tions No need to tune external parameters 7 dynamics drives system there Be able to describe models for following 0 One dimensional sandpile 0 Two dimensional earthquakes simple model 7 Critical phenomena Tune eg temperature System undergoes phase transition Characterized by power law behavior for thermodynamic quantities Critical exponents Structure at all length scales 8 2d lsing model Basics of model Energy function Phase diagram NOTES ON THE LOGISTIC MAP In science we use numbers to describe the state of a system such as 10132 zebra sh are in the lake or the asteroid is moving at 10 kilometers per second and is 32000 km away from this point Given those numbers and a model or theory for how the system changes in time we can predict the future Ifwe consider making predictions at regularly spaced intervals or whenever speci c conditions are met we might represent our knowledge as a map The map is the function that predicts the observations at a speci c time in the future based upon the current observations Exam gles Clock Based upon experience we note that every 3 hours the little hand on an analog clock advances in angle by a right angle 90 So if we measure the angle in degrees with respect to the up direction the map can be stated in English as if the angle of the little hand is a then 3 hours later the measured angle is a90 in clockwise degrees The shorthand for this might be a 7 a 90 every 3 hours Slowing down of a rolling ball Again based upon experience we might nd that a rolling ball on a linoleum oor slows down to 12 of its speed every time it crosses a tile Ifwe measure the speed s in meters per second ms we might write this as s 7 32 each tile Repeating mags These maps can be repeated also called iterated to predict further into the future You can check in these examples that a 7 a 180 every 6 hours and that s 7 s 8 every time the rolling ball crosses three tiles We will use maps stated in this format to simulate how systems evolve in time What we will nd is that amazingly intricate behavior can arise from very simple maps LOGISTIC MAP We will spend a little time in this class studying the famous logistic map and its relatives Much of this discussion was gone over quickly in class on Sept 12 and it overlaps very much with the discussion in the book Chaos by Gleick Let s see how the logistic map arises from a simpli ed analysis of population growth in a limited environment This analysis will assume a reproductive rate that depends on the available resources when the population is high the available resources are reduced so that the reproductive success is reduced Let us assume that the animals reproduce to give the next generation then die olT before the next generation reproduces Let the number of animals at any given generation be N which is really an integer but we will allow to be any value Ifthere are no restrictions due to reduced resources the number of animals in the next generation is assumed to be proportional to N 7 there is a xed number of children per adult We can write this as N 7 aN whenN is small Equation 1 This just says that the number of births is proportional to the total population Now lets say that reproductive success declines from its maximum at with population increase due to reduced resources The higherN is the fewer offspring reproduced Let C be the maximum capacity of the environment We might see a reproductive success curve that looks something like this I children per adult C Current populationN The important feature of the reproductive success curve is that the reproductive success goes to zero as N increases to the capacity C Ifyou know the function bN the average births per adult in an environment witn N adults you can find the size of the next generation by using the map N bN N Equation 2 It turns out the general properties of this map are not sensitive to the details of the function bN So we can assume a simple form for how the number of children per adult depends on the current population The simplest form that we can assume is a straight line so let s assume that as plotted on the next page of children per adultb a C Current population N The equation of this line is b a 1 iNC C011me that this gives ba when N0 and b0 when NC By replacing bN with a 1 iNC in Equation 2 we get the map N 7 a 1 iNCN Equation 3 Finally we de ne the fraction of capacity by x NC When x0 the population is small and when x becomes close to 1 the population is approaching full capacity So replacing N with NC in Equation 3 we get the logistic map x 7 a x 1 7x Equation 4 The population is at a fraction of capacity x at a given time At the next reproductive cycle the population is ba lx times as large This is one of the simplest maps you can write for populations or any system but it is tums out to have a behavior that for some values of a is quite complex A plot of the logistic map function and its close relatives lools something like this where the height of the peak is 614 Next season s x Current season 5 x As you will see in homework problem 2 of set 4 the types of behaviors shown by this map which vary with a don t depend on the exact mathematical form though the details vary such as what values of a give stability The key feature that gives all of the intricate behavior is that there is a peak in the plot of the map function CHARACTERISTIC BEHAVIORS OF MAPS The logistic map has a number of behaviors Which behavior is seen depends on the value of the growth parameter a Note that a must be less than or equal to 4 otherwise ifxl2 one year the next year s x a xlx is greater than 1 exceeding environmental capacity When the growth parameter a lt l the next generation is always smaller than the current generation The ratio of the new x to the old x is a lx and since lx lt l the product of a and lx is less than 1 when a lt 1 For this parameter there are not enough offspring to llly replace the current generation When the ecosystem is such that a lt l the population goes to zero M you tried a25 In this case you saw that the cone went to a xed position x withx 0 This is the case of a stable xed population 7 the system fmds a point where the births balance the deaths exactly This is how you like your oven cruise control and thermostat to function by self adjusting to a xed value What about a35 The population oscillated The cones indicating the size of the population hopped back and forth between two positions One year the population is a bit high so the population declines due to overcrowding but the next year there are more resources available enough for the population to go back to its higher value This is a period 2 oscillation the population repeats itself or is periodic with a period of 2 In this case did you see the butter y effect When a38 you saw much more complex behavior Though the population in one year depends in a well defined way on the previous year s population the exact details of the population in future years becomes essentially unpredictable due to the butter y effect or sensitivity to small changes There are a number of other behaviors seen for different a such as period 4 period 3 intermittency chaotic bands etc that we might mention Lecture 4 Summary so far Nonlinear systems chaos Phase space Poincare maps strange at tractors Period doubling Lorenz model balls in boxes Summary so far Learnt how to solve Newton s laws of mo tion for simple mechanical systems 1 or more particles in 1 or more dimensions Euler or leapfrog algorithms Example molecular model of gas Could go on eg use Newton s law of grav ity to model solar system Motions are deterministic nevertheless mo tion can appear complicated or even ran dom many particles But it cannot be truly random In fact it is chaotic Plotting graphs o Additional displays to show 2D plots are easily created picgdisplay myplotgcurvegdisplaypic a Data is plotted with the command myplotplotposxy a Can specify how big is display and where it appears on computer screen Also labels axes etc a Multiple windowsdisplays allowed Simple observations Initially transients seen remnant of decay ing natural oscillation Small driving force small amplitude mo tion in step with driving force like hamr moniC case Larger F apparently random or Chaotic behavior seen Windows of regular motion found at larger F Cannot be truly random motion deter ministic Something more subtle happen ing Sensitivity to initial conditions Two identical pendula with slightly different initial conditions In regular regime motions converge with time o In chaotic regime diverge o In first case poor knowledge of initial con ditions is irrelevant to predicting long time motion 0 In other case implies no predictability at long times eg weather Phase space Useful to examine motion not as t0 and tw but in phase space 9w 0 Regular non chaotic motion yields simple closed curve a Chaotic motion much structure Many nearly closed orbits sudden departures to new orbits never repeating Poincare plots Instead of plotting entire phase space trajec tory plot 9w only at multiples of time period of driving force a For regular motion single point seen a For chaotic motion non space filling struc ture seen Does not depend on initial con ditions o Predictable aspect of chaotic motion called a strange attractor o All chaotic motions of system approach a motion on the attractor a Not a 1D curve in general fractal object later Lorenz model Another example of model showing chaos Very simplified model of convective fluid flow container containing fluid with bot tom and top surfaces held at different tem peratures Three variables 13 y z corresponding to tem perature density and fluid velocity Three parameters arb temperature dif ference and fluid parameters Full solution involves Navier Stokes and very many variables Weather simulations etc 10 NOTES AND QUOTES PHY307 Sept 3 2002 LECTURE 2 3rd meeting OUTLINE 1 Computers 7 what are they a Analog vs Digital b Babbage amp Lovelace c Universal Computers d Universe as a computer 2 Pieces of Python a Types of objects b Expressions c Block statements d for loops 3 Commands in Python Analog machines more or less a direct representation of the problem models electrical circuits with the same dynamics as a pendulum model planes or dams Most often work with continuous variables for example the angle or shape of an object or duration of time as measured by a clock Program for an analog computer initial conditions con guration example with pendulum Increased precision is very expensive Catena shape formed by a hanging chain or string When inverted makes shape of strong uniform weight arches Used as an example of an analog computer Digital computers discrete states more general and easier to program Can be misleadingly precise From Andrew Hodges s pages The idea of one machine for every kind of task was very foreign to the world of 1945 Even ten years later in 1956 the big chief of the electromagnetic relay calculator at Harvard Howard Aiken could write Ifit should tum out that the basic logics of a machine designed for the numerical solution of differential equations coincide with the logics of a machine intended to make bills for a department store I would regard this as the most amazing coincidence that I have ever encountered Charles Babbage Held the Lucasian Chair 1828 1839 at Cambridge University this is the chair held by Isaac Newton past and Steven Hawking recently Designed and started to build the Difference Engine and thought about the Analytical Engine Le Cambridge to start work on these machines Augusta Ada Byron King Lady of Lovelace Born 1 8 1 5 Mother separated from the poet Lord Byron mad 7 bad and dangerous to know when daughter was 5 weeks old Byron spent Summer of 1816 in Switzerland with friends including Poet Shelley and Mary Shelley author of Frankenstein Mother fostered math and science and forbid poetry Met Babbage in 1832 Wrote up Menabrea s analysis of Babbage in 1842 and added her own thoughts This was important guide for others Gambling drugs died at age of 36 From AAL s writings the Analytical Engine does not occupy common ground with mere calculating machines It holds a position wholly its own and the considerations it suggests are most interesting in their nature In enabling mechanism to combine together general symbols in successions of unlimited variety and extent a uniting link is established between the operations of matter and the abstract mental processes of the most abstract branch of mathematical science Again it the Analytical Engine might act upon other things besides number were objects found whose mutual fundamental relations could be expressed by those of the abstract science of operations and which should be also susceptible of adaptations to the action of the operating notation and mechanism of the engine Supposing for instance that the fundamental relations of pitched sounds in the science of harmony and of musical composition were susceptible of such expression and adaptations the engine might compose elaborate and scienti c pieces of music of any degree of complexity or extent quotWe might even invent laws for series or formulae in an arbitrary manner and set the machine to work on them and thus deduce numerical results which we might not otherwise have thought of obtainingquot From Babbage s Autobiography The circular arrangement of the axes of the DiiTerence Engine round large central wheels led to the most extended prospects The whole of arithmetic now appeared within the grasp of mechanism A vague glimpse even of an Analytical Engine at length opened out and I pursued with enthusiasm the shadowy vision The drawings and the experiments were of the most costly kind Dra smen of the highest order were necessary to economize the labour of my own head whilst skilled workmen were required to execute the experimental machinery to which I was obliged constantly to have recourse In order to carry out my pursuits successfully I had purchased a house with above a quarter of an acre of ground in a very quiet locality My coachhouse was now converted into a forge and a foundry whilst my stables were transformed into a workshop I built other extensive workshops myself and had a re proof building for my drawings and dra smen Having myself worked with a variety of tools and having studied the art of constructing each of them I at length laid it down as a principlethat except in rare cases I would never do anything myself if I could afford to hire another person who could do it for me The complicated relations which then arose amongst the various parts of the machinery would have baf ed the most tenacious memory I overcame that dif culty by improving and extending a language of signs the Mechanical Notation which in 1826 I had explained in a paper printed in the quotPhil Transquot By such means I succeeded in mastering trains of investigation so vast in extent that no length of years ever allotted to one individual could otherwise have enabled me to control By the aid of the Mechanical Notation the Analytical Engine became a reality for it became susceptible of demonstration Some time a er the appearance of his memoir on the subject in the quotBibliotheque Universelle de Genevequot the late Countess of Lovelace informed me that she had translated the memoir of Menabrea I asked why she had not herself written an original paper on a subject with which she was so intimately acquainted To this Lady Lovelace replied that the thought had not occurred to her I then suggested that she should add some notes to Menabrea s memoir an idea which was immediately adopted We discussed together the various illustrations that might be introduced I suggested several but the selection was entirely her own So also was the algebraic working out of the different problens except indeed that relating to the numbers of Bernoulli which I had offered to do to save Lady Lovelace the trouble This she sent back to me for an amendment having detected a grave mistake which I had made in the process The notes of the Countess of Lovelace extend to about three times the length of the original memoir Their author has entered llly into almost all the very difficult and abstract questions connected with the subject These two memoirs taken together lmish to those who are capable of understanding the reasoning a complete demonstrationThat the whole of the developments and operations of analysis are now capable of being executed by machinery Turing Church thesis around 1936 1 Any effective computation finite set of rules pencil and paper using symbols can be carried out by a Turing machine Church recursive lnctions can carry out effective computations The Church Turing thesis is unproven what is working without ingenuitv but widely believed Turing machines are equivalent to the digital machines we think of as computers Extended CT thesis any mechanism can be emulated by a Turing machine RESOURCES Mg Scienti c American volume 280 p 76 wwwtu1ingorguktun39ng wwwalantu1ingnet wwwmringarchiveorg Babbage and Lovelace Bools in SU library look up Charles Babbage or Ada Lovelace wwwf mn milah 39 39 39 39 html Python Leaming to program using gallon will be on reserve starting this a emoon Physics amp Bird See attached notes 7 from LiveWires course on Python see Web 7 link from pythonorg You should read A S J and L 7 you don t need to know all of A S and J yet but look them over NOTES AND QUOTES PHY307 Sept 3 2002 LECTURE 2 311 meeting OUTLINE 1 Computers 7 what are they a Analog vs Digital b Babbage amp Lovelace c Universal Computers d Universe as a computer 2 Pieces of Python a Types of objects b Expressions c Block statements d for loops 3 Commands in Python Analog machines more or less a direct representation of the problem models electrical circuits with the same dynamics as a pendulum model planes or dams Most often work with continuous variables for example the angle or shape of an object or duration of time as measured by a clock Program for an analog computer initial conditions con guration example with pendulum Increased precision is very expensive Catena shape formed by a hanging chain or string When inverted makes shape of strong uniform weight arches Used as an example of an analog computer Digital computers discrete states more general and easier to program Can be misleadingly precise From Andrew Hodges s pages The idea of one machine for every kind of task was very foreign to the world of 1945 Even ten years later in 1956 the big chief of the electromagnetic relay calculator at Harvard Howard Aiken could write If it should turn out that the basic logics of a machine designed for the numerical solution of differential equations coincide with the logics of a machine intended to make bills for a department store I would regard this as the most amazing coincidence that I have ever encountered Charles Babbage Held the Lucasian Chair 18281839 at Cambridge University this is the chair held by Isaac Newton past and Steven Hawking recently Designed and started to build the Difference Engine and thought about the Analytical Engine Left Cambridge to start work on these machines Augusta Ada Bvron King Ladv of Lovelace Born 1 81 5 Mother separated from the poet Lord Byron mad 7 bad and dangerous to know when daughter was 5 weeks old Byron spent Summer of 1816 in Switzerland with friends including Poet Shelley and Mary Shelley author of Frankenstein Mother fostered math and science and forbid poetry Met Babbage in 1832 Wrote up Menabrea s analysis of Babbage in 1842 and added her own thoughts This was important guide for others Gambling drugs died at age of 36 From AAL s writings the Analytical Engine does not occupy common ground with mere calculating machines It holds a position wholly its own and the considerations it suggests are most interesting in their nature In enabling mechanism to combine together general symbols in successions of unlimited variety and extent a uniting link is established between the operations of matter and the abstract mental processes of the most abstract branch of mathematical science Again it the Analytical Engine might act upon other things besides number were objects found whose mutual fundamental relations could be expressed by those of the abstract science of operations and which should be also susceptible of adaptations to the action of the operating notation and mechanism of the engine Supposing for instance that the fundamental relations of pitched sounds in the science of harmony and of musical composition were susceptible of such expression and adaptations the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent quotWe might even invent laws for series or formulae in an arbitrary manner and set the machine to work on them and thus deduce numerical results which we might not otherwise have thought of obtainingquot From Babbage s Autobiography The circular arrangement of the axes of the Difference Engine round large central wheels led to the most extended prospects The whole of arithmetic now appeared within the grasp of mechanism A vague glimpse even of an Analytical Engine at length opened out and I pursued with enthusiasm the shadowy vision The drawings and the experiments were of the most costly kind Draftsmen of the highest order were necessary to economize the labour of my own head whilst skilled workmen were required to execute the experimental machinery to which I was obliged constantly to have recourse In order to carry out my pursuits successfully I had purchased a house with above a quarter of an acre of ground in a very quiet locality My coachhouse was now converted into a forge and a foundry whilst my stables were transformed into a workshop I built other extensive workshops myself and had a fireproof building for my drawings and draftsmen Having myself worked with a variety of tools and having studied the art of constructing each of them I at length laid it down as a principlethat except in rare cases I would never do anything myself if I could afford to hire another person who could do it for me The complicated relations which then arose amongst the various parts of the machinery would have baffled the most tenacious memory I overcame that difficulty by improving and extending a language of signs the Mechanical Notation which in 1826 I had explained in a paper printed in the quotPhil Transquot By such means I succeeded in mastering trains of investigation so vast in extent that no length of years ever allotted to one individual could otherwise have enabled me to control By the aid of the Mechanical Notation the Analytical Engine became a reality for it became susceptible of demonstration Some time after the appearance of his memoir on the subject in the quotBibliotheque Universelle de Genevequot the late Countess of Lovelace informed me that she had translated the memoir of Menabrea I asked why she had not herself written an original paper on a subject with which she was so intimately acquainted To this Lady Lovelace replied that the thought had not occurred to her I then suggested that she should add some notes to Menabrea s memoir an idea which was immediately adopted We discussed together the various illustrations that might be introduced I suggested several but the selection was entirely her own So also was the algebraic working out of the different problems except indeed that relating to the numbers of Bernoulli which I had offered to do to save Lady Lovelace the trouble This she sent back to me for an amendment having detected a grave mistake which I had made in the process The notes of the Countess of Lovelace extend to about three times the length of the original memoir Their author has entered fully into almost all the very difficult and abstract questions connected with the subject These two memoirs taken together furnish to those who are capable of understanding the reasoning a complete demonstrationThat the whole of the developments and operations of analysis are now capable of being executed by machinery Turing Church thesis around 1936 Any effective computation finite set of rules pencil and paper using symbols can be carried out by a Turing machine Church recursive functions can carry out effective computations The Church Turing thesis is unproven what is working without ingenuitv but widely believed Turing machines are equivalent to the digital machines we think of as computers Extended CT thesis any mechanism can be emulated by a Turing machine RESOURCES Turing Scienti c American volume 280 p 76 WWWturingorguldturing WWWalanturingnet WWWturingarchive org Babbage and Lovelace Books in SU library look up Charles Babbage or Ada Lovelace WWW fourmilab ch 39 39 39 html Python Learning to program using P hon Will be on reserve starting this afternoon Physics amp Bird See attached notes 7 from LiveWires course on Python see Web 7 link from pythonorg You should read A S J and L 7 you don t need to know all of A S and J yet but look them over Lec3 Leapfrog many particles 0 dt errors Leapfrog algorithm 0 Many particles balls in boxes Time step errors The Euler method we have used so far has its limitations solution accurate to 0dt only Why error per step 0dt2 Total steps Tdt Total error dtQTdt Tdt See this by computing energy E 12mv2 1213322 Compute error as function of dt Note calculate mean error over some finite period of time see code Can do better Many particles Consider two masses a and b interacting via some mutual force Denote force on a due to b as Fab Likewise force on b due to a as Fba By Newton s third law Fab Fba vector statement Given a specific force law can we solve Newton s 2nd law for both particles numer ically simulate the system Python lists and for Useful to introduce a list to store the objects which are interacting systemballaballb In general lists can comprise numbers or arbi trary abstract objects enclosed in square brack ets eg a123 b456 crange110 The statement cab concatenates the lists More for loops To carry out a sum over all balls use for com mand eg for ball in system ballposballposballve1dt 0 Note indentation all statements at same level are executed before passing to next element of list a Note give each ball a position velocity and 2 accelerations 0 Use leapfrog to update 0 Add elastic force for walls of container reverse velocity if hits wall 10 Integrate module a Change force function to newforce Latter is passed the labels to two individual balls and computes mutual force vector 0 Function totalforce gets total force on a single ball 11 Comments Notice that in absence of repulsion force trajectories of balls are regular and repeat ing But fill all of space when interaction included Note code works just as well for any num ber of balls Just need to initialize all their positions and velocities Straightforward to model other force laws eg inverse square Just change definition Of newforce Can use to model molecules in a gas Study freezing transition 12 Summary 0 Discussed improved interation algorithms 0 Developed code to study multiparticle sys tems here hard spheres 0 Hard sphere replusion leads to Chaotic tra jectories 13

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.