Uploaded by Derek Warner

Lab 01 Assignment

advertisement
Lab 1: Introduction Assignment
◼ Instructions
Welcome to your first Lab Assignment. The questions below should test your understanding of the instructional content provided in this lab. Here are some things to remember as you complete this first assignment:
1. Save the notebook to your computer as “Lab # first name last name” and save your work often.
2. When you have finished all the exercises, save the file as a PDF.
3. Upload the PDF on Canvas, then verify the submission by going to Submission Details, downloading the file, and opening it; if you can open it, we can.
4. Do not delete this notebook. Save all your work until after the semester is over and your final grade has
been issued.
◼ Question 1: Using Cells
Derek Warner
a) Right below this cell create a Text cell. In the text cell, type your first and last name.
b) Click below and open a Input cell. In it, take the number of letters in your last name and subtract the
number of letters in your first name. Evaluate the cell and show the output.
In[1]:=
Out[1]=
6-5
1
◼ Question 2: Mathematica Syntax
a) In each cell below modify the code to perform the stated task.
Find a decimal approximation to sin(2)
In[18]:=
Sin[2.0]
Out[18]=
0.909297
Plot cos(x ) on the interval -2 ≤ x ≤ 2 .
Printed by Wolfram Mathematica Student Edition
2
In[15]:=
Lab 01 Assignment.nb
Plot[Cos[x], {x, - 2, 2}]
1.0
0.8
0.6
0.4
Out[15]=
0.2
-2
1
-1
2
-0.2
-0.4
Calculate a numerical approximation of π to 15 decimal places.
In[21]:=
Out[21]=
N[Pi, 15]
3.14159265358979
◼ Question 3: Help Menu
a) Using the documentation center, research the command “Solve.” Copy the code from the first example
presented under the “Examples” section in the documentation center and paste it directly below in an Input
cell.
In[22]:=
Out[22]=
Solve[x ^ 2 + a x + 1  0, x]
x 
1
2
- a -
- 4 + a2 , x 
1
2
- a +
- 4 + a2 
b) Copy the code from part a into a new Input cell below. Modify the code to solve the polynomial
x 2 + 2 x - 3 = 0.
In[24]:=
Out[24]=
Solve[x ^ 2 + 2 x - 3  0, x]
{{x  - 3}, {x  1}}
c) Use the documentation center to research the command “Log.” In a new Input cell below, calculate the
numerical value of ln(9) (as usual, by ln we mean the natural logarithm). Present your answer as a decimal.
In[27]:=
Out[27]=
Log[9.0]
2.19722
Printed by Wolfram Mathematica Student Edition
Lab 01 Assignment.nb
3
◼ Question 4: Free Form Input
a) I would like to find out some local information about Houghton MI. Using the Free-Form Input cell, type
in “Houghton MI” and evaluate. The plus sign in the Free-Form Input box will open and close additional
information about your search. Open the additional information and read through it to find whatever you are
most interested in. Click on the table, graph, or item that you find most interesting to highlight it and then
type shift+enter to select it. Finally, click the subtraction sign to close the additional information so that only
your topic of interest is displaying.

Houghton MI
Other indicators
total rate of violent crime
0.1 × national average
total rate of property crime
0.67 × national average
(2019 estimate)
Out[29]=
(2019 estimate)
b) Now I am interested in the distance from the earth to the moon. Using Free-Form Input, enter in “distance
to the moon” and repeat the steps in part “a”, i.e. expand to see the additional information, highlight your
favorite pod by clicking on it, choose it by typing shift+enter, and then close the additional information.

distance from the earth to the moon
Orbital properties
Out[31]=
current distance from Earth
223 212 mi
56.32 a
average distance from Earth
239 200 mi
60.36 a
orbital period
27.322 days
◼ Question 5: Visualizations
a) Plot the functions x, x , and ln(x ) from x = -1 to x = 3 . Make sure to incorporate the PlotRange and
PlotLegend commands.
Printed by Wolfram Mathematica Student Edition
4
In[40]:=
Lab 01 Assignment.nb
Plotx, x , log [x], {x, - 1, 3}, PlotRange  Full, PlotLegends  "Expressions"
20
15
x
x
10
Out[40]=
log (x)
5
-1
1
2
3
b) Read the question below. Then, create a text cell and input your answer there.
The functions x and ln(x ) look as though they are reflections about y = x which indicates they are ____.
Flipping
Printed by Wolfram Mathematica Student Edition
Download