Rename this file as Chapter_1_Assignment_TurnIn.sagews
To do this, go to the file menu (click
Files
above), then click
The following will be useful for writing up your answers.
Markdown Formating
Double-click on the text in this cell. Notice how the first line of the source text is actuall %md
. This tells SageMath that everything inside this cell is Markdown language and not mathematics. Markdown is an abbreviated form of HTML that allows you to format text quickly.
Take a look at the source text below and notice how using the hashtags allows us to create large header text.
This is a header
This is a smaller header
They keep getting smaller and smaller as I add hashtags
In addition to creating headers, which help divide text into sections, you can also add horizontal lines by using three dashes (see below)
Bulleted lists can be created using single dashes
Notice that there is a space in the source text between the dash and the letter 'N' in 'Notice'
Without this space you get the following
-Here is no space
You can also create italisized text by placing asterisks on either side of a word like this.
Bold test is created by surrounding a word with double-asterisks like this
You can find a tutorial on markdown at Markdown Tutorial
SageMath is similar to Mathematica, Matlab, Maple, or other mathematical software programs. It simplifies numerical and algebraic operations. Each worksheet (this page is a worksheet) is broken into cells. The two types of cells are input cells and output cells. You type your calculations into into an input cell and then hit Shift+Enter to evaluate the cell. SageMath provides the answers to your calculations in an output cell. Click on the input cell below and hit Shift+Enter to evaluate the calculations.
Evaluate a cell
Place the cursor in the input cell and hit
Shift+Enter
to tell SageMath to evaluate a cell.
Notice how , , and are left as ratios and not converted to decimals. This is because SageMath leaves results in their exact form and does not convert the results to decimal-form unless you tell it to. To evaluate and get the answer to three significant figures you would use the numerical approximation command n(1/3,digits=3)
.
Get a numerically approximate answer and specify the number of significant figures
Use
n()
to get an approximate answerPlace the equation to evaluate inside the parentheses
Include
digits=5
to get a numerical result to five significant figuresDon't forget to put a comma between your equation and
digits=5
Problem 1
(Problem 1-12 in Hibbeler)
Evaluate the following to three significant figures (don't worry about units yet - we'll get to those in a minute)
Any letter you want to treat as a variable (you don't want to assign a numerical value to it) must be declared as a variable using the var()
command. All variable names cannot contain spaces (although you can use underscores _
instead of a space), cannot start with numbers or special characters (anything not a letter) or contain special characters (although they can contain numbers).
The standard SI units are the following:
Length: meter (abbreviated as m)
Time: second (abbreviated as s)
Mass: kilogram (abbreviated as kg)
Force: Newton (abbreviated as N)
The customary U.S. units of measure are:
Length: foot (ft)
Time: second (s)
Mass: slug (slug)
Force: pound (lb)
To use these as units we will tell SageMath that they are variables using var()
. An easy way to convert units is to define new units in terms of the original units. For instance, if your results are given in centimeters you could add the code cm=m/100
. Then typing in an answer in cm
it would be converted into m
.
Defining variables
Place units in quotes inside the parentheses in
var()
For example, to specify m and s as variables you would enter `var('m,s')
Many times you will see
m,s=var('m,s')
. This is not needed but can make it clearer that you are specifying letters as variables.
Problem 1A (Again but with units)
Evaluate the following to four significant figures and convert all answers to standard SI units
Unit conversion can be accomplished using the .substitute()
command. You can tell SageMath to substitute one variable in for another. For example, to convert from meters to feet, substitute in m=3.28084*ft
and evaluate it.
Substitute one variable for another
The
.substitute()
command is added to the end of a variableTo replace
ft
with0.3048*m
in the variable calledd
, you would typed.substitute(ft=0.3048*m)
The arguments in the parentheses sets the orignal variable equal to the new value
You can specify several substitutions at once by separating substitutions with commas
To replace
ft
with0.3048*m
andns
withs*10^(-9)
in the variablev
you would typev.substitute(ft=0.3048*m, ns=s*10^(-9))
This isn't just for unit conversion, this works for any two variables in a function
To replace
y
with3*x-5
in functionf
you would typef.substitute(y=3*x-5)
Problem 2
(problem 1-16 in Hibbeler)
The pascal (Pa) is actually a very small unit of pressure. To show this, convert to .
Hint: Work in N and m, not Pa
How much is in ?
Atmospheric pressure at sea level is . How many pascal is this?
How many pascal is ?
You can define functions in SageMath by giving the function a name and specifying the arguments of the function in parentheses after the function name. For example, to define a function you might type f(x)=3*x^2+2*x-1
. You can also have functions of multiple variables such as h(x,y,z)=3*x*y-z^3
Defining Functions
Function names follow same convention as variables; Must start with a letter, can contain numbers, can't contain spaces (only underscores
_
), and no special charactersFormat is
function_name(variable1,variable2,)= equation
such asg(a,b)=2*a+3*b
Functions can be evaluated at specific points by entering numbers in for the arguments such as
g(1,2)
The gravitational force is defined in section 1.2 in Hibbeler. Newton's law of gravitational attraction is given by
where the universal gravitational constant and is the center-to-center distance between the two objects. It is important to remember that is measured from the center of mass of one object to the center of mass of the other. To find the force between the Earth and a person you would measure the distance from the center of the Earth (it's radius) to the center of the person (roughly below the sternum in most people).
You can find more information on Newton's law of gravitation here
Problem 3
The mass of the Earth is and the average radius of the Earth is .
Define a function that calculates the gravitational force between two objects of masses
m_1
,m_2
, that are a distancer
apart.Calculate the gravitational force on a object on the surface of the Earth.
Calculate the gravitational force on the same object if it is above the Earth's surface (i.e. center-to-center distance is the Earth's radius plus 100 m)
Calculate the gravitational force on the same object if it is above the Earth's surface.
Describe how the gravitational force on the object changed going from ground-level to to .
Explain why your previous answer is or is not surprising.
Problem 4
The quantity doesn't change much near the Earth's surface so we created a variable to represent the near-Earth gravitational field and called it little g where or, in silly units . Note, this is not the acceleration due to gravity (even though the book makes this claim). Call it the 'near-Earth gravitational field constant' or simply 'little g'. Do not call it 'gravity' or I will make a very pained expression and glare at you 😉. The only time an object accelerates at is when the object is in free fall, near the surface of the Earth, in a vacuum.
Create a function that calculates the gravitational force on an object by the Earth near the Earth's surface (i.e. the 'weight' of an object).
Calculate the weight of a person with a mass of , including units and the correct number of significant figures.
Calculate the weight of a car with a mass of , including units and the correct number of significant figures.
Problem 5
Laws of Sines and Cosines
Use either the law of sines and the law of cosines to determine the unknown side lengths in the following problems. Calculate the sides as many different ways as you can and make sure that all results are the same. You can check that each answer is reasonable by comparing the results.
Find the magnitude of and the magnitude of for the figure below.
Find the magnitude of and the magnitude of for the figure below.
Is your answer to problem 5-1 and 5-2 reasonable?
Double-click on this cell and explain why your answers to each part of problem 5 are reasonable or not. Since you calculated each answer multiple times you can check whether your result is reasonable by making sure all values are identical. Describe this here.
Problem 6
Summary of this assignment:
Write up a short summary of the topics covered and what you learned in this assignment. Imagine a friend in the class couldn't remember how he or she did the assignment and wanted you to help him or her remember everything that was covered - write up your summary to help this friend.
In case you haven't guessed already, you are the 'friend' and this is meant to (1) help you reflect on what you learned (called metacognition or thinking about how you think) and (2) to give you a study guide to help you get ready for exams and quizzes.