Physics 212E Classical and Modern Physics Spring VPython Class 6: Phasors and Interference

Similar documents
Lecture 39. Chapter 37 Diffraction

Interference. Electric fields from two different sources at a single location add together. The same is true for magnetic fields at a single location.

Basics of Computational Geometry

Spectroscopic Analysis: Peak Detector

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

Physics I : Oscillations and Waves Prof. S Bharadwaj Department of Physics & Meteorology Indian Institute of Technology, Kharagpur

Computer Exercise #3 (due March 7, but most useful if completed before class, Friday March 3) Adding Waves

SECTION 4.5: GRAPHS OF SINE AND COSINE FUNCTIONS

Section Graphs of the Sine and Cosine Functions

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

PHY132 Introduction to Physics II Class 5 Outline:

Interference of Light

Interference of Light

Introduction to VPython for E&M This tutorial will guide you through the basics of programming in VPython

McCall Page 1 of 17. Lasers & Diffraction Grating Project MAT 201, Spring For this project you will need the following:

SPRITES Moving Two At the Same Using Game State

Lecture 24 (Diffraction I Single-Slit Diffraction) Physics Spring 2018 Douglas Fields

LIGHT: Two-slit Interference

Lecture 6: Waves Review and Examples PLEASE REVIEW ON YOUR OWN. Lecture 6, p. 1

Introduction to 3D computer modeling

To see how a sharp edge or an aperture affect light. To analyze single-slit diffraction and calculate the intensity of the light

1 Getting started with Processing

Lecture 6: Waves Review and Examples PLEASE REVIEW ON YOUR OWN. Lecture 6, p. 1

Here are some of the more basic curves that we ll need to know how to do as well as limits on the parameter if they are required.

0 Graphical Analysis Use of Excel

Introduction to VPython This tutorial will guide you through the basics of programming in VPython.

5 10:00 AM 12:00 PM 1420 BPS

Section 4.1: Introduction to Trigonometry

Experiment 5: Polarization and Interference

PHYS 1402 DIFFRACTION AND INTERFERENCE OF LIGHT: MEASURE THE WAVELENGTH OF LIGHT

Matthew Schwartz Lecture 19: Diffraction and resolution

Interference of Light

Intro. Scheme Basics. scm> 5 5. scm>

Single Slit Diffraction

Class #10 Wednesday, November 8, 2017

Diffraction Challenge Problem Solutions

7 Interference and Diffraction

2. Periodic functions have a repeating pattern called a cycle. Some examples from real-life that have repeating patterns might include:

MTH 122 Calculus II Essex County College Division of Mathematics and Physics 1 Lecture Notes #11 Sakai Web Project Material

Graded Assignment 2 Maple plots

Discussion 4. Data Abstraction and Sequences

Experiment 8 Wave Optics

Polar Coordinates. 2, π and ( )

Use Parametric notation. Interpret the effect that T has on the graph as motion.

Goals: Course Unit: Describing Moving Objects Different Ways of Representing Functions Vector-valued Functions, or Parametric Curves

Graphing by. Points. The. Plotting Points. Line by the Plotting Points Method. So let s try this (-2, -4) (0, 2) (2, 8) many points do I.

The location of the bright fringes can be found using the following equation.

Problem Solving 10: Double-Slit Interference

Hi. I m a three. I m always a three. I never ever change. That s why I m a constant.

CAUTION: NEVER LOOK DIRECTLY INTO THE LASER BEAM.

Calculus III. 1 Getting started - the basics

Math 144 Activity #4 Connecting the unit circle to the graphs of the trig functions

Trig for right triangles is pretty straightforward. The three, basic trig functions are just relationships between angles and sides of the triangle.

Here is the data collected.

APPM 2460 PLOTTING IN MATLAB

Lab 2B Parametrizing Surfaces Math 2374 University of Minnesota Questions to:

Waves & Oscillations

DEVIL PHYSICS THE BADDEST CLASS ON CAMPUS IB PHYSICS

ACT Math test Trigonometry Review

Chapter 12 Notes: Optics

Ph3 Mathematica Homework: Week 1

Electricity & Optics

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

a point B, 4 m along x axis. Is re constructive or Consider interference at B if wavelength sound is destructive The path dierence between two sources

14 Chapter. Interference and Diffraction

Single-slit diffraction plots by Sohrab Ismail-Beigi, February 5, 2009

Introduction to VPython and 3D Computer Modeling

Animations involving numbers

Pong in Unity a basic Intro

