Physics 212E Spring 2004 Classical and Modern Physics. Computer Exercise #2

Similar documents
Math Lab 8: Electric Fields Integrating Continuous Charge Distributions II Due noon Thu. Feb. 1 in class

LAB 2 - ONE DIMENSIONAL MOTION

Math Lab 10: Differential Equations and Direction Fields Complete before class Wed. Feb. 28; Due noon Thu. Mar. 1 in class

Differentiation 1. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Ch. 3 Equations and Inequalities

Assignment 1 Physics/ECE 176

Experiment 1: The Same or Not The Same?

Physics E-1ax, Fall 2014 Experiment 3. Experiment 3: Force. 2. Find your center of mass by balancing yourself on two force plates.

Mathematica Project 3

Week 2. Topic 4 Domain and Range

Working with Digital Elevation Models in ArcGIS 8.3

LAB 2: INTRODUCTION TO MOTION

Math 5a Reading Assignments for Sections

Quadratic Equations Part I

Section 4.6 Negative Exponents

Student Instruction Sheet: Unit 3, Lesson 3. Solving Quadratic Relations

Physics Motion Math. (Read objectives on screen.)

Assignment #0 Using Stellarium

Exploring Graphs of Polynomial Functions

Conservation of Momentum

LAB 3 - VELOCITY AND ACCELERATION

LAB 3: VELOCITY AND ACCELERATION

1 Newton s 2nd and 3rd Laws

AP Physics 1 Summer Assignment Packet

Lab 4: Gauss Gun Conservation of Energy

Project IV Fourier Series

Introduction to Special Relativity

Lab 2 Worksheet. Problems. Problem 1: Geometry and Linear Equations

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this.

Lecture 10: Powers of Matrices, Difference Equations

Lesson Plan by: Stephanie Miller

Linear Motion with Constant Acceleration

Using Microsoft Excel

Introduction to Computer Tools and Uncertainties

Burning Daylight Desmos Application Activity

Introduction. Pre-Lab Questions: Physics 1CL PERIODIC MOTION - PART II Fall 2009

Looking hard at algebraic identities.

Vectors and Vector Arithmetic

Introduction. Pre-Lab Questions: Physics 1CL PERIODIC MOTION - PART II Spring 2009

PHY 111L Activity 2 Introduction to Kinematics

Algebra. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

pka AND MOLAR MASS OF A WEAK ACID

Algebra & Trig Review

2: SIMPLE HARMONIC MOTION

2: SIMPLE HARMONIC MOTION

Moving into the information age: From records to Google Earth

Introduction to Algebra: The First Week

Math 111, Introduction to the Calculus, Fall 2011 Midterm I Practice Exam 1 Solutions

Partner s Name: EXPERIMENT MOTION PLOTS & FREE FALL ACCELERATION

Lab #2: Newton s Second Law

Chapter 9: Roots and Irrational Numbers

Section 1.x: The Variety of Asymptotic Experiences

Infinity Unit 2: Chaos! Dynamical Systems

An introduction to plotting data

spring mass equilibrium position +v max

Resonance and response

Harmonic Motion. Mass on a Spring. Physics 231: General Physics I Lab 6 Mar. 11, Goals:

Updated 2013 (Mathematica Version) M1.1. Lab M1: The Simple Pendulum

Chapter 1 Review of Equations and Inequalities

Lesson 6-1: Relations and Functions

EXPERIMENT 7: ANGULAR KINEMATICS AND TORQUE (V_3)

Vectors Part 1: Two Dimensions

Unit 7: Oscillations

Matrices A matrix is a rectangular array of numbers. For example, the following rectangular arrays of numbers are matrices: 2 1 2

x = B sin ( t ) HARMONIC MOTIONS SINE WAVES AND SIMPLE HARMONIC MOTION Here s a nice simple fraction: y = sin (x) Differentiate = cos (x)

Section 20: Arrow Diagrams on the Integers

Modeling the Motion of a Projectile in Air

Physics 201 Lab 2 Air Drag Simulation

A DEEPER LOOK AT USING FUNCTIONS IN MATHEMATICA

AMS 132: Discussion Section 2

MATERIAL MECHANICS, SE2126 COMPUTER LAB 3 VISCOELASTICITY. k a. N t

Boyle s Law and Charles Law Activity

base 2 4 The EXPONENT tells you how many times to write the base as a factor. Evaluate the following expressions in standard notation.

LAB Exercise #4 - Answers The Traction Vector and Stress Tensor. Introduction. Format of lab. Preparation reading

Learning Goals The particle model for a complex object: use the center of mass! located at the center of mass

Lecture 10 - Moment of Inertia

Physics 6A Lab Experiment 6

Applications of Exponential Functions Group Activity 7 STEM Project Week #10

Project 3: Pendulum. Physics 2300 Spring 2018 Lab partner

Physics 2310 Lab #3 Driven Harmonic Oscillator

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

