New version page

# MSU PHY 102 - worksheet06

Documents in this Course

## This preview shows page 1 out of 2 pages.

View Full Document
Do you want full access? Go Premium and unlock all 2 pages.

Unformatted text preview:

Worksheet #6 - PHY102 (Spr. 2008)Generating and plotting lists of numbers,“Do” loops and animationdue Friday February 22rd, 6pmWe 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 w ill also need to learn how to plot lists of numbers using:ListPlot, ListPlot3DFinally, animation is very simple in mathematica, using the Manipulate orAnimate commandsProblem 1.(i) Listplot plots a list of numbers on the y axis of a graph. To see how thisworks, enter the following codesintable=Table[Si n[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;1sumintegers[]=1;Do[{sumintegers[[n]]=sumintegers[[n-1]]+n},{n,2,100,1}]ListPlot[sumintegers]You c an also do this sum usingSum[n,{n,1,100,1}]Check that you get the same answer.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 sumfor p = 3 as a function of N. How many terms do you need to take untilyour answer appears to be correct to 4 digit accuracy(how big does N needto be)? Check your result by using the intrinsic function Zeta[3.]Problem 3. Enter and run the following code which animates circular mo-tion.Animate[ParametricPlot[{Cos[t],Sin[t]},{t,t1,t1+0.1}, PlotRange− > {{-1,1},{-1,1}}],{t1,0,2 Pi}]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). Youranimation should begin at firing and end when the mass hits ground

View Full Document Unlocking...