1 Getting started Math4414 Matlab Tutorial We start by defining the arithmetic operations in matlab in the following tables Arithmetic Operations * mu

Size: px
Start display at page:

Download "1 Getting started Math4414 Matlab Tutorial We start by defining the arithmetic operations in matlab in the following tables Arithmetic Operations * mu"

Transcription

1 1 Getting started Math4414 Matlab Tutorial We start by defining the arithmetic operations in matlab in the following tables Arithmetic Operations * multiplication + addition - subtraction n left division / right division ^ power At the matlab prompt type >> format long >> orange = 3 orange= 3 >> orange = 3; >> orange orange = 3 >> apple = 13; >> orange + apple 13 >> c = apple*orange; >> c c = 39 >> b = c*orange/5 + apple^3 1

2 b = e+03 ( *10^3 ) >> d = sqrt(b) d = One may change the format of the output using the command 'format' as defined in the following table. format short format long format short e format long e format short g format long g format rational Let us change the format to see the effect >> format >> f = 2/3 5 digits 16 digits 5 digits scientific 16 digits scientific 5 digits 16 digits rational number f = >> format short >> g = 2/3 g = >> format short e >> 2/ e-01 >> format long e >> 2/ e-01 Vectors in Matlab 2

3 >>v = [1; 3; -3; 4] v = >> v = [ ] v = >> w = 2*v; >> z = w + v z = >> z' (change the orientation of the vector) >>x = 0:0.2:3; >> length(x) 16 >> x(8:12) >> y = cos(x); >> y y = Columns 1 through 7 3

4 Columns 8 through Columns 15 through >> y(1) ( will print y(1)) Operations of vectors and scalars if a =[a 1 ;a 2 ; a n ], b =[a 1 ;a 2 ; ;a n ],c is a scalar. a + c = [a 1 + c; a 2 + c; ;a n + c] a Λ c = [a 1 Λ c; a 2 Λ c; ;a n Λ c] a + b = [a 1 + b 1 ;a 2 + b 2 ; ;a n + c] a: Λ b = [a 1 Λ b 1 ;a 2 Λ b 2 ; ;a n Λ b n ] a:=b = [a 1 =b 1 ;a 2 =b 2 ; ;a n =b n ] a: b = [b 1 =a 1 ;b 2 =a 2 ; ;b n =a n ] a:^b = [a b1 1 ;ab2 2 ; ;abn n ] c:^b = [c a1 ;c a2 ; ;c an ] a:^c = [a c 1 ;ac 2 ; n] ;ac >> u = [w,v] (will app the two vectors) >> norm(v,p) ( computes the L^p norm, p>=1) 4

5 2 Buit-in functions sin cos tan artan acos asin exp log log10 log2 sinh cosh tanh sec abs sign max min sine function cosine function tangent inverse tangent inverse cosine inverse sine exponential natural logarithm decimal logarithm binary logarithm hyperbolic sine hyperbolic sine hyperbolic sine secant absolute value sign function maximum minimum These function may accept scalar, vector, and matrix arguments. 3 Plotting curves and surfaces The following table contains some important commands to plot curves and surfaces. figure(n) clf hold on plot xlabel ylabel zlabel xaxis yaxis zaxis subplot view surf contour meshgrid pcolor create or change figure n clears current figure hold existing plots in a figure plots a curve defines the label for x axis defines the label for y axis defines the label for z axis define range and tics on x axis define range and tics on y axis define range and tics on z axis define and switch subplots change view for surfaces plots surfaces plots contour for surfaces create coordinates for grid points plots solution in a plane 5

6 For example the following program will plot the graph of y = cos(2x)+ exp(x), 0» x» 2 in dash-dot line and blue color >> x = 0:0.1:2; >>y = cos(2*x) + exp(x); >>plot(x,y,'-.b') You may set colors using b: blue, r:red, y:yellow and g:green. The type of lines is set by -:solid,..:dotted, -.:dash-dot, +:plus symbol: for other symbols and lines types consult the online tutorial. To plot two curves on the same figure use 'hold on'. >> x = 0:0.1:2; >>y = cos(2*x) + exp(x); >>z = tanh(x) ; >>plot(x,y,'-.b'); >>hold on >>plot(x,z,'-r'); Let us plot a 3D graph of z = cos(xy)+cos(x) >>figure(1) >> x = 0:0.1:2; >> y = 0:0.2:4; >> [X,Y] = meshgrid(x,y); >> Z = cos(x.*y) + cos(x); >>surf(x,y,z); >> View(30,65) >>title(' 3D Surface'); >>figure(2); >>pcolor(x,y,z); >>figure(3) >>contour(x,y,z,10); In order to create 4 plots in one figure. use >>subplot(2,2,1) %(to plot in the upper-left plot) >>subplot(2,2,2) %(to plot in the upper-right plot) >>subplot(2,2,3) %(to plot in the lower-left plot) >>subplot(2,2,4) %(to plot in the lower-right plot) On the figure window you may (i) left click on File menu and export your image as eps, tiff,. (ii) left click on theleft arrow and then on the plot and a window will appear where you can ajust the axes marks, labels, color and type of the plot. (iii) left click ona and left click on the plot to add text to your plot 6

7 4 Matrices >> A = [ 2 3 ; -7 9 ] A = >> C = [ 8 9 ; ] C = >> B = A + C B = >> D = A*B D = >> det(a) 39 >> inv(a) Matrix functions 7