Experiment 0 ~ Introduction to Statistics and Excel Tutorial. Introduction to Statistics, Error and Measurement

The Spring-Mass Oscillator

Motion II. Goals and Introduction

Continuum Limit and Fourier Series

EXPERIMENT 2 Reaction Time Objectives Theory

Big-oh stuff. You should know this definition by heart and be able to give it,

Unit 6: Quadratics. Contents

LABORATORY 1: KINEMATICS written by Melissa J. Wafer '95 June 1993

Vectors 1. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Math 253 Homework due Wednesday, March 9 SOLUTIONS

P1 Chapter 3 :: Equations and Inequalities

AP Calculus AB Summer Assignment

Physics 201 Lab 2: Statistics and Data Analysis Dr. Timothy C. Black Summer I, 2018

Quiz 07a. Integers Modulo 12

Solving Quadratic & Higher Degree Equations

PH 120 Project # 2: Pendulum and chaos

Newton s Cooling Model in Matlab and the Cooling Project!

PHY 123 Lab 1 - Error and Uncertainty and the Simple Pendulum

PHYSICS 100 LAB 2: CHANGING MOTION

Transcription:

Physics 212E Spring 2004 Classical and Modern Physics Chowdary Computer Exercise #2 Launch Mathematica by clicking on the Start menu (lower left hand corner of the screen); from there go up to Science and Math Applications; go to the Mathematica 4.1 folder; then click on Mathematica 4.1. Mathematica will open up what is called a notebook. You type in the notebook, Mathematica evaluates your commands, and then outputs back into the notebook. Type the following into Mathematica: Plot@x^2, 8x,0,3<D (note those are curly brackets, not parenthesis) Then hit either: Enter on the numeric keypad or Shift+Enter (Shift and Enter simultaneously) on the regular keyboard. (If you just hit enter on the regular keyboard, you simple insert a carriage return without letting Mathematica know that you want it to carry out the command you have just given it.) This will evaluate the expression in the cell you just typed in. You should see the following appear on your screen: In[1]:= Plot@x^2, 8x,0,3<D 8 6 4 2 Out[1]= Graphics 0.5 1 1.5 2 2.5 3 (Your screen should also have blue brackets on the right, which don t show up in the image above. If you re unsure what I m talking about, check with your neighbor, then ask me as needed.) This graph shouldn t surprise you too much. Now, try Plot@A x^2, 8x,0,3<D and hit Enter (keypad) or Shift+Enter. You should see the following appear on your screen:

In[2]:= Plot@A x^2, 8x, 0, 3<D Plot::plnr : Ax 2 is not a machine size real number at x = 1.25`*^-7. Plot::plnr : Ax 2 is not a machine size real number at x = 0.12170097471874736`. Plot::plnr : Ax 2 is not a machine size real number at x = 0.2544263995781211`. General::stop : Further output of Plot::plnr will besuppressed during this calculation. 1 0.8 0.6 0.4 0.2 Out[2]= Graphics 0.2 0.4 0.6 0.8 1 What a mess! Why did this happen? After all, A*x^2 should have the same form as x^2, just scaled by the factor A. Of course, Mathematic has no idea what A is. So it just sits there and yells at you. If you want to get rid of this mess (I would), the easiest thing to do is to click on the right most bracket (the one that includes the entire outpu and then hit Delete. Now, try Plot@ 2 x^2, 8x,0,3<D and evaluate this expression. Do you get what you expected? Ok. Now let s use this to plot some wave functions.

2 2 y 1 y We know that the classical wave equation is =. A solution to the wave equation is the 2 2 2 x v t harmonic solution: y ( x, = Asin( kx ωt + δ). We can verify that this is a solution by direct substitution. For convenience, we ll set the phase δ = 0, which is fine to do with just one wave (it simply means we start our clock at a different point in time.) In class on Friday, we ll start to see situations where the phase (more specifically the phase difference between waves) has physical significance. So we ll work with y( x, = Asin( kx ω for now. We saw previously that we could plot x^2, a function of x, with little difficulty. It won t be too much harder to plot a function of two variables, but we ll build it up to it in small steps. Of course, we need to be careful with values for constants, since as we saw before, if we just left A, k, and ω as variables, Mathematica will have a fit. So for convenience, we ll let A = 1, k = 1, and ω =1. Exercise #1: What are the (standard) units for A, k, and ω? Exercise #2: What is the wavelength, frequency, and period of this wave? What is the wave speed? So we ll work with the harmonic wave y( x, sin( x meters and t were in seconds. =, where y could be in meters if x were in Our method will be to take snapshots of the wave at various instants of time, and put the snapshots together to get a moving picture of the wave motion. We ll start at time t = 0, and increment by steps of one tenth of a period. Exercise #3: What is one tenth of a period? Leave your answer in terms of π. Now, enter the following into your Mathematica notebook: Plot@Sin@x 0D, 8x,0,2 Pi<D and evaluate the cell. You should obtain the following (if the numbers in your In[ ]= and Out[ ]= don t match mine, that s fine). Note that Mathematica talks in radians, not degrees.

In[4]:= Plot@Sin@x 0D, 8x,0,2 Pi<D 1 0.5 1 2 3 4 5 6-0.5-1 Out[4]= Graphics You ve just taken a snapshot of the wave at time t = 0, and plotted it! Now, repeat this for one tenth of a period later: t = 2π*1/10 (we ll assume the units are in seconds). Enter the following (you can just type it in. If you want to copy and paste, the easy way to do that is to click on the right bracket that just contains the last line you typed in (probably at Out[4]), then copy and paste, and update as needed.): Plot@Sin@x 2 Pi 1ê10D, 8x,0,2 Pi<D and evaluate. Exercise #4: CAREFULLY sketch the plot on the axes above. Do the same thing for t = 2π*2/10 and sketch your plot on the axes above. Repeat one last time for t = 2π*3/10. What do you notice about the motion of the wave? Specifically, what direction is the wave moving? Does this match the rule of thumb that was given to you in class? Comment briefly. This approach rapidly gets tedious (I m already bored). Let s see if we can find some way to speed this up and make our lives easier and more interesting. We ll have Mathematica do the boring stuff for us (after all, computers were invented to do boring, repetitive calculations.) First, you MUST type in and evaluate the following, in order to turn the Animation package on: <<Graphics`Animation` the ` is right below the Esc key, and not next to the Enter key You might get some blue messages; just ignore them. Next, type the following: Animate@Plot@Sin@x td, 8x,0,2Pi<D, 8t,0,2 Pi,Piê 10<D

