Question: Python ai+1aikf(ai) where k is a fixed small positive number called the step size. Write a function gradientDescentSequence (f,a0,k,h,N) which behaves as follows. - f
Python
ai+1aikf(ai) where k is a fixed small positive number called the step size. Write a function gradientDescentSequence (f,a0,k,h,N) which behaves as follows. - f is a function of two variables - a0 is a list of length 2 containing the x and y coordinates of the starting point of the gradient descent algorithm - k is the step size, as above - h is the change in x and y used to calculate an approximation to the gradient, which you will pass to your function from part 1 - N is the number of terms of the gradient descent sequence to be calculated The output of your function must be a tuple of two lists of numbers, the first list being the x-coordinates of the sequence a0,a1,,aN and the second list being the y-coordinates. This is so that you can use these lists in the matplot lib. pyplot plotting commands later
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