8 det(a) A' eig(a) lu(a) qr(a) A n f norm(a,p) size(a) sparse full(as) hess(a) cond(a,p) luinc(a) trace(a) svd(a) ones(n,m) zeros(n,m) eye(n) spy(a) speye spdiag gmres(a,f) qmr(a,f) cgs(a,f) For more help determinant transpose of A eigenvalues of A lu factorization QR factorization solve Ax=f norm of A,in L p ; p =1; 2; inf, orfro: gives the number of rows and columns define a sparse matrix transform matrix from sparse format to full compute the Hessenberg form p =1; 2; inf; fro: computes the condition number incomplete lu factorization trace of A singular value decomposition an n m matrix containing all ones an n m matrix containing all zeros an n n identity matrix shows the sparse structure sparse identity matrix sparse diagonal matrix use gmres to solve Ax=f use qmr to solve Ax=f Preconditioned conjugate gradient 5 Programming in Matlab Relational Operators < less than <= less or equal > greater than >= greater or equal == equal!= not equal to Logical Operators & j e and or not Control Flow 8

9 One may write a set of instructions and save them in one file with extension :m Example of a script to illustrate the use of if if (a > 2) & a ( a < 11) else z = cos(a)^2; z = exp(a); A script that uses while i=1; while ( i < 14) x(i) = cos(pi*i/13); i = i+1; The following script computes the zero of your machine function epsilon = machinezero epsilon = 1; while (1+epsilon)> 1 epsilon = epsilon; epsilon = 2*epsilon Passing functions as arguments to other functions Consider the file mysum.m which contains the following function function S = mysum(x,y,myfun) S = feval(myfun,x) + feval(myfun,y); you would call it as >> x = 12; >>y=-13.8; >> d = mysum(x,y,'sin'); Timing your code: To time you code or parts of it you may use the cputime command as illustrated in the following example 9

10 >> t0 = cputime; >> x=12; >> y=13; >> s = mysum(x,y,'sin'); >>t1 = cputime >> cpu_time = t1-t0; One line help may be obtained by typing at the matlab prompt >>help or >> help norm %(to get help on norm) >>help lu % (help on how to use lu function) >>help format %(help on format) You may also check the online manual at 6 Solvin nonlinear algebraic equations The bisection method Let f be a continuous function on [a; b] such that f(a)f (b) < 0. Then there exists at least one root x Λ 2 (a; b) such that f(x Λ )=0. The bisection method consists in computing c = a+b, if the f(a)f(c) < 0 the 2 next interval will be [a; c], otherwise we use the interval [c; b]. We continue this process until we reach aninterval whose length and/or jf(c)j is less than a prescribed tolerance. function [a,b]=bisection(a1,b1,fun,eps,nmax) %This function uses the bisection method to approximate %roots of f(x)=0 %input: %[a1,b1] interval that contains a root %fun: the function f %eps: tolerance %nmax: maximum number of iterations allowed %output: [a,b] a final interval containing the root % fp1 = feval(fun,a1); fp2 = feval(fun,b1); if(fp1*fp2 > 0) % display(' This function might not have a root in this interval'); iter = 1; while (b1-a1) > eps & (iter <= nmax) 10

11 a=a1; b=b1; p = (a1+b1)/2; fp = feval(fun,p); if (fp*fp1 <0) else b1 = p; fp2 = fp; a1 = p; fp1 = fp; iter = iter +1; Advantages: 1- one function evaluation per iteration 2- converges to a root for all [a; b] such that f(a)f(b) < 0 Disadvantages: Linear convergence Newton-Raphson method We assume f 2 C 2, select an initial guess x 0 and approxmiate f with the tangent line to f at x 0 as f(x) ß f 0 (x 0 )(x x 0 )+f(x 0 )= ~ f(x) and solve ~ f 0 (x) = 0 to define x 1 x 1 = x 0 f(x 0) f 0 (x 0 ) We continue this process from x 1 to get x 2 as follows x n = x n 1 f(x n 1) f 0 (x n 1) ;n 1 Advantages: Quadratic convergence, i.e., jx n x Λ j lim n!1 jx n 1 x Λ = j ratio > o 2 Disadvantages: Newton method requires 1. the initial x 0 to be close enough to x Λ for convergence 2. two function evaluations per iteration 3. both f and f 0 11

12 function [x1,iter,fail] = newton(x0,tol,nmax,f,fd) %This routine find a root of f starting from %the initial guess x0 % %input parameters %f function f %fd derivative of f %x0: initial guess %tol: tolerance %Nmax: maximum number of iterations allowed % err = 10; iter = 0; while (i<= Nmax) & (abs(err) > tol) err = feval(f,x0)/feval(fd,x0); x1 = x0 - err; if (abs(err) < tol) & (iter ==Nmax) fail = 1; x0=x1; iter = iter + 1; 25 Newton s method 20 x 2 4 x + 1 = x 0 0 x 0 = 2.5 x 1 x 2 x 2 x Figure 1: Geometric illustration of Newton method for x 2 4x+1 = 0, x 0 = 2:5 12

13 Results for Newton's method applied to x^2-4 *x + 1 =0, with x0 = 0 and x0=5 n x_n f(x_n) x_n - ( 2 -sqrt(3)) e e e e e e e e e e e e e-16 n x_n f(x_n ) x_n -- ( 2 +sqrt(3)) e e e e e e e e e e e e e e e e Secant Method In order to avoid the use of derivative f 0 we use the secant method which consists in approximating f by a linear function ~ f that passes through two points (x 0 ;f(x 0 ) and (x 1 ;f(x 1 )) as f(x) ß f(x 1) f(x 0 ) (x x 0 )+f(x 0 )= f(x) ~ x 1 x 0 We solve ~ f(x) = 0 to obtain x 2 as In general we have x n+1 = x n x 2 = x 1 Advantages: 1. One function evaluation per iteration 2. Derivative is not required 3. Superlinear convergence x 1 x 0 f(x 1 ) f(x 0 ) f(x 0) x n x n 1 f(x n ) f(x n 1) f(x n 1); n 1: jx n x Λ j lim n!1 jx n 1 x Λ = ratio > o j1:6 function [p,iter]=secant(a1,b1,fun,eps,nmax) %This function computes approximation to roots of f(x)=0 %using the secant method %input: %a1,a2 are two intial guesses %fun : function f 13

