Loop Application: Numerical Methods, Part 1 The power of Matlab Mathematics + Coding.

Slides:



Advertisements
Similar presentations
Numerical Solutions of Differential Equations Euler’s Method.
Advertisements

Newton’s Method finds Zeros Efficiently finds Zeros of an equation: –Solves f(x)=0 Why do we care?
Derivatives - Equation of the Tangent Line Now that we can find the slope of the tangent line of a function at a given point, we need to find the equation.
NEWTON’S METHOD (OR: FINDING YOUR ROOTS) (NOT a genealogy concept) They say a picture is worth a thousand words. Here is a picture (observed by Sir Isaac.
PHYS2020 NUMERICAL ALGORITHM NOTES ROOTS OF EQUATIONS.
Dr. Jie Zou PHY Chapter 2 Solution of Nonlinear Equations: Lecture (III)
458 Interlude (Optimization and other Numerical Methods) Fish 458, Lecture 8.
Notes, part 5. L’Hospital Another useful technique for computing limits is L'Hospital's rule: Basic version: If, then provided the latter exists. This.
The Derivative. Objectives Students will be able to Use the “Newton’s Quotient and limits” process to calculate the derivative of a function. Determine.
Notes, part 4 Arclength, sequences, and improper integrals.
Implicit Differentiation. Objectives Students will be able to Calculate derivative of function defined implicitly. Determine the slope of the tangent.
Section 6.1: Euler’s Method. Local Linearity and Differential Equations Slope at (2,0): Tangent line at (2,0): Not a good approximation. Consider smaller.
Equations of Tangent Lines April 21 st & 22nd. Tangents to Curves.
Secant Method Another Recursive Method. Secant Method The secant method is a recursive method used to find the solution to an equation like Newton’s Method.
Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the polynomial intersects the horizontal axis (the function.
First, some left-overs… Lazy languages Nesting 1.
Solving Non-Linear Equations (Root Finding)
Numerical Methods Applications of Loops: The power of MATLAB Mathematics + Coding 1.
Copyright © Cengage Learning. All rights reserved. 4 Applications of Differentiation.
Slope Fields Objective: To find graphs and equations of functions by the use of slope fields.
Even more problems.. Mean (average) I need a program that calculates the average of student test scores. I need a program that calculates the average.
Newton’s Method Other Recursive Methods Modified Fixed Point Method.
4.5: Linear Approximations, Differentials and Newton’s Method.
4.5: Linear Approximations, Differentials and Newton’s Method Greg Kelly, Hanford High School, Richland, Washington.
Problem of the Day No calculator! What is the instantaneous rate of change at x = 2 of f(x) = x2 - 2 ? x - 1 A) -2 C) 1/2 E) 6 B) 1/6 D) 2.
Newton’s Method, Root Finding with MATLAB and Excel
Dr. Jie Zou PHY Chapter 2 Solution of Nonlinear Equations: Lecture (II)
LINEARIZATION AND NEWTON’S METHOD Section 4.5. Linearization Algebraically, the principle of local linearity means that the equation of the tangent.
Linearization and Newton’s Method. I. Linearization A.) Def. – If f is differentiable at x = a, then the approximating function is the LINEARIZATION of.
AUGUST 2. MATH 104 Calculus I Review of previous material…. …methods and applications of integration, differential equations ………..
Solving Non-Linear Equations (Root Finding)
Applications of Loops: The power of MATLAB Mathematics + Coding
§3.6 Newton’s Method. The student will learn about
4.8 Newton’s Method Mon Nov 9 Do Now Find the equation of a tangent line to f(x) = x^5 – x – 1 at x = 1.
Linearization, Newton’s Method
Solving Absolute Value Equations The absolute value of x is defined as Example 1.
Recursive Methods for Finding Roots of Functions Bisection & Newton’s Method.
Warm Up Write an equation of the tangent line to the curve at the given point. 1)f(x)= x 3 – x + 1 where x = -1 2)g(x) = 3sin(x/2) where x = π/2 3)h(x)
The formulae for the roots of a 3rd degree polynomial are given below
Newton’s Method Problem: need to solve an equation of the form f(x)=0. Graphically, the solutions correspond to the points of intersection of the.
Rates of Change and Tangent Lines Devil’s Tower, Wyoming.
6/13/ Secant Method Computer Engineering Majors Authors: Autar Kaw, Jai Paul
Project on Newton’s Iteration Method Presented by Dol Nath Khanal Project Advisor- Professor Dexuan Xie 05/11/2015.
4.5: Linear Approximations, Differentials and Newton’s Method Greg Kelly, Hanford High School, Richland, Washington.
1 4.8 – Newton’s Method. 2 The Situation Let’s find the x-intercept of function graphed using derivatives and tangent lines. |x1|x1 |x2|x2 |x3|x3 Continuing,
Modeling of geochemical processes Numeric Mathematics Refreshment
4.5: Linear Approximations, Differentials and Newton’s Method
The formulae for the roots of a 3rd degree polynomial are given below
The formulae for the roots of a 3rd degree polynomial are given below
4.5: Linear Approximations, Differentials and Newton’s Method
Ch. 5 – Applications of Derivatives
2-4: Tangent Line Review &
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
SOLUTION OF NONLINEAR EQUATIONS
Section 4.8: Newton’s Method
3.8 Newton’s Method How do you find a root of the following function without a graphing calculator? This is what Newton did.
Copyright © Cengage Learning. All rights reserved.
4.8: Linear Approximations, Differentials and Newton’s Method
4.5: Linear Approximations, Differentials and Newton’s Method
The formulae for the roots of a 3rd degree polynomial are given below
5.5: Linearization and Newton’s Method
4.5: Linear Approximations, Differentials and Newton’s Method
Copyright © Cengage Learning. All rights reserved.
MATH 1910 Chapter 3 Section 8 Newton’s Method.
The formulae for the roots of a 3rd degree polynomial are given below
The formulae for the roots of a 3rd degree polynomial are given below
Presentation transcript:

