subject

Golden Section Search Complete the code doing Golden Section Search for function minimization below. Stop the iteration when your bracket is less than 10-8 wide. You must be sure that you evaluate the objective function only as many times as necessary, and the autograder will check for this. The supplied plotting code shows the evolution of your brackets. Observe how one of the bracket midpoints stays the same from one iteration to the next. The setup code gives the following variables: Name Type f func(float) Description A unimodal function to minimize left end of starting bracket right end of starting bracket a float b float Your code snippet should define the following variables: Name Type a float Description left end of final bracket right end of final bracket b float * 1 import numpy as np 2 import matplotlib. pyplot as plt 3 4 brackets = [] 5 gs = (np. sqrt(5) - 1) / 2 6 m1 = a + (1 - gs) * (b - a) 7 m2 = a + gs (b - a) 8 9 # Begin your modifications below here 10 11. while False: 12 brackets. append([a, mi, m2, b]) 13 14 # End your modifications above here 15 16 # Plotting code below, no need to modify 17 x = np. linspace(-10, 10) 18 plt. plot(x, f(x)) 19 20 brackets = np. array(brackets) 21 names=['a', 'ml', 'm2', 'b'] 22, for i in range(4): 23 plt. plot(brackets[:, i], 3*np. arange(len(brackets)), '.-', label=names[i]) 24 plt. legend)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:00
The following function returns a string of length n whose characters are all 'x'. give the order of growth (as a function of n) of the running time. recall that concatenating two strings in java takes time proportional to the sum of their lengths. public static string f(int n) { if (n == 0) return ""; if (n == 1) return "x"; return f(n/2) + f(n - n/2); } options: a) constant b) logarithmic c) linear d) linearithmic e)quadratic f)cubic g) exponential
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
Which option correctly describes a dbms application? a. software used to manage databases b. software used to organize files and folders c. software used to develop specialized images d. software used to create effective presentations
Answers: 1
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
question
Computers and Technology, 24.06.2019 00:30
Setting up a home network using wireless connections is creating a a. vpn b. lan c. wan d. mini-internet
Answers: 2
You know the right answer?
Golden Section Search Complete the code doing Golden Section Search for function minimization below....
Questions
question
Mathematics, 29.03.2021 20:30
question
Mathematics, 29.03.2021 20:30
question
Mathematics, 29.03.2021 20:30
Questions on the website: 13722362