14 %eps : tolerance %nmax: maximum number of iterations %output: %p : approximation to the root of f(x)=0 % fp1 = feval(fun,a1); % iter = 1; while abs(b1-a1) > eps & (iter <= nmax) fp2 = feval(fun,b1); p= a1 - fp1*(b1 -a1)/(fp2-fp1); a1 = b1; fp1 = fp2; b1 = p ; iter = iter +1; [a1,b1,abs(b1-a1),iter] 25 Secant method 20 for x 2 4x + 1 = 0 x 0 = 2 x 1 = x 2 x 1 x 4 0 x 0 x Figure 2: Geometric illustration of the secant method for x 2 4x +1 = 0, x 0 = 2 and x 1 =3. Results for the secant method applied to x^2-4x +1 =0, with x0 = -2, x1 = 3 14

15 n x_n x_n - (2+sqrt(3)) ratio e e e e e e e e e e e e e e e e e e e e e e e e e e e e e

Note: The command name is upper case in the description given by help, but must be lower case in actual use. And the backslash Anb is dierent when A i

Note: The command name is upper case in the description given by help, but must be lower case in actual use. And the backslash Anb is dierent when A i MATLAB Tutorial You need a small number of basic commands to start using MATLAB. This short tutorial describes those fundamental commands. You need to create vectors and matrices, to change them, and to

More information

(Mathematical Operations with Arrays) Applied Linear Algebra in Geoscience Using MATLAB

(Mathematical Operations with Arrays) Applied Linear Algebra in Geoscience Using MATLAB Applied Linear Algebra in Geoscience Using MATLAB (Mathematical Operations with Arrays) Contents Getting Started Matrices Creating Arrays Linear equations Mathematical Operations with Arrays Using Script

More information

Math Numerical Analysis

Math Numerical Analysis Math 541 - Numerical Analysis Lecture Notes Zeros and Roots Joseph M. Mahaffy, jmahaffy@mail.sdsu.edu Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research Center

More information

Outline. Math Numerical Analysis. Intermediate Value Theorem. Lecture Notes Zeros and Roots. Joseph M. Mahaffy,

Outline. Math Numerical Analysis. Intermediate Value Theorem. Lecture Notes Zeros and Roots. Joseph M. Mahaffy, Outline Math 541 - Numerical Analysis Lecture Notes Zeros and Roots Joseph M. Mahaffy, jmahaffy@mail.sdsu.edu Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research

More information

Matlab for Review. NDSU Matlab Review pg 1

Matlab for Review. NDSU Matlab Review pg 1 NDSU Matlab Review pg 1 Becoming familiar with MATLAB The console The editor The graphics windows The help menu Saving your data (diary) General environment and the console Matlab for Review Simple numerical

More information

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB, Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB, Part I: Basics MATLAB Environment Getting Help Variables Vectors, Matrices, and

More information

Solution of Algebric & Transcendental Equations

Solution of Algebric & Transcendental Equations Page15 Solution of Algebric & Transcendental Equations Contents: o Introduction o Evaluation of Polynomials by Horner s Method o Methods of solving non linear equations o Bracketing Methods o Bisection

More information

Numerical Methods Lecture 3

Numerical Methods Lecture 3 Numerical Methods Lecture 3 Nonlinear Equations by Pavel Ludvík Introduction Definition (Root or zero of a function) A root (or a zero) of a function f is a solution of an equation f (x) = 0. We learn

More information

Further Pure Mathematics 3 GCE Further Mathematics GCE Pure Mathematics and Further Mathematics (Additional) A2 optional unit

Further Pure Mathematics 3 GCE Further Mathematics GCE Pure Mathematics and Further Mathematics (Additional) A2 optional unit Unit FP3 Further Pure Mathematics 3 GCE Further Mathematics GCE Pure Mathematics and Further Mathematics (Additional) A optional unit FP3.1 Unit description Further matrix algebra; vectors, hyperbolic

More information

Computational Foundations of Cognitive Science

Computational Foundations of Cognitive Science Computational Foundations of Cognitive Science Lecture 14: Inverses and Eigenvectors in Matlab; Plotting and Graphics Frank Keller School of Informatics University of Edinburgh keller@inf.ed.ac.uk February

More information

Identity Matrix: EDU> eye(3) ans = Matrix of Ones: EDU> ones(2,3) ans =

Identity Matrix: EDU> eye(3) ans = Matrix of Ones: EDU> ones(2,3) ans = Very Basic MATLAB Peter J. Olver October, 2003 Matrices: Type your matrix as follows: Use, or space to separate entries, and ; or return after each row. EDU> [;5 0-3 6;; - 5 ] or EDU> [,5,6,-9;5,0,-3,6;7,8,5,0;-,,5,]

More information

Notes for Numerical Analysis Math 5465 by S. Adjerid Virginia Polytechnic Institute and State University. (A Rough Draft)

Notes for Numerical Analysis Math 5465 by S. Adjerid Virginia Polytechnic Institute and State University. (A Rough Draft) Notes for Numerical Analysis Math 5465 by S. Adjerid Virginia Polytechnic Institute and State University (A Rough Draft) 1 2 Contents 1 Error Analysis 5 2 Nonlinear Algebraic Equations 7 2.1 Convergence

More information

MATH.2720 Introduction to Programming with MATLAB Vector and Matrix Algebra

MATH.2720 Introduction to Programming with MATLAB Vector and Matrix Algebra MATH.2720 Introduction to Programming with MATLAB Vector and Matrix Algebra A. Vectors A vector is a quantity that has both magnitude and direction, like velocity. The location of a vector is irrelevant;

More information

Matlab Section. November 8, 2005

Matlab Section. November 8, 2005 Matlab Section November 8, 2005 1 1 General commands Clear all variables from memory : clear all Close all figure windows : close all Save a variable in.mat format : save filename name of variable Load

