Week 1: Introduction#
Laboratory 0
Last updated July 17, 2023
00. Content #
Mathematics
N/A
Programming Skills
Importing libraries
Latex
Embedded Systems
N/A
0. Required Hardware #
Breadboard
5 Wires
LED
9V battery
Voltage Regulator IC (LM 7805)
220 ohm resistor
1. Before Starting #
Before starting this course, please navigate to Brightspace and read through the syllabus.
Once you have completed that, we will proceed to set up a folder for organizational purposes. This folder will be used to store all files throughout the course. To create the folder, go to the Home directory and right-click to add a new folder. Choose a name that is easy to locate, such as DSLab_Probability
. If you want the folder to appear at the top of the list and be even more accessible, you can add a tilde (~
) at the beginning of the chosen name.
From now on, save all files, including those downloaded through links during labs, to this folder. This practice will make it much easier to find everything, especially when submitting labs at the end of each class. When you click on a file link, it will redirect you to the corresponding GitHub page. To download and save the file to your folder, click on the “Download raw file” button located at the top right of the file preview (it should look like a normal download button).
Laboratory Ethics#
Be sure to read and follow this pledge.
“I pledge to behave ethically and with honesty in this course. I may discuss approaches for a solution with others, but my submitted lab report will be my own work, including all code. I will not make my finished reports available to other students, even after the semester is over. In particular, I will not post my labs on the Internet or make my files available to other people. I will not be a cheater.”
2. Introduction to Jupyter Notebooks #
Hover your mouse over the blue banner and double-click to edit the contents of this cell.
Write your name and email below:
Name:
Email:
Two Types of Cells#
The application you are currently using is a Jupyter Notebook (formerly IPython Notebook). A Jupyter Notebook consists of two types of cells: Markdown cells and Code cells. Markdown cells are used to present text in a nicely-formatted manner for readers, while code cells display code in a well-formatted structure intended for both humans and computers to comprehend. The text you are currently reading belongs to a markdown cell. The code cell below, displayed in gray, serves as an example of a code cell. When you execute the code cell, each line of code is sequentially executed, and the output of the last line is displayed beneath the cell. To execute cells, simply press the Shift
key while simultaneously pressing the Enter
key (Shift+Enter
).
# this is a code cell
print('hi!')
Markdown#
Throughout the semester, you will write your answers to exercises directly in this interactive textbook. Some answers will be strictly Python code, while others require nicely formatted text.
Double-click in this cell to see some common markdown commands.
numbered list item 1
numbered list item 2
list item
another list item
with a line breakMarkdown can be used to write mathematical expressions and equations with \(\LaTeX\) like \((xy)^n = x^n y^n\)
Exercise 1 #
You can use the “+” button at the top of the document to insert a cell. Inside a cell, you can use the dropdown menu to the right of the plus button to switch between code and markdown.
Part 1: Add a markdown cell and type a short message.
Write Answer for Exercise 1 Part 1 Below
Part 2: Convert the markdown cell below to a code cell and run it.
Write Answer for Exercise 1 Part 2 Below
1+2*5 # change me to code
3. Skill Checks #
If you’re unfamiliar with \(\LaTeX\), here’s a short refresher. This link will take you to Jupyter Notebook within the Probabilty Labs GitHub repository. To download the notebook, click on the “Download raw file” button on the right.
Exercise 2 #
Write the formula for the Gaussian integral from the Wikipedia page using \(\LaTeX\).
Hint: Detexify is a nice tool to help you find the command for a symbol.
Write Answer for Exercise 2 Below
Exercise 3 #
Import the two libraries NumPy and matplotlib.pyplot and rename them as np
and plt
, respectively.
Write Answer for Exercise 3 Below
Exercise 4 #
Download this Jupyter Notebook and complete the exercise on wiring an LED on a breadboard.
4. Submitting the Lab #
Once you have finished the first lab, you will need to submit it.
Before you submit, ensure everything is filled out and saved (either by typing Ctrl+S
or by clicking the floppy disk icon in the top left of this application).
Now, follow these steps:
Navigate to “File” in the top left of the screen and find “Save and Export Notebook As…”. Once the drop-down comes up, click on “HTML”.
The html file will now be saved in the
Downloads
folder. Open the html file in the web browser by double-clicking on the file inDownloads
.Once the html file has been opened in the browser, right-click anywhere on the window and choose “Print…” or use
Ctrl+P
to open the print window.For “Destination”, select “Save as PDF” in the drop down menu and click “Save”.
Turn in the PDF through Gradescope.
Assign the listed exercise numbers to the correct pages of the PDF you are uploading and hit the “Submit” button.
Once you’ve submitted Lab 0, you are done and are free to leave!
NOTE
You are expected to submit the lab every week before the end of class (unless the lab specifies otherwise).
If you find yourself running short on time to complete a lab within the given time, please communicate with your TA. However, make sure to submit your partially completed lab by the end of class as per the usual submission process.