Physics 1C, Summer 2011 (Session 1) Practice Midterm 2 (50+4 points) Solutions

1 Introduction to Matlab

Functions and Graphs. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Chapter 36. Diffraction. Dr. Armen Kocharian

Physics 123 Optics Review

Math 7 Elementary Linear Algebra PLOTS and ROTATIONS

LC-1: Interference and Diffraction

PHYSICS. Chapter 33 Lecture FOR SCIENTISTS AND ENGINEERS A STRATEGIC APPROACH 4/E RANDALL D. KNIGHT

Diffraction: Propagation of wave based on Huygens s principle.

Physical Optics FOREWORD

Introduction to VPython This tutorial will guide you through the basics of programming in VPython.

Algebra 2 Semester 1 (#2221)

Physics 214 Midterm Fall 2003 Form A

Parametric Curves, Polar Plots and 2D Graphics

G3 TWO-SOURCE INTERFERENCE OF WAVES

Assignment 10 Solutions Due May 1, start of class. Physics 122, sections and 8101 Laura Lising

Graphing Trig Functions - Sine & Cosine

Chapter 38 Wave Optics (II)

In this chapter, we will investigate what have become the standard applications of the integral:

Algebra II. Slide 1 / 162. Slide 2 / 162. Slide 3 / 162. Trigonometric Functions. Trig Functions

2 A little on Spreadsheets

Waves & Oscillations

In this class, we addressed problem 14 from Chapter 2. So first step, we expressed the problem in STANDARD FORM:

Chapter 8: Physical Optics

2D and 3D Transformations AUI Course Denbigh Starkey

The Mathcad Workspace 7

Math (Spring 2009): Lecture 5 Planes. Parametric equations of curves and lines

Diffraction. * = various kinds of interference effects. For example why beams of light spread out. Colors on CDs. Diffraction gratings.

CALCULUS II. Parametric Equations and Polar Coordinates. Paul Dawkins

Models of Light The wave model: The ray model: The photon model:

Recognizing a Function

Transcription:

Physics 212E Classical and Modern Physics Spring 2017 VPython Class 6: Phasors and Interference 1 Introduction We re going to set up a VPython program that will take three inputs: the number of slits, the slit spacing, and the wavelength of light, and produce an animation showing the interference pattern and phase diagram. This will lead to a pretty cool result, but it s a bit ambitious for a single class period. At the top of the program, just after the from vpython import * and from math import * lines, let s define our three parameters. And let s go one step further and tell ourselves that s what we re doing by putting a comment in the code. For example, # control parameters n = 3 d = 2.5e-6 # microns wavelength = 550e-9 # nanometers Anything written on a line after a # symbol is ignored by Python, which is used to add clarifying comments. Here we ve defined the number of slits N = 3, the slit spacing d = 2.5 10 6, and the wavelength λ = 550 10 9. We don t use the name lambda as a variable because this variable is already pre-defined for other purposes in Python. So, wavelength it is. 2 The Phasor Diagram, part I Once we specify the number of slits, we d like to make a phasor diagram with that many phasors, lined up head to tail. First, let s draw the x and y axes, which we can do with the curve object: xaxis = curve( pos=[(-1,0,0), (1,0,0)] ) yaxis = curve( pos=[(0,-1,0), (0,1,0)] ) Here we gave the curve object a list of positions, enclosed in square brackets. We have given curve objects a list of positions before, but we did it with the.append method. We d like to write code that will work no matter what value we put in for N. We can do this by creating a list of phasors. Lists are defined in Python by square brackets, so we begin by making an empty list called phasors: phasors=[] 1

We want to draw the vectors head to tail, so we need a vector variable to hold the location of the last vector s head, which will be the location of the next vector s tail. Let s call it tail and initially it should be the origin: tail = vector(0,0,0) Now we use a while loop to add a phasor to the list N times: i=0 while i < n: phasors.append(arrow(pos=tail, axis=vector(1/n,0,0), color=color.green)) tail = tail + vector(1/n,0,0) i = i + 1 Let s take a second to digest this. The variable i just counts how many times we ve gone through the loop. The append method grows our list of phasor objects by one each time. The phasors are green arrows pointing to the right, and the tail position of each new phasor is shifted to the right when we update the tail vector. Make sense? Run this and see if you get three arrows aligned like a central max phasor diagram. Now, try changing the number of slits to four. Does your program deal with it properly? 3 The Screen In our display window we re also going to set up the geometry of the real system, such as the slits and the screen, and also show the intensity. Here s some initial setup stuff: L = 1.5 # distance to screen ymax = 1 # height of screen scene2.center = vector(2,0,0) slits = box(pos=vector(2,0,0), size=vector(0.1,0.3,0.1), color=color.blue) screen = box(pos=vector(2+l,0,0), size=vector(0.1,2*ymax,0.01), color=color.red) The 2 just shifts the display to the right of our phasor diagram. We now want to add two curves to this display: (1) a horizontal line showing the direction of the central max and (2) a curve that will start out empty but will build up the intensity pattern on the screen: central_max = curve(pos=[(2,0,0),(2+l,0,0)]) intensity = curve() edge = L + 0.5*screen.size.x The last variable, edge holds the x coordinate for the right hand end of the red screen. You ll see why this is useful soon. 2

4 The Sweep Now we re going to sweep across the screen, from bottom to top, and see what the phasor diagram is doing and what the intensity is doing. First things first: let s set up the while loop that will control the sweep: y = -ymax # y is the coordinate on the screen while y < ymax: rate(5) # step 1: do the physics # step 2: update the phasor display # step 3: update the screen display y = y + 0.01 All the rest that you ll put into this program goes inside the while loop, between the rate(5) and the y=y+0.01 lines. 5 The Physics Okay, given y, L, d, and λ, calculate θ, r adj and φ adj. This should just take three lines of code. I called these quantities theta, delta_r, and delta_phi. Some useful things to know: math has trig functions like sin() and asin() (for arcsine), etc. These are in radians mode. math also has a built in variable pi = π 3.1416. 6 Update the Phasor Display Now is the trickiest part of the program. For a given y, we have a θ value that translates to a φ adj value. We want to the program to draw the appropriate phasor diagram with that φ adj. As we loop through the list of phasors, we ll need a vector variable keeping track of the location of the tail of the next vector, so let s define tail to be a vector, originally at the origin. We also aren t going to be making each phasor point in the (1/n, 0, 0) direction; rather they ll all be rotated relative to each other. So we need a direction vector, which should initially be (1/n, 0, 0) (this makes the first phasor point in the +x direction). After you ve defined your tail and direction vectors, we want to loop through all the phasor objects in the list phasors, which we can do with the syntax 3

for phasor in phasors: # stuff to do with each phasor This steps through each phasor object in phasors, momentarily calling each one phasor. We want to update the pos and axis attributes of the current object via phasor.pos = tail phasor.axis = direction This will do the right thing as long as we re sure tail points to where we want the current phasor s tail to be, and direction is pointing in the direction we want the current phasor to point. So we should update those vector variables to be ready for the next phasor object in the loop: tail = tail + direction direction = rotate(direction, angle=delta_phi) Do you see what this does? The head of the phasor that we just drew is located at tail+direction, so we assign that to be the new tail value for the next phasor. And each phasor is supposed to be rotated by φ adj relative to the previous, so here we rotate the direction vector. And that s it for updating the phasor diagram. Question: after this loop through the phasors, where do you think the tail vector is pointing? Remember that we update it after drawing each phasor. The answer to this question will come in handy below. Try running the program at this point and sort out any errors. While the screen display won t be doing anything, the phasor diagram should behave sensibly, sweeping through a range of φ adj values. 7 Update the Screen Display We re still inside the while loop, and we ve updated the phasor diagram for our new value of y. Now we ll update our screen display. And here comes the really cool part. We are going to plot the intensity of the interference pattern on the right hand side of the screen by building up the intensity curve object. What you need to know about intensity is that it is directly proportional to the square of the amplitude. If the amplitude doubles, the intensity quadruples, for example. The phasor diagram tells us the vector sum of all the phasors, and it s held in the variable tail, which we were updating always to be at the head of the last phasor we drew. Since intensity is the square of the amplitude, our signal intensity is just mag2(tail). We want this curve to poke out in the +x direction from the right edge of the screen, so we will add the intensity to the vector edge: 4

intensity.append( pos=( edge+mag2(tail), y, 0) ) That should do it. Try running this and see if you ve got all the pieces assembled. 8 Play Time The nice thing about this program is that you can now vary the slit spacing or the number of slits and everything will adjust accordingly. Which way should you change d to get more maxima on the screen? Try it. Change the number of slits to four. Do the minima happen where you would expect them to, based on the phasor diagram? Change the number of slits to 20. Do you begin to see why diffraction gratings give bright dots? Hand in a working version of the program with whatever number of slits and slit separation you would like. 5