More information

Linear Algebra Using MATLAB

Linear Algebra Using MATLAB Linear Algebra Using MATLAB MATH 5331 1 May 12, 2010 1 Selected material from the text Linear Algebra and Differential Equations Using MATLAB by Martin Golubitsky and Michael Dellnitz Contents 1 Preliminaries

More information

Math Introduction to Numerical Methods - Winter 2011 Homework 2 Assigned: Friday, January 14, Due: Thursday, January 27,

Math Introduction to Numerical Methods - Winter 2011 Homework 2 Assigned: Friday, January 14, Due: Thursday, January 27, Math 371 - Introduction to Numerical Methods - Winter 2011 Homework 2 Assigned: Friday, January 14, 2011. Due: Thursday, January 27, 2011.. Include a cover page. You do not need to hand in a problem sheet.

More information

Revision Checklist. Unit FP3: Further Pure Mathematics 3. Assessment information

Revision Checklist. Unit FP3: Further Pure Mathematics 3. Assessment information Revision Checklist Unit FP3: Further Pure Mathematics 3 Unit description Further matrix algebra; vectors, hyperbolic functions; differentiation; integration, further coordinate systems Assessment information

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Macroeconomics Vivaldo Mendes Dep. Economics Instituto Universitário de Lisboa September 2017 (Vivaldo Mendes ISCTE-IUL ) Macroeconomics September 2013 1 / 41 Summary 1 Introduction

More information

Introduction to Matlab

Introduction to Matlab History of Matlab Starting Matlab Matrix operation Introduction to Matlab Useful commands in linear algebra Scripts-M file Use Matlab to explore the notion of span and the geometry of eigenvalues and eigenvectors.

More information

Homework and Computer Problems for Math*2130 (W17).

Homework and Computer Problems for Math*2130 (W17). Homework and Computer Problems for Math*2130 (W17). MARCUS R. GARVIE 1 December 21, 2016 1 Department of Mathematics & Statistics, University of Guelph NOTES: These questions are a bare minimum. You should

More information

MAE 107 Homework 8 Solutions

MAE 107 Homework 8 Solutions MAE 107 Homework 8 Solutions 1. Newton s method to solve 3exp( x) = 2x starting at x 0 = 11. With chosen f(x), indicate x n, f(x n ), and f (x n ) at each step stopping at the first n such that f(x n )

More information

Students should read Sections of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

Students should read Sections of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section. Chapter 3 Differentiation ü 3.1 The Derivative Students should read Sections 3.1-3.5 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section. ü 3.1.1 Slope of Tangent

More information

Laboratory handout 1 Mathematical preliminaries

Laboratory handout 1 Mathematical preliminaries laboratory handouts, me 340 2 Laboratory handout 1 Mathematical preliminaries In this handout, an expression on the left of the symbol := is defined in terms of the expression on the right. In contrast,

More information

MATH 3795 Lecture 12. Numerical Solution of Nonlinear Equations.

MATH 3795 Lecture 12. Numerical Solution of Nonlinear Equations. MATH 3795 Lecture 12. Numerical Solution of Nonlinear Equations. Dmitriy Leykekhman Fall 2008 Goals Learn about different methods for the solution of f(x) = 0, their advantages and disadvantages. Convergence

More information

1 Number Systems and Errors 1

1 Number Systems and Errors 1 Contents 1 Number Systems and Errors 1 1.1 Introduction................................ 1 1.2 Number Representation and Base of Numbers............. 1 1.2.1 Normalized Floating-point Representation...........

More information

PART I Lecture Notes on Numerical Solution of Root Finding Problems MATH 435

PART I Lecture Notes on Numerical Solution of Root Finding Problems MATH 435 PART I Lecture Notes on Numerical Solution of Root Finding Problems MATH 435 Professor Biswa Nath Datta Department of Mathematical Sciences Northern Illinois University DeKalb, IL. 60115 USA E mail: dattab@math.niu.edu

More information

Optimization and Calculus

Optimization and Calculus Optimization and Calculus To begin, there is a close relationship between finding the roots to a function and optimizing a function. In the former case, we solve for x. In the latter, we solve: g(x) =

More information

Homework 2. Matthew Jin. April 10, 2014

Homework 2. Matthew Jin. April 10, 2014 Homework Matthew Jin April 10, 014 1a) The relative error is given by ŷ y y, where ŷ represents the observed output value, and y represents the theoretical output value. In this case, the observed output

More information

Tu: 9/3/13 Math 471, Fall 2013, Section 001 Lecture 1

Tu: 9/3/13 Math 471, Fall 2013, Section 001 Lecture 1 Tu: 9/3/13 Math 71, Fall 2013, Section 001 Lecture 1 1 Course intro Notes : Take attendance. Instructor introduction. Handout : Course description. Note the exam days (and don t be absent). Bookmark the

More information

Outline. Scientific Computing: An Introductory Survey. Nonlinear Equations. Nonlinear Equations. Examples: Nonlinear Equations

Outline. Scientific Computing: An Introductory Survey. Nonlinear Equations. Nonlinear Equations. Examples: Nonlinear Equations Methods for Systems of Methods for Systems of Outline Scientific Computing: An Introductory Survey Chapter 5 1 Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign

More information

3.1 Introduction. Solve non-linear real equation f(x) = 0 for real root or zero x. E.g. x x 1.5 =0, tan x x =0.

3.1 Introduction. Solve non-linear real equation f(x) = 0 for real root or zero x. E.g. x x 1.5 =0, tan x x =0. 3.1 Introduction Solve non-linear real equation f(x) = 0 for real root or zero x. E.g. x 3 +1.5x 1.5 =0, tan x x =0. Practical existence test for roots: by intermediate value theorem, f C[a, b] & f(a)f(b)

More information

University of Delaware Department of Mathematical Sciences Math 353 Engineering Mathematics III 06S C. Bacuta

