HW_7___MCEN_3030___Computational_Methods___Fall_2022

pdf

School

University of Colorado, Boulder *

*We aren’t endorsed by this school

Course

3030

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

1

Uploaded by EarlChimpanzee3848

Report
MCEN 3030 Computational Methods - HW 7 - Fall 2022 Prof. Robert MacCurdy Submission Deadline: October 29th 2022, Saturday @ 11.59pm Submission Guidelines: Follow the homework format and submission instructions in the Syllabus and on the course Canvas site! Read all questions carefully and answer all questions. When in doubt, provide more information rather than less. Question 1 - Newton’s Method You are given the function f ( x ) = 1 3 x + 5 x 2 8 x 3 + 2 x 4 (a) Plot the graph of the function and graphically determine the value of x and f ( x ) at the minima (b) Write a program that calculates the minima using Newton’s Method with a starting x 0 = 1 and ϵ s = 0 . 5% Question 2 - Golden-Section Search You are given the following function: f ( x ) = 1 ( x 0 . 3) 2 + 0 . 01 + 1 ( x 0 . 9) 2 + 0 . 04 6 (a) Plot the graph of the function and determine the global and local maximas. (b) Write a program that calculates the maxima of a function using Golden-Section Search. Starting with initial bounds of X upper = 1 and X lower = 0, find the global maxima of the function. Use an ϵ s = 0 . 00001% (c) Modify your starting bounds and make your algorithm arrive at the local maxima that you observed graphically, with the same ϵ s = 0 . 00001% (d) On the graph of the function that you plotted, show the local and global maxima of the function Question 3 - Random Search Using a Random-search, find the maximum value of the function f ( x, y ) = x + y 4 x 2 y 2 + xy in a region bounded by x = 0 . 5 to x = 0 . 5 and y = 1 to y = 1 . 5. Plot the 3D graph of the surface with appropriate bounds and mark the maxima obtained by your program on this surface. Recall that random search is a heuristic method, albeit a simple one, and does not have any sort of convergence guarantees. For this reason, the stopping criteria are different than the others you have used so far in the class. Keep track of the best “guess” seen so far for the optima (this variable stores f ( x, y ), the function value, and is only updated when a superior guess is found), and generate (show us) a plot of this best guess vs the number of guesses (x axis is number of guesses, y axis is best seen so far). It is up to you to decide how many function evaluations to do. You might consider using this plot to determine when to stop... 1
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help