Page

# Assignment 1

This assignment consists of two parts. The assignment is due Thursday November 14, 2019 at midnight (with a 0.5 point/day deducted for late submissions). Submit your assignment to the Assignment Dropbox tab on the course website as two python scripts (plain text, no notebooks). Be sure to comment your code.

Note: there is no "submit" button, if your files are in the dropbox, we will see it.

- Write a script to find a rough approximation to the location of the minimum of the function \(y(x)=x-\frac{15 x}{1+x}\) where x should be positive. I.e., find the positive value of x at which y is at its minimum. Do this by computing the values of the function for a number of evenly spaced values of x between 0 and 7, and determining the x value corresponding to the minimum y.

Denote the number of evenly spaced values by N. Start the script with the case N=10, then successively increase the number of evenly spaced x-values between 0 and 10, taking N=100, 1000, 10000, 100000 and 1000000 points.

The script should print the x value of the minimum and its accuracy for each N. - Find a better way to do this using SciPy (hint: this is an optimization problem), and write a script for it. Check the accuracy of the x value that you found.

Note: The exact solution of this problem is \(x_{min}=-1+\sqrt{15}\).

Last modified: Tuesday, 3 October 2023, 8:41 AM