University of Delaware Department of Mathematical Sciences Math 353 Engineering Mathematics III 06S C. Bacuta University of Delaware Department of Mathematical Sciences Math 353 Engineering Mathematics III 06S C. Bacuta Homework 4: Due Friday, 0/4/06, 10:00am Part I) (1) Section., Problems #3(a,d), 9, 11. () Apply

More information

2D Plotting with Matlab

2D Plotting with Matlab GEEN 1300 Introduction to Engineering Computing Class Meeting #22 Monday, Nov. 9 th Engineering Computing and Problem Solving with Matlab 2-D plotting with Matlab Script files User-defined functions Matlab

More information

1. Method 1: bisection. The bisection methods starts from two points a 0 and b 0 such that

1. Method 1: bisection. The bisection methods starts from two points a 0 and b 0 such that Chapter 4 Nonlinear equations 4.1 Root finding Consider the problem of solving any nonlinear relation g(x) = h(x) in the real variable x. We rephrase this problem as one of finding the zero (root) of a

More information

Topic Outline for Algebra 2 & and Trigonometry One Year Program

Topic Outline for Algebra 2 & and Trigonometry One Year Program Topic Outline for Algebra 2 & and Trigonometry One Year Program Algebra 2 & and Trigonometry - N - Semester 1 1. Rational Expressions 17 Days A. Factoring A2.A.7 B. Rationals A2.N.3 A2.A.17 A2.A.16 A2.A.23

More information

New Mexico Tech Hyd 510

New Mexico Tech Hyd 510 Vectors vector - has magnitude and direction (e.g. velocity, specific discharge, hydraulic gradient) scalar - has magnitude only (e.g. porosity, specific yield, storage coefficient) unit vector - a unit

More information

CS 450 Numerical Analysis. Chapter 5: Nonlinear Equations

CS 450 Numerical Analysis. Chapter 5: Nonlinear Equations Lecture slides based on the textbook Scientific Computing: An Introductory Survey by Michael T. Heath, copyright c 2018 by the Society for Industrial and Applied Mathematics. http://www.siam.org/books/cl80

More information

1 Solutions to selected problems

1 Solutions to selected problems Solutions to selected problems Section., #a,c,d. a. p x = n for i = n : 0 p x = xp x + i end b. z = x, y = x for i = : n y = y + x i z = zy end c. y = (t x ), p t = a for i = : n y = y(t x i ) p t = p

More information

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 5. Nonlinear Equations

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 5. Nonlinear Equations Lecture Notes to Accompany Scientific Computing An Introductory Survey Second Edition by Michael T Heath Chapter 5 Nonlinear Equations Copyright c 2001 Reproduction permitted only for noncommercial, educational

More information

THE SECANT METHOD. q(x) = a 0 + a 1 x. with

THE SECANT METHOD. q(x) = a 0 + a 1 x. with THE SECANT METHOD Newton s method was based on using the line tangent to the curve of y = f (x), with the point of tangency (x 0, f (x 0 )). When x 0 α, the graph of the tangent line is approximately the

More information

Exponential of a nonnormal matrix

Exponential of a nonnormal matrix Exponential of a nonnormal matrix Mario Berljafa Stefan Güttel February 2015 Contents 1 Introduction 1 2 Running RKFIT with real data 1 3 Evaluating the rational approximant 3 4 Some other choices for

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 3 Chapter 10 LU Factorization PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

More information

CHEE 222: PROCESS DYNAMICS AND NUMERICAL METHODS

CHEE 222: PROCESS DYNAMICS AND NUMERICAL METHODS CHEE 222: PROCESS DYNAMICS AND NUMERICAL METHODS Winter 2017 Implementation of Numerical Methods via MATLAB Instructor: Xiang Li 1 Outline 1. Introduction - Command, script and function - MATLAB function

More information

Linear Algebra and Matrices

Linear Algebra and Matrices Linear Algebra and Matrices 4 Overview In this chapter we studying true matrix operations, not element operations as was done in earlier chapters. Working with MAT- LAB functions should now be fairly routine.

More information

Math 471. Numerical methods Root-finding algorithms for nonlinear equations

Math 471. Numerical methods Root-finding algorithms for nonlinear equations Math 471. Numerical methods Root-finding algorithms for nonlinear equations overlap Section.1.5 of Bradie Our goal in this chapter is to find the root(s) for f(x) = 0..1 Bisection Method Intermediate value

More information

EEE161 Applied Electromagnetics Laboratory 1

EEE161 Applied Electromagnetics Laboratory 1 Dr. Milica Marković Applied Electromagnetics Laboratory page 1 EEE161 Applied Electromagnetics Laboratory 1 Instructor: Dr. Milica Marković Office: Riverside Hall 3028 Email: milica@csus.edu Web:http://gaia.ecs.csus.edu/

More information

Math 504 (Fall 2011) 1. (*) Consider the matrices