Much of the above line should look familiar to you, or be straightforward in context. The last bit: {t, 0, 2*Pi, Pi/10} tells the animate command to start at t = 0 and go up to t = 2*Pi in steps of Pi/10, essentially what you were doing by hand previously, except taking snapshots twice as fast. Evaluate this cell if you haven t already. You should get twenty graphs (you have twenty steps between t = 0 and t = 2*Pi if your step size is Pi/10). How can you animate these graphs? You double click on one of the graphs that was just output by Mathematica. That should cause one of the graphs to become animated. What is going on? Mathematica is just taking all the individual snapshots and displaying them on the same axes one right after the other, thus animating them. A neat trick is to double click on the middle bracket on the right (ask if you re not sure). Doing this collapses all the graphs into one, and when you double click on that single graph, you ll get the animation. Exercise #5: Consider the harmonic wave y ( x, = sin( x +. What direction do you expect this wave to move? Explicitly check your expectation using Mathematica. Was your expectation correct? Exercise #6: Now, consider the harmonic wave y ( x, = sin( x +. What direction do you expect this wave to move? Explicitly check your expectation using Mathematica. Was your expectation correct? Exercise #7: Finally, consider the harmonic wave y( x, = sin( x. What direction do you expect this wave to move? Explicitly check your expectation using Mathematica. Was your expectation correct? One of the most fascinating wave properties is the principle of superposition: waves that overlap in time and space add algebraically. Let s observe a striking and important example of superposition. You saw that y ( x, = sin( x + was a left moving wave, and y( x, = sin( x was a right moving wave. Let s see what happens when a right moving wave overlaps with the exact same wave moving to the left. Type the following: Animate@Plot@Sin@x td +Sin@x+tD, 8x,0,2Pi<, PlotRange 8 2,2<D, 8t,0,2 Pi,Pi ê30<d Much of the above syntax should look familiar to you. One difference is Pi/30, which simply takes snapshots more frequently. The PlotRange {-2,2} command is new. It is needed here since the plots automatically rescale as needed each time a new plot is made. If you don t force it to a particular scale using PlotRange, the animation effects get ruined (imagine taking snapshots with a different zoom each time). Try it without PlotRange {-2,2} (don t forget to get rid of the previous comma as well) if you want to see what I mean. Exercise #8: If you haven t already, evaluate the cell. Remember that this is the superposition of identical waves: one traveling to the right, and the other traveling to the left. What interesting behavior do you observe? Comment briefly.

I suggest you save this notebook in your public space; Mathematic has an extensive help menu and you can learn it relatively easily just by playing around. (If there s time, do the following in class. If not, you can play around later.) Speaking of playing around, now that you have the basics of plotting and animation down, you should try some of the other neat things that can happen with waves, especially with superposition of waves. If you go to the course web-site, and go the Course Calendar for today, you should be able to download a file called Waves212E.nb (do this by right clicking on the link, and then clicking Save target as.) I noticed that this was very slow; I ll have some disks with this file on it as well. Save this file either to the Desktop or to your public space. This file is heavily documented; you should be able to figure out most things from what you ve done today, and read the documentation for the rest. If you have questions, you should please ask me. Hope you think some of these wave phenomena are interesting. Though we are modeling them mathematically here, it turns out that ALL of the things you see are actually physical; most of them we ll experience on Friday!