All the homeworks are distributed as Jupyter notebooks. Follow these instructions to get everything set up.
-
Install Julia by running the one of the following terminal commands depending on your system. This will install the Juliaup installation manager. DO NOT install version-specific binaries.
a. for Windows, runwinget install julia -s msstore
, thenjuliaup add lts
to install the LTS version, andjuliaup default lts
to set LTS as the default Julia version.b. for Mac/Linux, run
curl -fsSL https://install.julialang.org | sh -s -- -y --default-channel lts
to achive the same thing. -
Clone this repo
git clone https://github.com/Optimal-Control-16-745/HW0_S25.git
or download the zip file. -
Start a Julia REPL in your terminal using
julia
. -
Install the IJulia using the Julia package manager. In the REPL, enter the package manager using
]
, then enteradd IJulia
to add it to your system path. -
In the REPL (hit backspace to exit the package manager), enter
using IJulia
. -
Launch the notebook using
notebook()
orjupyterlab()
. -
(Optional) If you use VSCode, instead of steps 5-7, you can install the Julia and Jupyter extensions in VSCode. Make sure you set the
kernel
toJulia lts channel
before running your code.
- Please watch the HW0 + Julia Video Walkthrough by Kevin Tracy from last year and checkout the corresponding Jupyter notebook
julia_primer.ipynb
. Note: the video was made for the previous Julia LTS version(1.6.7) and we will be using the latest (and much improved) LTS, but the content is still very much relevant. - After you have completed the walk through, fill out
Q1.ipynb
andQ2.ipynb
.
Submit all HWs as PDFs of your completed Jupyter Notebooks in Gradescope. Please review all the checklist items and instructions below:
Before you submit your completed homework PDF, remember to complete all the checklist items below:
- Make sure text and code, including special characters, are completely legible.
- Make sure code is completely visible (i.e., no cropped lines). If we can't see it, then we can't grade it... Look at section below for details on how to remedy this.
- Make sure plots and unit tests have been outputted and rendered properly. Meshcat visuals are exempt.
- DO NOT ALTER UNIT TEST CASES. We check and can tell...
- Assign questions to each respective page of your PDF in Gradescope, including the text of the problem.
If your code is cropped in the PDF, then there are multiple remedies for this:
- Split line around binary operator (e.g., +):
L_grad = FD.gradient(f, x) +
transpose(FD.jacobian(c, x))*λ
- Split line around parenthesis:
L_grad = (FD.gradient(f, x)
+ transpose(FD.jacobian(c, x))*λ)
- Split line after assignment operator (e.g., =):
L_grad =
FD.gradient(f, x) + transpose(FD.jacobian(c, x))*λ
- Combine 1-3 to split into more lines:
L_grad =
FD.gradient(f, x) +
transpose(FD.jacobian(c, x))*λ
- Assign terms to more variables:
cost_grad = FD.gradient(f, x)
constraint_jac_T = transpose(FD.jacobian(c, x))
L_grad = cost_grad + constraint_jac_T*λ
Feel free to use any method you'd like to export your Jupyter notebook as a PDF (with all checklist items completed).
We recommend the following method of converting your Jupyter notebook to a PDF because it requires no additional installs (hopefully). It's slightly involved, but it is the most consistent in our experience.
- Open the Jupyter notebook in your favorite web browser (not VS Code) with IJulia.
- Go through the submission checklist, and make sure all relevant items are completed.
- In the top left corner of the Jupyter menu bar, do
File -> Save and Export Notebook As -> HTML
. It should download an HTML file. - Open the downloaded HTML file in your favorite web browser.
- Open up the browser's print menu and select
Save as PDF
. - Save and combine PDFs.
- Submit on Gradescope, and make sure to assign the right pages to all questions.
If HTML to PDF does not work, feel free to try other methods: https://mljar.com/blog/jupyter-notebook-pdf/.
- These questions will have long outputs for each cell, remember you can use
cell -> all output -> toggle scrolling
to better see all of the output without having to scroll.