Math 504 (Fall 2011) 1. (*) Consider the matrices Math 504 (Fall 2011) Instructor: Emre Mengi Study Guide for Weeks 11-14 This homework concerns the following topics. Basic definitions and facts about eigenvalues and eigenvectors (Trefethen&Bau, Lecture

More information

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9 TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1 Chapter 01.01 Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9 Chapter 01.02 Measuring errors 11 True error 11 Relative

More information

Regent College Maths Department. Further Pure 1 Numerical Solutions of Equations

Regent College Maths Department. Further Pure 1 Numerical Solutions of Equations Regent College Maths Department Further Pure 1 Numerical Solutions of Equations Further Pure 1 Numerical Solutions of Equations You should: Be able use interval bisection, linear interpolation and the

More information

INTRODUCTION TO NUMERICAL ANALYSIS

INTRODUCTION TO NUMERICAL ANALYSIS INTRODUCTION TO NUMERICAL ANALYSIS Cho, Hyoung Kyu Department of Nuclear Engineering Seoul National University 3. SOLVING NONLINEAR EQUATIONS 3.1 Background 3.2 Estimation of errors in numerical solutions

More information

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB Applied Linear Algebra in Geoscience Using MATLAB (Linear equations) Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional Plots

More information

, b = 0. (2) 1 2 The eigenvectors of A corresponding to the eigenvalues λ 1 = 1, λ 2 = 3 are

, b = 0. (2) 1 2 The eigenvectors of A corresponding to the eigenvalues λ 1 = 1, λ 2 = 3 are Quadratic forms We consider the quadratic function f : R 2 R defined by f(x) = 2 xt Ax b T x with x = (x, x 2 ) T, () where A R 2 2 is symmetric and b R 2. We will see that, depending on the eigenvalues

More information

Introduction to Applied Linear Algebra with MATLAB

Introduction to Applied Linear Algebra with MATLAB Sigam Series in Applied Mathematics Volume 7 Rizwan Butt Introduction to Applied Linear Algebra with MATLAB Heldermann Verlag Contents Number Systems and Errors 1 1.1 Introduction 1 1.2 Number Representation

More information

Lecture 44. Better and successive approximations x2, x3,, xn to the root are obtained from

Lecture 44. Better and successive approximations x2, x3,, xn to the root are obtained from Lecture 44 Solution of Non-Linear Equations Regula-Falsi Method Method of iteration Newton - Raphson Method Muller s Method Graeffe s Root Squaring Method Newton -Raphson Method An approximation to the

More information

Core A-level mathematics reproduced from the QCA s Subject criteria for Mathematics document

Core A-level mathematics reproduced from the QCA s Subject criteria for Mathematics document Core A-level mathematics reproduced from the QCA s Subject criteria for Mathematics document Background knowledge: (a) The arithmetic of integers (including HCFs and LCMs), of fractions, and of real numbers.

More information

Motivation: We have already seen an example of a system of nonlinear equations when we studied Gaussian integration (p.8 of integration notes)

Motivation: We have already seen an example of a system of nonlinear equations when we studied Gaussian integration (p.8 of integration notes) AMSC/CMSC 460 Computational Methods, Fall 2007 UNIT 5: Nonlinear Equations Dianne P. O Leary c 2001, 2002, 2007 Solving Nonlinear Equations and Optimization Problems Read Chapter 8. Skip Section 8.1.1.

More information

NATIONAL BOARD FOR HIGHER MATHEMATICS. M. A. and M.Sc. Scholarship Test. September 22, Time Allowed: 150 Minutes Maximum Marks: 30

NATIONAL BOARD FOR HIGHER MATHEMATICS. M. A. and M.Sc. Scholarship Test. September 22, Time Allowed: 150 Minutes Maximum Marks: 30 NATIONAL BOARD FOR HIGHER MATHEMATICS M. A. and M.Sc. Scholarship Test September 22, 2012 Time Allowed: 150 Minutes Maximum Marks: 30 Please read, carefully, the instructions on the following page 1 INSTRUCTIONS

More information

We wish to solve a system of N simultaneous linear algebraic equations for the N unknowns x 1, x 2,...,x N, that are expressed in the general form

We wish to solve a system of N simultaneous linear algebraic equations for the N unknowns x 1, x 2,...,x N, that are expressed in the general form Linear algebra This chapter discusses the solution of sets of linear algebraic equations and defines basic vector/matrix operations The focus is upon elimination methods such as Gaussian elimination, and

More information

SECTION A. f(x) = ln(x). Sketch the graph of y = f(x), indicating the coordinates of any points where the graph crosses the axes.

SECTION A. f(x) = ln(x). Sketch the graph of y = f(x), indicating the coordinates of any points where the graph crosses the axes. SECTION A 1. State the maximal domain and range of the function f(x) = ln(x). Sketch the graph of y = f(x), indicating the coordinates of any points where the graph crosses the axes. 2. By evaluating f(0),

More information

PHYS 410/555 Computational Physics Solution of Non Linear Equations (a.k.a. Root Finding) (Reference Numerical Recipes, 9.0, 9.1, 9.

PHYS 410/555 Computational Physics Solution of Non Linear Equations (a.k.a. Root Finding) (Reference Numerical Recipes, 9.0, 9.1, 9. PHYS 410/555 Computational Physics Solution of Non Linear Equations (a.k.a. Root Finding) (Reference Numerical Recipes, 9.0, 9.1, 9.4) We will consider two cases 1. f(x) = 0 1-dimensional 2. f(x) = 0 d-dimensional

More information

Linear Algebra Review. Vectors

Linear Algebra Review. Vectors Linear Algebra Review 9/4/7 Linear Algebra Review By Tim K. Marks UCSD Borrows heavily from: Jana Kosecka http://cs.gmu.edu/~kosecka/cs682.html Virginia de Sa (UCSD) Cogsci 8F Linear Algebra review Vectors

More information

Classes 6. Scilab: Symbolic and numerical calculations

Classes 6. Scilab: Symbolic and numerical calculations Classes 6. Scilab: Symbolic and numerical calculations Note: When copying and pasting, you need to delete pasted single quotation marks and type them manually for each occurrence. 6.1 Creating polynomials

More information

QR Decomposition. When solving an overdetermined system by projection (or a least squares solution) often the following method is used:

QR Decomposition. When solving an overdetermined system by projection (or a least squares solution) often the following method is used: (In practice not Gram-Schmidt, but another process Householder Transformations are used.) QR Decomposition When solving an overdetermined system by projection (or a least squares solution) often the following

More information

Quiz ) Locate your 1 st order neighbors. 1) Simplify. Name Hometown. Name Hometown. Name Hometown.

Quiz ) Locate your 1 st order neighbors. 1) Simplify. Name Hometown. Name Hometown. Name Hometown. Quiz 1) Simplify 9999 999 9999 998 9999 998 2) Locate your 1 st order neighbors Name Hometown Me Name Hometown Name Hometown Name Hometown Solving Linear Algebraic Equa3ons Basic Concepts Here only real

