EGR 103/Spring 2021/LAB 01

From PrattWiki
Jump to navigation Jump to search

File Storage For EGR 103

You will be working with files on your computer but you will be backing them up with a system called Box. Duke students have 50 GB of free storage for academic purposes on the box system. Furthermore, you can have Box sync up with your local files (as long as you put them in the right place)!

Working From Off Campus

If you are not on Duke internet, you will need to connect using a security program known as a VPN. See Connecting from Off Campus for links to get the program.

Box Setup

  • Go to https://box.duke.edu/.
  • Click the LOG IN button.
  • If asked if you are Part of Duke? Click Continue.
  • Log In using your Duke credentials.
  • You should now see your Duke Box - it may be empty.

Local Folder Setup

People with Macs with M1 Chips / Linux

Note: - if you have a new Mac with the M1 chip, you will skip this step for now. You will still be able to do all the work for the class but your files will not be backed up to the cloud. We are working on an alternative method. You should make a folder on your main drive called EGR103S21mac and use it to store all the files for this class until we figure out the issue with the M1. If you see EGR103S21 or Box/EGR103S21 in any further instructions, replace that with EGR103S21mac for now.

Otherwise

You will now create a folder on your local computer to synchronize with your Box folder.

  • Go to https://duke.app.box.com/services/browse/newest/box_drive for information about Box Drive and the download links for Windows and Mac.
  • Download the appropriate file and install it.
  • Keep track of where the Box folder is placed on your drive.
    • For Windows it is likely a spur off the main File Explorer window and located specifically at C:\Users\USER\Box where USER is your Windows user name.
    • For Mac, a Box drive will be mounted.
  • To see it work, on your computer go into your Box drive, create a new folder, and call it EGR103S21 in all caps with no spaces. After you have created it, refresh the browser that is looking at your Box account and the folder should show up on your list!
  • Box Drive generally works when you are online and thus keeps things in the cloud and only pulls them down when you need them. To make sure that you have access when you are offline, and to mitigate any internet connectivity issues, you will want to tell Drive to make your folders available offline.
    • In the File Explorer or Finder, open your Box folder. Right-click EGR103S21 and in the context box find "Make Available Offline"
    • Once things have synchronized, there should be a green check by the folder - that is the sign that the folder will be available offline.
  • You will never need to set this up again for the computer you are currently working on, but if you end up working on a different computer you will need to install Drive. This also means you can work from public or other computers as your files will always be on Box.

Python

For the Spring semester, we will be using Anaconda's distribution of Python 3 and specifically using the Spyder Integrated Design Environment. The distribution is free and multiplatform. If you already have Python or Anaconda installed, you may still want to download and install the latest and greatest. Python is a work in progress, and Python 3.8 and its associated packages have differences from 3.7 that will come up later in the semester (for example, there are some default cases in 3.8 that are not in 3.7 for certain commands). You will want 3.8.

Installation

  • Go to https://www.anaconda.com/products/individual and click the Download button.
  • Pick the appropriate distribution and download the package. You will want to use the graphical installer and almost definitely the 64-bit unless you know you have a 32-bit processor.
  • You are not required to create an Anaconda account, but you are certainly allowed to.
  • You can use all the default recommendations for the installation or, if you are sure you know what you are doing, you can make changes.
  • You can also look at the tutorial and such, though on your own time a little later in the lab :)
  • Once installed, start the Anaconda Navigator.
  • In the Navigator window, there may be multiple items. One of them should be Spyder. We will ask you to launch that during lab and we will briefly go through how to write a program in Python.
  • If Spyder asks about installing Kite, you can install Kite. It is an add on to Spyder that provides more in-depth help with Python commands. Note: if you are using a Duke VCM to run Anaconda, you will not be able to install Kite.

Your First Program!

  • Start a new file by clicking the New file icon at the top left.
  • Enter the code print('Hello, world!') in the first line under the comments that were pre-loaded.
  • Save the file by clicking File and then Save. Save it in your Box/EGR103S21 folder as start.py.
  • Run the file by clicking the play button (single green arrow near the top of the screen). Clicking this button on a saved file will both change the Spyder working director to the folder that file is in and will run the file.
  • Confirm that the Console window now, among other things, says Hello, world!

Overleaf

This semester, we will be using a freemium tool called Overleaf for making lab documents. We will only need the free features for work this semester. Overleaf is a LaTeX editing and processing program. One drawback is that it cannot access files directly on your drive but rather needs you to upload them. As you go through the course, you will get a better and better idea of which files need to be uploaded. For this lab, we will explicitly talk about each part you need to upload.

Starting Up

  • If you do not already have an Overleaf account, go to https://www.overleaf.com/ and register. Duke does not have an account for students, but you can still use your duke.edu address. If you already have an Overleaf account with a different login, you can certainly continue to use that.
  • Once you have logged in, you will have the option to look at some templates or the Help Guide. We will look at those in the lab on my computer, so go ahead and progress straight to creating your first LaTeX project. Make it a blank project, and call it EGR103LAB01. Overleaf will create the main document with some boilerplate information in it.

Getting Starter Files

  • Each week, I will give you access to at least the lab skeleton. This week, there are several files you will need. Here's how to get them:
    • Go to https://duke.box.com/s/sqougnstliwe9o6euw3o27n6x9oqyiew which is my shared EGR103S21public Box folder.
    • There should be a Lab01Files folder. To its right, there will be a button with three dots. Click that button to look at the other things you can do with that folder and select Download. Box will download the files. Depending on whether you are logged into Box, it might allow you to log in. You do not need to.
    • Windows machines will download a zip file to open while macOS will open a folder to open.
      • If on Windows, double-click the zip file; from there you should be able to select and extract the Lab01Files folder. In the "Copy" dialog window that comes up, click the triple dot box to the right of the "Copy to:" box and then navigate to your Box/EGR103S21 folder. That is where you will want to put the Lab01Files folder.
      • If on macOS, just move the folder that you downloaded into your Box/EGR103S21 folder.
After the folder is copied and synchronized, the folder should get a green check.
    • Now open the Box/EGR103S21/Lab01files folder and make a copy of the Lab1Sample_S21.tex file; call the new file lab1.tex.
    • Next, make the browser with your Overleaf account active. In the Overleaf window, which should be pointing to your EGR103LAB01 project, click the upload icon (third from the left above the file list).
    • Drag all the files from your Box/EGR103S21/Lab01files folder into the available space for uploading files and upload the files. This will copy them into Overleaf.
    • Now you need to tell Overleaf to change the primary tex document. Click the Menu button at the top left of Overleaf. In the main document drop-down, select the lab1.tex file.
    • Finally, you need to recompile your project since the main document changed. Click the Recompile button and the lab skeleton will compile.

Box References

FAQ

Arrays:

  • bmatrix:

\begin{bmatrix} a & b\\c & d \end{bmatrix} The code for this array is below; the code for every other array is the same except for the arguments of begin and end.

\begin{bmatrix}
a & b\\c & d
\end{bmatrix}
  • pmatrix:

\begin{pmatrix} a& b\\c & d \end{pmatrix}

  • vmatrix:

\begin{vmatrix} a& b\\c & d \end{vmatrix}

  • Bmatrix:

\begin{Bmatrix} a& b\\c & d \end{Bmatrix}

  • Vmatrix:

\begin{Vmatrix} a& b\\c & d \end{Vmatrix}