Loop Application: Numerical Methods, Part 1 The power of Matlab Mathematics + Coding

Numerical Methods We are going to develop some programs in the class of numerical methods. Numerical methods are techniques used to find quantitative solutions to mathematical problems. Many numerical methods are iterative solutions – this means that the technique is applied over and over, gradually getting closer (i.e. converging) on the final answer. Iterative solutions are complete when the answer from the current iteration is not significantly different from the answer of the previous iteration. “Significantly different” is determined by the program – for example, it might mean that there is less than 1% change or it might mean less than % change.

1. Newton’s Method Prepare a MATLAB program that uses Newton’s Method to find the roots of the equation: y(x) = x 3 + 2x 2 – 300/x Newton’s Method is used to find the roots of an equation – the values of the independent variable that make the dependent variable 0.

Newton’s Method f(x) = x 3 + 2x 2 – 300/x What does the answer appear to be?

Newton’s Method X is the root we’re trying to find – the value where the function becomes 0 X n is the initial guess X n+1 is the next approximation using the tangent line Credit to:

The Big Picture (1/4) repeat – repeat – repeat… Credit to: 1 st : guess! x n 2 nd : Find the y value for this x- value - go hit the actual curve 3 rd : Using the slope m, the coordinates (X n, Y n ), calculate X n+1 : At this (x n, y n ), calculate the slope of the curve using the derivative: m = f’(x n )

The Big Picture (2/4) repeat – repeat – repeat… Credit to: 1 st : guess again! 2 nd : find y and m 3 rd : calculate new X intercept TOO FAR

The Big Picture (3/4) repeat – repeat – repeat… Credit to: 1 st : guess again! 2 nd : find y and m 3 rd : calculate new X intercept TOO FAR

The Big Picture (3/4) – Eventually… Stop the loop, when there is not much difference between the guess and the new value! CLOSE ENOUGH! guess X inter- ecept

Newton’s Method Algorithm: Provide an initial guess at the answer Find the slope of the tangent line at the point (requires derivative) Using the line’s equation, find the x-intercept Repeat above until close enough, using the x intercept as the new “guess”

Newton’s Method % Define initial difference as very large (force loop to start) % Repeat as long as change in x is large enough % Make the “new x” act as the current x % Find slope of tangent line using f’(x) % Compute y-value % Use tangent slope to find the next value: %two points on line are the current point (x, y) % and the x-intercept (x_new, 0) end

% Define initial difference as very large % (force loop to start) % Repeat as long as change in x is large enough while (abs(x_np1 – x_n) > ) % x_np1 now becomes the new guess x_n = x_np1; % Find slope of tangent line f'(x) at x_n m = 3*x_n^2 + 4*x_n + 300/(x_n^2); % Compute y-value y = x_n^3 + 2*x_n^ /x_n; % Use tangent slope to find the next value: %two points on line: the current point (x_n, y_n) % and the x-intercept (x_np1, 0) x_np1 = ((0 - y) / m) + x_n; end TOO FAR XnXn X n+1 x_n = 1000; x_np1 = 5; % initial guess

Newton’s Method Add fprintf ’s and see the results: x y Root of f(x) = x 3 + 2x 2 – 300/x is approximately

End of Presentation