More information

MATLAB crash course 1 / 27. MATLAB crash course. Cesar E. Tamayo Economics - Rutgers. September 27th, /27

MATLAB crash course 1 / 27. MATLAB crash course. Cesar E. Tamayo Economics - Rutgers. September 27th, /27 1/27 MATLAB crash course 1 / 27 MATLAB crash course Cesar E. Tamayo Economics - Rutgers September 27th, 2013 2/27 MATLAB crash course 2 / 27 Program Program I Interface: layout, menus, help, etc.. I Vectors

More information

NUMERICAL METHODS USING MATLAB

NUMERICAL METHODS USING MATLAB NUMERICAL METHODS USING MATLAB Dr John Penny George Lindfield Department of Mechanical Engineering, Aston University ELLIS HORWOOD NEW YORK LONDON TORONTO SYDNEY TOKYO SINGAPORE Preface 1 An introduction

More information

Scientific Computing: An Introductory Survey

Scientific Computing: An Introductory Survey Scientific Computing: An Introductory Survey Chapter 5 Nonlinear Equations Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction

More information

Applied Linear Algebra in Geoscience Using MATLAB

Applied Linear Algebra in Geoscience Using MATLAB Applied Linear Algebra in Geoscience Using MATLAB Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional Plots Programming in

More information

PURE MATHEMATICS AM 27

PURE MATHEMATICS AM 27 AM Syllabus (014): Pure Mathematics AM SYLLABUS (014) PURE MATHEMATICS AM 7 SYLLABUS 1 AM Syllabus (014): Pure Mathematics Pure Mathematics AM 7 Syllabus (Available in September) Paper I(3hrs)+Paper II(3hrs)

More information

MATH 3795 Lecture 13. Numerical Solution of Nonlinear Equations in R N.

MATH 3795 Lecture 13. Numerical Solution of Nonlinear Equations in R N. MATH 3795 Lecture 13. Numerical Solution of Nonlinear Equations in R N. Dmitriy Leykekhman Fall 2008 Goals Learn about different methods for the solution of F (x) = 0, their advantages and disadvantages.

More information

Calculus: Early Transcendental Functions Lecture Notes for Calculus 101. Feras Awad Mahmoud

Calculus: Early Transcendental Functions Lecture Notes for Calculus 101. Feras Awad Mahmoud Calculus: Early Transcendental Functions Lecture Notes for Calculus 101 Feras Awad Mahmoud Last Updated: August 2, 2012 1 2 Feras Awad Mahmoud Department of Basic Sciences Philadelphia University JORDAN

More information

ENGR Spring Exam 2

ENGR Spring Exam 2 ENGR 1300 Spring 013 Exam INSTRUCTIONS: Duration: 60 minutes Keep your eyes on your own work! Keep your work covered at all times! 1. Each student is responsible for following directions. Read carefully..

More information

High School Mathematics Honors PreCalculus

High School Mathematics Honors PreCalculus High School Mathematics Honors PreCalculus This is an accelerated course designed for the motivated math students with an above average interest in mathematics. It will cover all topics presented in Precalculus.

More information

JUST THE MATHS UNIT NUMBER DIFFERENTIATION APPLICATIONS 5 (Maclaurin s and Taylor s series) A.J.Hobson

JUST THE MATHS UNIT NUMBER DIFFERENTIATION APPLICATIONS 5 (Maclaurin s and Taylor s series) A.J.Hobson JUST THE MATHS UNIT NUMBER.5 DIFFERENTIATION APPLICATIONS 5 (Maclaurin s and Taylor s series) by A.J.Hobson.5. Maclaurin s series.5. Standard series.5.3 Taylor s series.5.4 Exercises.5.5 Answers to exercises

More information

Chapter 4. Solution of Non-linear Equation. Module No. 1. Newton s Method to Solve Transcendental Equation

Chapter 4. Solution of Non-linear Equation. Module No. 1. Newton s Method to Solve Transcendental Equation Numerical Analysis by Dr. Anita Pal Assistant Professor Department of Mathematics National Institute of Technology Durgapur Durgapur-713209 email: anita.buie@gmail.com 1 . Chapter 4 Solution of Non-linear

More information

MA 8019: Numerical Analysis I Solution of Nonlinear Equations

MA 8019: Numerical Analysis I Solution of Nonlinear Equations MA 8019: Numerical Analysis I Solution of Nonlinear Equations Suh-Yuh Yang ( 楊肅煜 ) Department of Mathematics, National Central University Jhongli District, Taoyuan City 32001, Taiwan syyang@math.ncu.edu.tw

More information

Applied Linear Algebra in Geoscience Using MATLAB

Applied Linear Algebra in Geoscience Using MATLAB Applied Linear Algebra in Geoscience Using MATLAB Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional Plots Programming in

More information

+ MATRIX VARIABLES AND TWO DIMENSIONAL ARRAYS

+ MATRIX VARIABLES AND TWO DIMENSIONAL ARRAYS + MATRIX VARIABLES AND TWO DIMENSIONAL ARRAYS Matrices are organized rows and columns of numbers that mathematical operations can be performed on. MATLAB is organized around the rules of matrix operations.

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 7 Matrix Algebra Material from MATLAB for Engineers,

More information

Outline. Additional Nonlinear Systems. Abstract. Finding Equilibrium Points Numerically. Newton s Method

Outline. Additional Nonlinear Systems. Abstract. Finding Equilibrium Points Numerically. Newton s Method Outline Finding Equilibrium Points Numerically Additional Nonlinear Systems James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University June 13, 2017

More information

Part II Linear Algebra

