MIT 18.337/6.338

# Modern Numerical Computing

## Homework 1

#### Problem A: (Do not hand in) Set up Julia 1.0 on your computer

2. Find your Julia executable and then open it up. Type "1+1" and hit Enter, to check if your installation works.

#### Problem B: (Do not hand in) Install Jupyter

using Pkg

This should install the IJulia package onto your system. Once it installs, execute the following:

using IJulia
notebook()

This should open up a new window in your browser with the Jupyter interface.

### Problem C: (Do not hand in) Run the lecture and homework notebooks

Most, if not all the course material will be uploaded to the course's git repository. To download it onto your computer, the easiest thing to do is download git and then run the following command:

git clone https://github.com/alanedelman/18.337_2018.git

This clones the git repository to your local computer. To run the notebooks, you can open up Julia, and execute these commands:

using IJulia
notebook(pwd = "/path/to/18.337/folder/")

where "/path/to/18.337/folder/" is where you have cloned your git repository.

Try running the notebook titled "Multiple dispatch-Roman numerals & Functions.ipynb" and make sure everything works. Add something fun, or find something you don't yet understand and read the doc or experiment with it. If it's cool share on piazza.

### Problem 1: (hand in a pdf of a notebook) Not dense, not sparse, ..., structured!

Consider a matrix of the form M(v) = Diagonal(v) + vv' , where v is a vector.

Create a special type called Custom(v) which creates such a matrix. Create a show method to print this matrix in dense format.

The largest eigenvalue of this matrix is the zero of

$$f(\lambda) = 1 + \sum_{i=1}^{N} \frac{{v_i}^2}{v_i - \lambda}$$

that is bigger than the largest element of v.

Try to construct an eigmax routine for this Custom type. Consider Newton's method, bisection, or otherwise.

Use the Sherman-Morrison formula to create an inv method for such matrices.