Computers and Technology

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)

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:00, 19youngr
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
image
Computers and Technology, 23.06.2019 11:30, talyku7131
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
image
Computers and Technology, 23.06.2019 19:00, jacobbecker99
Choose the correct citation for the case which established the "minimum contacts" test for a court's jurisdiction in a case. select one: a. brown v. board of education of topeka, 347 u. s. 483 (1954). b. international shoe co. v. washington, 326 u. s. 310 (1945) c. haynes v. gore, 531 u. s. 98 (2000). d. international shoe co. v. washington, 14 u. s. code 336.
Answers: 1
image
Computers and Technology, 23.06.2019 21:30, mariah10455
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
Do you know the correct answer?
Golden Section Search Complete the code doing Golden Section Search for function minimization below....

Questions in other subjects:

Konu
Social Studies, 28.08.2019 10:00