Part II Linear Algebra Part II Linear Algebra c Copyright, Todd Young and Martin Mohlenkamp, Department of Mathematics, Ohio University, 2017 Lecture 8 Matrices and Matrix Operations in Matlab Matrix operations Recall how to

More information

Introduction Assignment

Introduction Assignment PRE-CALCULUS 11 Introduction Assignment Welcome to PREC 11! This assignment will help you review some topics from a previous math course and introduce you to some of the topics that you ll be studying

More information

Lösning: Tenta Numerical Analysis för D, L. FMN011,

Lösning: Tenta Numerical Analysis för D, L. FMN011, Lösning: Tenta Numerical Analysis för D, L. FMN011, 090527 This exam starts at 8:00 and ends at 12:00. To get a passing grade for the course you need 35 points in this exam and an accumulated total (this

More information

Year 11 Mathematics: Specialist Course Outline

Year 11 Mathematics: Specialist Course Outline MATHEMATICS LEARNING AREA Year 11 Mathematics: Specialist Course Outline Text: Mathematics Specialist Units 1 and 2 A.J. Unit/time Topic/syllabus entry Resources Assessment 1 Preliminary work. 2 Representing

More information

Linear Algebra in LabVIEW

Linear Algebra in LabVIEW University College of Southeast Norway Linear Algebra in LabVIEW Hans-Petter Halvorsen, 2016-10-31 http://home.hit.no/~hansha Preface This document explains the basic concepts of Linear Algebra and how

More information

Maths for Map Makers

Maths for Map Makers SUB Gottingen 7 210 050 861 99 A 2003 Maths for Map Makers by Arthur Allan Whittles Publishing Contents /v Chapter 1 Numbers and Calculation 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14

More information

Learning MATLAB by doing MATLAB

Learning MATLAB by doing MATLAB Learning MATLAB by doing MATLAB December 10, 2005 Just type in the following commands and watch the output. 1. Variables, Vectors, Matrices >a=7 a is interpreted as a scalar (or 1 1 matrix) >b=[1,2,3]

More information

Background Mathematics (2/2) 1. David Barber

Background Mathematics (2/2) 1. David Barber Background Mathematics (2/2) 1 David Barber University College London Modified by Samson Cheung (sccheung@ieee.org) 1 These slides accompany the book Bayesian Reasoning and Machine Learning. The book and

More information

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP

MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP MAT 275 Laboratory 4 MATLAB solvers for First-Order IVP In this laboratory session we will learn how to. Use MATLAB solvers for solving scalar IVP 2. Use MATLAB solvers for solving higher order ODEs and

More information

AMATH 301 Beginning Scientific Computing

AMATH 301 Beginning Scientific Computing AMATH 301 Beginning Scientific Computing J. Nathan Kutz January 5, 2005 Abstract This course is a survey of basic numerical methods and algorithms used for linear algebra, ordinary and partial differential

More information

AMSC/CMSC 466 Problem set 3

AMSC/CMSC 466 Problem set 3 AMSC/CMSC 466 Problem set 3 1. Problem 1 of KC, p180, parts (a), (b) and (c). Do part (a) by hand, with and without pivoting. Use MATLAB to check your answer. Use the command A\b to get the solution, and

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 7 Matrix Algebra Material from MATLAB for Engineers,

More information

Pre-Calculus and Trigonometry Capacity Matrix

Pre-Calculus and Trigonometry Capacity Matrix Review Polynomials A1.1.4 A1.2.5 Add, subtract, multiply and simplify polynomials and rational expressions Solve polynomial equations and equations involving rational expressions Review Chapter 1 and their

More information

Numerical solutions of nonlinear systems of equations

Numerical solutions of nonlinear systems of equations Numerical solutions of nonlinear systems of equations Tsung-Ming Huang Department of Mathematics National Taiwan Normal University, Taiwan E-mail: min@math.ntnu.edu.tw August 28, 2011 Outline 1 Fixed points

More information

Calculus : Summer Study Guide Mr. Kevin Braun Bishop Dunne Catholic School. Calculus Summer Math Study Guide

Calculus : Summer Study Guide Mr. Kevin Braun Bishop Dunne Catholic School. Calculus Summer Math Study Guide 1 Calculus 2018-2019: Summer Study Guide Mr. Kevin Braun (kbraun@bdcs.org) Bishop Dunne Catholic School Name: Calculus Summer Math Study Guide After you have practiced the skills on Khan Academy (list

More information

Math 348: Numerical Methods with application in finance and economics. Boualem Khouider University of Victoria

Math 348: Numerical Methods with application in finance and economics. Boualem Khouider University of Victoria Math 348: Numerical Methods with application in finance and economics Boualem Khouider University of Victoria Lecture notes: Last Updated September 2016 Contents 1 Basics of numerical analysis 10 1.1 Notion

More information

Lecture 7. Root finding I. 1 Introduction. 2 Graphical solution

Lecture 7. Root finding I. 1 Introduction. 2 Graphical solution 1 Introduction Lecture 7 Root finding I For our present purposes, root finding is the process of finding a real value of x which solves the equation f (x)=0. Since the equation g x =h x can be rewritten

More information

3. Array and Matrix Operations

3. Array and Matrix Operations 3. Array and Matrix Operations Almost anything you learned about in your linear algebra classmatlab has a command to do. Here is a brief summary of the most useful ones for physics. In MATLAB matrices

More information

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane. Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane c Sateesh R. Mane 2018 3 Lecture 3 3.1 General remarks March 4, 2018 This

More information

x 2 x n r n J(x + t(x x ))(x x )dt. For warming-up we start with methods for solving a single equation of one variable.

x 2 x n r n J(x + t(x x ))(x x )dt. For warming-up we start with methods for solving a single equation of one variable. Maria Cameron 1. Fixed point methods for solving nonlinear equations We address the problem of solving an equation of the form (1) r(x) = 0, where F (x) : R n R n is a vector-function. Eq. (1) can be written

More information