DOC PREVIEW
MSU PHY 102 - Worksheet

This preview shows page 1 out of 4 pages.

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

Unformatted text preview:

Worksheet #1 – PHY102 (Spring 2011)This worksheet introduces you to the use of Mathematica. Mathematica is aprogramming language developed by Stephen Wolfram which has many appli-cations,e.g., solving algebraic equations, differentiation, integration, makingplots in two and three dimensions, etc. You will also solve a couple of simpleproblems in mechanics using Mathematica.Getting Started1. Logging in: A computer account has been set up on the linux computersin the computer lab in BPS1240. You will b e handed a sheet of paperwith your login instructions by the instructor. Sitting at a computer,you should be faced with a login prompt. Enter your username andpassword to log in.2. Open a browser (e.g., F irefox) and access the group web-pagehttp://www.pa.msu.edu/ pumplin/phy102Spring20113. Get to know the linux operating system and basic commands and ac-tions you will need to know to be able to do to carry out the assignmentsin this course. Download the “Introduction to linux computing” helpfrom the course home-page. You can print it out (print → print. Itwill come out on the printer in BPS1240) or read it online.4. To start a command window, right-click on the mouse, then click onthe “new terminal” option. Now follow the in structions on the handout page to change your password to one you will remember, but whichis still secure.5. To start Mathematica enter “Mathematica &” on a command line andthen press “enter” on your keyboard.6. From the courses www page, download and save the “getting started”Mathematica notebook. Save it as YourNameOfChoice.nb This is aMathematica notebook and Mathematica recognizes the “.nb” exten-sion. Open the notebook (file → open). Read through the notebook1and try out some of the exercises. This is a handy reference which youwill find useful later when you get into difficulties. It introduces somefairly advanced stuff which you don’t need right now so don’t spend toomuch time in it, just glance through, play a bit and see what’s there.To run any of the commands, hit <Enter> while holding down oneof the <Shift> keys; or use the <Enter> key of the numeric keypad.Then go on to the exercises below.7. Exercises. Do not overwrite these exercises as you are doing them aspart of the assignment is to hand them in.(a) open a new notebook and save it to a new name (e.g., week01.nb)(b) Type your name in the top. Make sure that it is typed in a “text”group and not a “command group” (see the “getting started” note-book). Save the notebook again (develop good habits!)(c) Type “2+4” (now you do want to be in a “command group”...format→ Style → Input). Hold down the “shift” button in the key boardand push “enter” (each time you want to get the result for whatyou have typed, you have to type “shift+enter”). In the outputthe screen will give you back the result.(d) Type “10/2” to check that you’ll get 5 in the output.(e) To find the roots of an equation (e.g. x2− 1), type “Solve[x∧2-1== 0,x]”. In the output you’ll get +1 and -1 as the two roots.(f) Copying: using the mouse, highlight “Solve[x∧2-1 == 0,x]” thatyou typed above. Let go of the mouse button. Move the mousedown the page to a region below where you have typed. Click themiddle mouse button if you have a three button mouse, click theleft and right mouse buttons together (this takes some dexterity!)if you have a two-button mouse. This pastes the highlighted text.Alternatively, highlight then use edit → copy and edit → paste asfamiliar to microsoft windows u sers.(g) Deleting: to edit and delete text you have typed, use the mouseand arrow and delete keys in the usual way. To delete a wholegroup (including that pesky output you generated when you madea syntax error) highlight the group by clicking on the blue bracket2at the right-hand side of the notebook. When the bracket is high-lighted hit delete.(h) Factorize the expression x2− 1 to get the roots. In order to dothat type “Factor[x∧2-1]”, and check if you get (x+1)(x-1).(i) Mathematica has extensive plotting tools. For example plot thefunction sin(x). To do this type “Plot[Sin[x],{x,0,6.28}]”.(j) Help??? Mathematica has an extensive online help library. Trylooking up the sin(x) function to make sure you have the rightformat.(k) Here is an example how you can perform differentiation usingMathematica: suppose f(x) = xn; thendfdx= nxn−1. To checkit type “D[x∧n, x]” and see the output.(l) Likewise, you can perform integration on f (x) = xn. Type “In-tegrate [x∧n, x]” and assure yourself that you indeed get backxn+11+n.Assignment #1.1. Examples. Hand in the results of the Mathematica operations youexperimented with above.2. Problem 1. The displacement of a particle undergoing one dimen-sional motion under constant acceleration is given by the equationx(t) = ut+12at2. Choose values of u and a that you think are physicallyreasonable. Find and plot x(t) and v(t) over a reasonable range of time(this depends on your choice of u and a). Note, the format used byMathematica is somewhat different from ordinary mathematics. Forexample, in mathematica you can write u times t as u t or as u ∗ t; butif you just write ut, Mathematica will think that is a single variable.You can defin e the position simply as x and plot it using “Plot[x,{t,0,5}]”,or you can define a function x[t] and plot it using “Plot[x[t],{t,0,5}]”.Try it both ways.3In plotting, you can use “Plot[x[t],{t,0,5}]” or “Plot[Evaluate[x[t],{t,0,5}]”after defining x[t]. Try both. What is the difference? (Look up Evalu-ate in help to find out.) Type a brief answer into your notebook (don’tforget to set the


View Full Document

MSU PHY 102 - Worksheet

Download Worksheet
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 Worksheet 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 Worksheet 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?