### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# LIN & NONLIN PROG MATH 4553

OK State

GPA 4.0

### View Full Document

## 12

## 0

## Popular in Course

## Popular in Mathematics (M)

This 0 page Class Notes was uploaded by Hector Hudson III on Sunday November 1, 2015. The Class Notes belongs to MATH 4553 at Oklahoma State University taught by Staff in Fall. Since its upload, it has received 12 views. For similar materials see /class/232786/math-4553-oklahoma-state-university in Mathematics (M) at Oklahoma State University.

## Popular in Mathematics (M)

## Reviews for LIN & NONLIN PROG

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 11/01/15

Newton 5 Method Example Find the root of fx equot x 3 0 If we draw the graph of f X we can see that the root of f X 0 is the X coordinate of the point where the curve intersecm with the X axis ln1 fExpx Plotf x 4 4 Oul2 The derivative and tangent line at a given point X0y0 X0 f X0 is given by f XO XXO yO ln3 df Dfl x 39 510 pa df x gtx0 0 tangentline slope x x0 yo Guns 73 e 1 em XrXO X0 To find the root we will use the Newton s iteration First choose a starting point for example X02 Clearly this is not the root Draw the tangent line at X02 newtonsmethod nb In7 om9 0mm 1 plotf Plotf x 0 25 plotpo GraphicsRed Dashed Line2 0 2 fl x gt2 tangentlineo tangentline x0 gt 2 plotto Plottangentline0 x 0 2 Plotstylea Red Showplotf plotpO plotto 71e2 1e2 72m 2 The tangent line intersect with the X axis at a point Let us find the coordinate of this point In12 0mm NSolvetangentline0 0 x Xa123841 From the graph we can see that 123841 1s closer to the so1ut1on of 11X0 than 2 Now repeat the above process draw the tangent line at 123841 n13 mum 0mm plotpl GraphicsGreen Dashed Line123841 0 123841 tangentlinel tangentline x0 gt 123841 plottl Plottangentlinel x 0 123841 Plotstylea Green Showplotf plotpO plottO plotpl plottl fx gt12384l1 l68853445012 7123841 X 2 newtonsmethod b 3 Find the intersection point of the second tangent line With the X ax1s In17 NSolve tangentlinel x om17 xeo858975 0858975 is closer to the solution of f X 0 than both 1 23841 and 2 Let repeat the process again using the new point In1a plotpz GraphicsMagenta Dashed Line0858975 0 0858975 fx gt0858975 1 tangentlinez tangentline x0 gt 0858975 plottZ Plottangentline2 x 0 0858975 Plotstylea Magenta Showplotf plotpO plotto plotpl plottl ploth plottZ 0ut19 0219715336074 0858975X 0mm J We can zoomin to have a better View n22 Showplotf plotpo plotto plotpl plottl ploth plottZ PlotRangea 075 088 1 05 om22 W W W 39 W 076 0 080 082 084 086 088 4 nevitonsmethod nb The 1ntersect1on of the magenta tangentlme With the X ax1s 1s very close to the actural solut1on of f x 0 We can expect that repeating the above process will give us even better approximation to the solution In Mathematica there s a neat way to complete the entire process in one single command We rst define a function called NewtonsMethodList In23 NewtonsMethodListf x x0 n g NNestListn Functionx fnDer1vative1Functionx f n amp x0 n11 In the above definition f7 x7 x07 n are input parameters f7 is the expression to be solved x7 is the name of the unknown variable x07 is the starting point n7 is the number of iterations repeat the tangent line process n7 times Now let s use this function to find the root of f x e C x 3 0 In24 valuesNewtonsMethodListExpx x 3 x 2 5 Out24 2 123841 0858974 0793598 0792061 079206 The values g1ven 1n the above l1st are exactly the intersection of tangenthnes w1th the x ax1s as we have seen earl1er They converge to 079206 which is the solution of fx0 We can draw the graph of the approximation n25 Showplotf TablePlottangentline x 1 x0 Plotstylea Huex02 x0 values TableGraphicsHuex02 Dashed Linex0 0 x0 f x gtx0 x0 values Out25 Mathematica also prov1de a built in function HFindRootH to solve the problemlt gives the same answer as what we have seen in the above In26 FindRootExpx x 3 x 2 0mm x a o 792 06 Example Choosing the first point is sometimes important Consider the root of f x x3 2 x 2 O From the following graph ltshould be between 2 and l newtonsmethod b 5 n27 f x 3 2x 2 plotf Plotfl x 3 3 tangentline Dfl x x gtx0 x x0 f x gtx0 amps 710 If we use the starting point X0 3 we will get the correct solution around 1 76929 Inso values NewtonsMethodListx 3 2 x 2 x 3 5 Showplotf TablePlottangentline x 11 x0 Plotstylea Huex02 x0 values Table GraphicsHuex02 Dashed Linex0 0 x01 fl x gtx0 1 x0 values PlotRangea 3 l5 1039 l Oul30 73 7224 7187537 7177656 7176933 7176929 l l l l l lt l 730 728 726 724 V22 720 Ma s 716 mum However if we choose the starting point X 3 we won t get the correct solution Because the Newton s iteration can not pass through the local minimum near xl The tangentlines will bouncing back and forth over this point newto nsmethod nb W321 values NewgonsMephodLisxx 3 u 2 xx 239 x 3 10 Show plotf TableP1Qttangentline x 1 3 PlotSty1e gt memo21 20 values 1 39I lable GraphigsHuexQ2 Dashed iLineM x01 9 KO If x ny H l IxQ values 1 0 r PlotR ng e 4H4 3 1 10 1 n om32 0mm It is the same if we use quotFdeOotquot with these twordiiferent Starting poms In34 FindRochf x 3 0mm n35 FindRootIf Xi 3 FindRootlstol The line search decreased the step size to within tolerance specified by Accur acyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function You may need more than MachinePrecision digits of working precision to meet these tolerances gtgt ouqss Unconstrained minimization problems Using the package provided in the textbook You can copy the directory quotOptimizationToolboxquot in the CD into you Mathematica installation directory under quotAddOns gt EXtraPackagesquot In some operating system for example linux the directory quotOptimizationToolboxquot is shown as quotoptimizationtoolboxquot some characters in lower case instead of upper case So are the les under this directory you will need to manually rename them to the upper case name so that Mathematical can read it correctl A er copied the directory you will be able to use the package It is possible that there will be some warnings sinc ethe package was written for an older version of Mathematica I Example 1 Use the steepest descent method to find X y that minimizes fxy x y2 2 x2 yl l l 32 The starting point is 125 025 m y NeedsquotOptimizationToolbox Unconstrained quot Generalzzobspkg LinearAlgebra MatriXManipulation is now obsolete The legacy Version being loaded may conflict with current Mathematica functionality See the Compatibility Guide for updating information gtgt Generalzznewpkg NumericalMath NLimit is now available as the Numerical Calculus Package See the Compatibility Guide for updating information gtgt SetDelayed write Tag Norm in Normy is Protected gtgt SetDelayed write Tag Hessian in Hessianf7List Varsi is Protected gtgt SetDelayed write Tag Hessian in Hessianf yarsi is Protected gtgt Generalzzstop Further output of SetDelayed write will be suppressed during this calculation gtgt Imm SteepestDescent SteepestDescentf yars X0 opts Computes a minimum of fVars starting from X0 using the steepest descent method The step length is computed using analytical line search See OptionsSteepestDescent to see a list of options for the function The function returns X hist X is either the optimum point or the next point after Maxlterations hist contains history of Values tried at different iterations 2 unconstrained nb n3 PlotSearchPathf Xi lein leax X2 X2min XZmaX hist opts shows complete search path superimposed on a contour plot of the function f over the specified range hist is assumed to be of the form ptl pt2 where ptl X1X2 is the first point etc The function accepts all relevant options of the standard ContourPlot and the Graphics functions De n the function variables and the stating point 2 fa Xy2 ingZ 71X2y2 stjx 3 2 7T16X 2y16xy er my 2 3 2XT16X y16y Optimum 70764703 0762588 after 2 7 iterations n7 0mm unconstrained nb 13 However 1fwe plot the gIaphjn a larger Ieg101 139we can see that39thisproblem may have another local Inmjmum In9 Pliocs a r el rPE F hffy we 422 ms nr Oul9 266 i achistj 4 unconstrained nb f Xy2 7 2 71X2y22 750x 3 Via 50 Zeryl6X2yl6y3 16X32ylsxyzr Optimum 0764703 70762588 after 27 iterations 0ul13 l Example 2 Use the conjugate gradient method to find Xy that minimized fxyx y2 2 x2 y2 1 1 3 The stating point is 125 025 n14 faxy27 271x2y 2 50x 3 16x32y16xy2 Vf a 50 2eryl6x2yl6y3 Using the PolakRibiere method with Analytical line search Optimum 70763759 0763766 after 6 iterations Out18 001iiiiiiiiiiiiiiiiir 714 712 710 708 706 unconstrained nb 5 Remark comparing the iterations for convergence we can see that for the example problem Steepes Descent converges in 27 steps and ConjugateGradient converges in 6 iterations Using the Package provided by Mathematica Before we start let s first clean the entire working space This Wlll remove the prev1ously loaded package OptimizationToolbox mum ltltUtilities cleanslate Cleanslate CleanSlate Contexts purged Global CleanSlate Approximate kernel memory recovered 472 Kb Mathematica contains an Optimization package which prov1des solvers for UnconstrainedProblems To load this package use the following comman 6 unconstrained nb n1 n2 0mm 72 xa137638 y 157368 n4 om4

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

#### "I made $350 in just two days after posting my first study guide."

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.