HW_8___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 8 - Fall 2022 Prof. Robert MacCurdy Submission Deadline: Monday November 7th 2022, @ 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 - Univariate Search Find the minimum value of the function f ( x, y ) = ( x 3) 2 + ( y 2) 2 xy using the univariate search method. Use a starting value of x = 3 and y = 3. The answer should be correct to 3 significant digits. Plot the function on a 2D Contour plot with bounds [2, 7] on each DOF and mark the starting value with a black filled-in circle, show the guesses in the X direction with Red filled-in circles, and show the guesses in the Y direction with Blue filled in circles. Mark the minima obtained from your code on this contour plot with a green filled-in circle. Try using the ezsurf function with appropriate intervals to make plotting easier. Also see the in-class examples for usage of meshgrid , surf , and contour , all of which may be useful for this HW. Question 2 - Steepest Descent Find the minimum value of the function f ( x, y ) = ( x 3) 2 + ( y 2) 2 xy using the steepest-descent method (which is the same as the steepest-ascent method, except we’re finding the minimum value). Use a starting value of x = 3 and y = 3. The answer should be correct to 3 significant digits. Plot the function on a 3D surface plot with bounds [2, 7] on each DOF. IN ADDITION, plot the function on a contour plot with bounds [2, 7] on each DOF and: mark the starting value with a black filled-in circle, show the steps with Red filled-in circles, and mark the minima obtained from your code on this contour plot with a green filled-in circle. Question 3 - Linear Programming A door-door salesperson sells snow shovels and snow blowers, and can drive up to 9500km per week (tough job!). Because snowblowers can be shared among neighbors, the salesperson has to drive an average of 20km to sell a snowblower, but only 5km to sell a snow shovel. The salesperson can work up to 40 hours/week, and it takes an average of 0.05 hours to sell a snowblower (because they practically sell themselves), but 0.12 hours to sell a snow shovel (who wants to shovel?). Each snowblower weighs 25kg while each shovel weighs 2kg, and the salesperson can only carry 6500kg per week on the truck. When sold, a snowblower yields $ 45 in profit, while a snowshovel only yields $ 5 in profit. (a) Setup the linear programming program to maximize profit and show all profit and constraint equa- tions. (b) Solve the linear programming problem graphically. Show optimal answer location. (c) Solve the linear programming problem with MATLAB. Show optimal answer numerically. Question 4 - Curve Fitting Use the data from HW 6, Question 1, but use the Univariate Search method you developed above to find the best-fit parameters a 0 , a 1 , a 2 (in a least-squares sense). Do NOT use the use the normal equations, direct method using ML divide, or the inverse of the matrix method. Display the fit parameters a 0 , a 1 , a 2 and plot the data with the fit plane. You do not need to compute r 2 , S r and S y/x . Hint: we discussed this in class during Lecture 18. 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