Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
1 Computational Oscillations and Waves Seamus Lagan, Dept. of Physics and Astronomy, Whittier College, Whittier, CA 90608 [email protected] This sophomore-level course is not a programming course nor is it a course in numerical methods but elements of both are present. It is a physics course covering oscillatory motion and waves. However the mathematics used in these topics is carried out almost exclusively on the computer using symbolic (Maple) and numerical (IDL) software. Students use the software to: evaluate integrals, solve differential equations, solve simultaneous equations, plot functions and/or data, create series expansions of functions, find roots of equations and work with complex numbers. It is hoped that the students will be motivated and prepared to use these tools in later courses. Therefore it is a pre-requisite for almost all other upper-division physics courses. 2 The text for this course is “Computation and Problem Solving in Undergraduate Physics” by David M. Cook. (available from David Cook at Lawrence University, [email protected]) The traditional topics for such a course are covered, beginning with the block-spring system and adding standard damping and forcing. However, finding the solutions to the equations is carried out using the computational tools. The goal is to get the students familiar with the software and its usefulness as a tool to understanding the physics, not as an end in itself. Emphasis is placed on getting the students to use the on-line help available in both software packages so that they can become somewhat self-sufficient. Week 1: they do not solve the SHO problem but simply investigate the solution that is found from inspection. They learn how to create simple plots in both programs. This involves learning how to manipulate arrays in IDL. They also learn how to import data into IDL (motion detector data for a block/spring). They investigate the phase relationships between position, velocity and acceleration by using Maple to differentiate the position function and studying the plots. They can do the same with real data and numerical differentiation in IDL. 3 Weeks 2-3: the emphasis is on actually solving ODEs. This is straightforward enough in Maple using the dsolve command. The initial value problem introduces them to solving simultaneous equations in Maple. However the students must also learn how to solve a simple ODE numerically. They are introduced to the simple Euler method and use it to solve the SHO equation. This is a good vehicle for illustrating the limitations of the method and the care that must be taken to achieve sufficient accuracy when solving equations numerically. At this point they are learning programming basics such as defining variable types, creating functions and procedures, and using loops. They write their own procedure for implementing the Euler method and use it to reproduce the solution to the SHO problem that they have already obtained in Maple. Weeks 3 - 7: Students are introduced to built-in procedures for solving ODEs in IDL. They use these to study other oscillatory systems without closed-form solutions. Examining these solutions requires learning to manipulate arrays in IDL, e.g. accessing part of an array to eliminate initial transients, finding max and min values, calculating the average value of a variable over one period. 4 Week 5: Maple is very useful when dealing with molecular vibrations. Using various expressions for the interatomic potential, students can examine the form of the potential well, find the equilibrium position, use series expansions to help find small amplitude solutions. They can differentiate the potential energy function to get the force expression and then use IDL to solve the equation of motion numerically. Weeks 8 – 11: Maple is used extensively to deal with waves, in particular to gain insight into the difference between the functions representing traveling waves and standing waves, as well as combinations of the two. Using Maple’s animation capabilities, students can visually represent the time-dependent solutions. They can also create animations corresponding to reflection and transmission at boundaries between strings. (These animation capabilities are used again in our Quantum Mechanics course to examine the timedependence of wave functions for one-dimensional systems e.g. particle-in-a-box and the quantum oscillator.) 5 Week 1 Topic Block/spring system. Analytic solution of the equation of motion by inspection. The initial value problem. Intro to the software. Plotting data. Solving simultaneous equations using Maple. Using arrays in IDL. 2 Solving the diff. equ. symbolically and numerically. Euler method, accuracy, programming basics in IDL. 3 Other systems that oscillate harmonically (simple & physical pendulum, LC circuit, floating cylinder). 4 Non-linear systems (exact pendulum, floating cone). Numerical solutions using IDL. 5 Molecular vibrations. Potential wells. Series expansions of functions in Maple. 6 Standard damping. Light, critical and heavy damping. Solving the ODE. Complex representation in Maple. 7 Driven oscillations. Solving the ODE. Creating resonance and phase plots. 8 Waves and their mathematical representation. Animated plots in Maple. 9 Travelling and standing waves. Waves on a string. Sound waves. 10 The wave equation. Solving the PDE in Maple. 11 Reflection and transmission of waves. Characteristic impedance. 12,13 Special topics/Projects Table 1: Semester Schedule 6 USE IN OTHER COURSES PHYS330 Electromagnetic Theory: Students use Maple extensively to evaluate integrals and the LinearAlgebra and VectorCalculus packages are employed to take gradient, divergence and curl of vector fields and also to plot vector fields. PHYS350 Quantum Mechanics: Maple is used heavily for integral evaluations (expectation values and inner products). Students also use it to approximate the time dependence of wave functions and then create animations e.g. wave packets for a particle-in-a-box or quantum oscillator. Boundary value problems for the finite square well and variations thereon have been solved. PHYS360 Astrophysics: Some IDL assignments have been incorporated, e.g. creating an H-R diagram using data from the Yale Bright Star Catalog, and producing a simulated image of the Sun that reproduces the limb darkening effect. PHYS310 Mechanics: Students have been asked to use IDL to calculate the motion of three bodies interacting gravitationally. IDL is used heavily by students doing astronomy research. 7 General Comments We removed oscillations and waves from both our introductory (Freshman) courses and upper-division Mechanics (PHYS310) since the material is covered in some detail in this course. This has given us extra flexibility in the content of these other courses. Some interesting physics associated with oscillations and waves is not covered. For instance, plasma oscillations, acoustic vibrations, light scattering, evanescent waves etc. We used to have an elective course on oscillations and waves that covered these topics. We no longer offer this course. Some students find it quite difficult to learn physics and computation in the same course. Indeed, I continue to struggle with the problem of how to divide classroom time between description of the physics and instruction on use of the computational tools. It is a delicate balance. There is also a problem of using two different computing environments at the same time. Students tend to get the two confused as regards syntax. The learning curve for IDL is steeper than for Maple. This course counts towards our Scientific Computing Minor. 8 We still need to do more to incorporate these computational tools into the upper-division courses. The difficulty is that not all our faculty members are familiar with all of the tools. I will be making more efforts to inform my colleagues what the students can do with Maple and IDL after having taken this course and how I have incorporated their use into my own upper-division courses. STUDENT COMMENTS When asked how they feel about using computational tools some comments were: “Computational tools take some effort to familiarize with but once you do they are addicting.” “I think it is a must and IDL/Maple could be used more commonly in more courses.” “Computational tools demonstrate different physical phenomena very effectively and it’s very easy to see what is happening (for example, waves and potential wells).” 9 Interactive Data Language (IDL) This is an interactive software package that can be run under Unix, Windows and Mac operating systems. It is very powerful for manipulating arrays and for data visualization. It is available through ITT Visual Information Solutions (www.ittvis.com/idl/) Below is shown the Graphical User Interface for IDL. At the top is the text editing window. Below that is a variable window showing defined variable types and values. Below that is the log window recording the commands that were input from the command line at the very bottom. Fig. 2 : GUI interface for IDL in Windows. 10 IDL Homework Solution: Driven oscillator with a third power damping force (Fdamp = b*v3). First write the function file that defines the two differential equations. Note the third power dependence of the damping term. function driven2,t,n common param,k,m,b,F,w return,[n[1],(-k/m)*n[0]-(b/m)*n[1]^3+(F/m)*cos(w*t)] end Now set up the common area of memory and input the values of the parameters. IDL> .COMPILE "E:\computational\driven2.pro" Compiled module: DRIVEN2. IDL> common param,k,m,b,F,w IDL> m=5.0 IDL> b=20.0 IDL> k=100.0 IDL> F=2.0 IDL> w=3.0 11 Solve the differential equation, first using the default tolerance. IDL>ludiffeq_23,'driven2',t,n,t0=0,tf=200,init=[2.0,0.0], tol=.001,maxsteps=10000000000 IDL> plot,t,n[0,*],xrange=[150,200],title="w="+string(w) Fig.3 : Driven oscillator with third-power damping. Solve with a smaller tolerance just to be sure you can trust the solution. (There was no significant difference.) Repeat this process for ten different driving frequencies, noting the amplitude of the oscillation in each plot. To graph the response curve, create an array of frequencies and an array of corresponding amplitudes. IDL> A=[.025,.03,.035,.11,.07,.014,.0075,.05,.09,.025] IDL> freq=[2.0,2.5,3.0,4.47,5.0,7.0,8.5,3.5,4.0,6.0] 12 Now plot these values and also put the standard damping response curve on the graph. IDL> w=findgen(801)/100+2 IDL> Astandard=(F/m)/((w^2-k/m)^2+(b*w/m)^2)^0.5 IDL> plot,freq,A,psym=2,title="response curve for third power damping !C dashed line is standard damping response",ymargin=[8,8],xtitle="driving frequency w",ytitle="amplitude" IDL> oplot,w,Astandard,linestyle=2 Fig.4 : Response curve for oscillator with third-power damping. There is a much greater resonance effect for the third-power damping. The resonance frequency for standard damping (sqrt(o2-b2/2m2) = 3.46) is quite a bit different from o (= 4.47) whereas it is very close to o for the third-power damping. 13 MAPLE A typical Maple notebook to solve an initial value problem. > restart; Input x(t) > x(t):=C*cos(1.5*t+phi); x( t ) := C cos( 1.5 t ) get v(t) by differentiating x(t) > v(t):=diff(x(t),t); v( t ) := 1.5 C sin( 1.5 t ) Define eq1 as x(t=0)=3.1 using the eval command. > eq1:=eval(x(t),t=0)=3.1; eq1 := C cos( )3.1 Similarly define eq2 as v(t=0)=-0.5 > eq2:=eval(v(t),t=0)=-0.5; eq2 := 1.5 C sin( )-0.5 Now solve the two equations simultaneously for C and phi. > sol:=solve({eq1,eq2},{C,phi}); sol := { C-3.117869643 , -3.034477330 }, { C3.117869643 , 0.1071153234 } There are two solutions and sol is given as a sequence of the two solutions. Each solution is itself a set. I always want the amplitude C to be positive so I want to pick the second solution. > sol[2]; { C3.117869643 , 0.1071153234 } 14 Maple Notebook: Reflection/transmission on a string. > restart; with(plots): Consider two strings connected and a sinusoidal wave coming in and getting reflected off the join. The tension is the same in each string but the mass per unit lengths are different. Therefore the speeds of propagation of the wave on the two strings (c1 and c2) are different. For convenience I will take c1 = 2*pi and then we will look at what happens when we vary c2. >c1:=2*Pi;c2:=(ratio)*c1; Define a traveling wave expression and then convert it to a function so we can generate the incident, transmitted and reflected waves by changing the arguments of the function. >f(z,t):=cos(z-c1*t); f:=unapply(f(z,t),[z,t]); (Z = characteristic impedance, T = tension, c = speed of propagation, R = reflection coefficient) Z=T/c and for two strings connected the tension is the same in both. Therefore R=(Z1-Z2)/(Z1+Z2)=(T/c1 T/c2)/(T/c1 + T/c2)=(1/c1 - 1/c2)/(1/c1 +1/c2) . If we multiply above and below by c1*c2 then we get R = (c2-c1)/(c2+c1) for the reflection coefficient. 15 >R:=(c2-c1)/(c2+c1);T:=1+R; Now create the incoming, transmitted and reflected waves. >yi(z,t):=f(z,t); yr(z,t):=R*f(0,t+z/c1); yt(z,t):=T*f(0,t-z/c2); >ratio:=4; We get the full motion of the string by superimposing all three waves on the string using the “piecewise” command. >animate(piecewise(z<0,yi(z,t)+yr(z,t),z>0,yt(z,t)), z=10..10,t=0..3,numpoints=200,frames=20,thickness=3, view=[-10..10,-5..5]); 16 The actual output in Maple is an animated plot. Below I show some frames from two animations, one with the second string being very light (high velocity of propagation) so that the junction of the two strings is like a free end. The second example is one in which the left side of the junction does not have a pure standing wave on it. Students can use this animation to investigate the concept of standing wave ratio. Fig. 1 : Frames from Maple animations of waves on a string. 17 A MID-TERM EXAM Maple is used for parts (a) - (d) and it involves simple algebraic manipulation and solving single algebraic equations. Parts (f) and (g) require the use of IDL to numerically solve the equation of motion. Students do not have to write their own procedure to solve the ODE but can use a “canned” procedure (from Lawrence University) that they have used before in class. A cone of density 1 is placed in a fluid of density 2 and floats at rest as shown. (a) Show (use Maple) that L = (1/2)1/3 H The volume of a cone is given by (1/3) R2 H = (1/3) H3 Tan2() Use the following values for the rest of the problem: 1 = 700 kg/m3 2 = 1000 kg/m3 = /6 rad H = 0.3 m If the cone is pushed down into the fluid and released then it will oscillate. (b) What is the net upward force on the cone when the cone is displaced a distance x downward into the fluid? Answer: Fnet is approx 728x +2734x2 + 3421x3 For small values of x the cone will perform Simple Harmonic Motion because the force is “spring-like”. 18 (c) How large can x be so that the force does not deviate from a “spring-like” force by more than 5% Answer: about 1.3 cm. (d) For small amplitude oscillations what is the value of the period? (Hint: the mass of the cone can be found from the values of the quantities given above.) Answer: 0.598 s (e) Write down the equation of motion for the cone using the force expression in part (b). Rewrite as two first order equations. (f) Using IDL, create the appropriate function file for this set of equations and then use ludiffeq_23 to solve the equations. Get x(t) for t = 0 to 6.0 s and use initial conditions x(0) = 0.08 m and v(0) = 0.0 m/s. Plot the position versus time in a graph with a title and axis labels. (Make sure that the tolerance is set small enough that you are getting accurate results. Show how you do this!) (g) Overplot the approximate Simple Harmonic solution corresponding to x(0)=0.08 and v(0)=0.0. Explain physically why the cone’s motion is asymmetric about the equilibrium position. Fig. 5: Position plot for a cone oscillating in water. 19 A STUDENT PROJECT Thermal expansion of solids due to the non-linearity of the interatomic force. When a solid is heated up it expands. See p452 of Giancoli for a short explanation of how this is related to the oscillations of atoms in a potential well. Consider NaCl (common table salt). If we model the potential energy U(r) between the two atoms by (Blatt “Modern Physics” p207, A = 10-13 eV. nm20) then we can determine how much the solid expands as we increase the energy of the oscillation. The energy of oscillation (above the bottom of the potential well) is related to the temperature by equipartition of energy, E ≈ k T where k is Boltzmann’s constant and T is the temperature in Kelvin. Find the average interatomic spacing for an isolated Na-Cl oscillating pair at different temperatures and use this spacing to evaluate the volume of a unit cell in crystalline NaCl. 20 Fig. 6 : Maple plot of exact and approx. potential wells for NaCl. Fig. 7: Temperature dependence of NaCl volume found by the students. It corresponds to a coefficient of thermal expansion of about 3 x 10-5 K-1