DOC PREVIEW
MSU PHY 102 - worksheet06

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Worksheet #6 - PHY102 (Spr. 2006)Generating and plotting lists of numbers,“Do” loops and animation - due Thursday February 23rdWe often ask a computer to do an operation many times. There are a largenumber of ways of doing these “iterative”tasks in Mathematica. Here aretwo that you will need this week (look them up in the online help):Table, DoYou will also need to learn how to plot lists of numbers using:ListPlot, ListPlot3DFinally, animation is very simple in mathematica. Simply generate a series offrames (e.g. using a “Do” loop) and then double click on one of the frames.This automatically animates the set of frames.Problem 1.(i) Listplot plots a list of numbers on the y axis of a graph. To see how thisworks, enter the following codesintable=Table[Sin[x], { x,0,20,.1 } ]ListPlot[sintable](ii) Three dimensional plots are just as easy. Enter and run the followingcodesintable3D=Table[Sin[x*y],{x,0,4,.1},{y,0,4,0.1}]ListPlot3D[sintable3D](iii) Using the Table function, generate points to represent a circle for y > 0.Plot this data using ListPlot.Problem 2.Here is a code to sum the first n integers, with n running from 1 to 100.The first command sets up an array which is used to store the sums.sumintegers=Range[100];1sumintegers[[1]]=1;Do[{sumintegers[[n]]=sumintegers[[n-1]]+n},{n,2,100,1}]ListPlot[sumintegers]The Riemann zeta function is defined by ζ(p) =Pn=1,∞1/np. This sum isconvergent for p > 1(why?). Write a program to find ζ(p) as a function ofthe number of terms, N, included in the sum. Plot the value of this sum forp = 3 as a function of N. How many terms do you need to take until youranswer appears to be correct to 4 digit accuracy(how big does N need to be)?Problem 3. Enter and run the following code which animates circular mo-tion.timestep = 0.1 Pitstart = 0tend = timestepx[a]:= Cos[a]y[a ]:= Sin[a]Do[{ParametricPlot[{x[t],y[t]},{t,tstart,tend},PlotRange->{{-1,1},{-1,1}}];tstart=tend;tend=tend+timestep},{i,1,20}]Modify this code to animate the following projectile motion problem: Amass of 20kg is fired from a height of 2000 meters, with initial angle to thehorizontal of 60 degrees and initial speed of 500m/s (ignore drag). Your ani-mation should begin at firing and end when the mass hits ground level. DONOT print out the frames used to produce your animation. Insteadshow your animation to your TA. However DO hand in your


View Full Document

MSU PHY 102 - worksheet06

Download worksheet06
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view worksheet06 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view worksheet06 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?