Prof. Dr.-Ing. A. Czylwik

Size: px
Start display at page:

Download "Prof. Dr.-Ing. A. Czylwik"

Transcription

1 Seminar to the lecture Computer-based Engineering Mathematics N T S Prof. Dr.-Ing. A. Czylwik Amanuel Geda, M.Sc. Room: BA 240, Tel:49(0) , geda@nts.uni-due.de Department of Communication Systems University of Duisburg-Essen

2 Contents 1 Introduction to Matlab What is Matlab? Expressions Variables Numbers Operators Functions Handling Matrices Entering Matrices and Addressing the Elements Generating Matrices Concatenation Deleting rows and columns Array Orientation Skalar-Array Mathematics Array-Array Mathematics Basic Plotting using Matlab Two-Dimensional Graphics Multiple plots on the same axis Line styles, markers and color Plotting rapidly changing mathematical functions Three-Dimensional graphics Curve plots Mesh and surface plots Multiple plots in a figure: subplot Functions Domain, Range and Symmetries

3 3.2 Transformation of Coordinates Normalization of Physical Quantities Local Minima and Maxima Poles and Zeros Curve fitting, interpolation and approximation of functions using Polynomials Polynomial curve fitting Polynomial interpolation Taylor series expansion Vectors and Matrices Creating Matrices Inverses and Determinants Vector Norms and the scalar product in Matlab Matlab functions that work on diagonals of a matrix Systems of Linear Equations Linear System, Coefficient Matrix, Augmented Matrix Solutions of Linear Systems: Existence and Uniqueness Numerical methods in Linear Algebra Matlab syntax and descriptions for LU- and Cholesky Factorizations Matlab solutions for Systems of Linear Equations Eigenvalues and Eigenvectors Eigenvalues, Eigenvectors MATLAB methods to determine eigenvalues and eigenvectors Linear independence of eigenvectors Orthonormal set, Symmetric matrices Diagonalization of a matrix, canonical form Cayley-Hamilton theorem Nonlinear Equations 73

4 8.1 Polynomial roots Solving real function using fzero Solving Equations using Symbolic Toolbox System of nonlinear equations Differentiation Polynomial derivatives Approximate derivative Symbolic derivative Integration Introduction to Numerical Integration Numerical integration using Matlab Symbolic Integration Ordinary Differential Equations Introduction Numerical methods to solve initial value problems (IVP) of ODEs Solving ODEs in Matlab Systems of First order ODEs Homogeneous Linear Systems of ODEs

5 1 Chapter 1 Introduction to Matlab 1.1 What is Matlab? Matlab 1 is a high-performance language for technical computing. It integrates computation, programming and visualisation in a user-friendly environment where problems and solutions are expressed in an easy-to-understand mathematical notation. Matlab is an interactive system whose basic data element is an array that does not require dimensioning. This allows the user to solve many technical computing problems, especially those with matrix and vektor operations, in less time than it would take to write a programm in a scalar noninteractive language such as C or Fortan. Matlab features a family of application-specific solutions which are called toolboxes. It is very important to most users of Matlab, that toolboxes allow to learn and apply specialized technology. These toolboxes are comprehensive collections of Matlab functions, so-called M-files, that extend the Matlab environment to solve particular classes of problems. Matlab is a matrix-based programming tool. Although matrices often need not to be dimensioned explicity, the user has always to look carefully for matrix dimensiones. If it is not defined otherwise, the standard matrix exhibits two dimensiones n x m. Column vectors an row vectors are represented consistently by n x 1 and 1 x n matrices, respectively. Matlab operations can be classified into the followng types of operations: arithmetic and logical operations, mathematical functions, graphical functons, and input/output operations In the following sections, individual elements of Matlab operations are explained in detail. 1 Matlab is a registered trademark of The MathWorks, Inc.

6 1.2 Expressions Like most other programming languages, Matlab provides mathematical expressions, but unlike most programming languages, these expressions involve entire matrices. The building blocks of expressions are Variables Numbers Operators Functiones Variables Matlab does not require any type declarations or dimension statements. When a new variable name is introduced, it automatically creates the variable and allocates the appropriate amount of memory. If the variable already exists, Matlab changes its contents and, if necessary, allocates new storage. For example >> books = 10 creates a 1-by-1 matrix named books and stores the value 10 in its single element. In the expression above, >> constitutes the Matlab prompt, where the commands can be entered. Variable names consist of a string, which start with a letter, followed by any number of letters, digits, or underscores. Matlab is case sensitive; it distinguishes between uppercase and lowercase letters. A and a are not the same variable. To view the matrix assigned to any variable, simply enter the variable name Numbers Matlab uses the conventional decimal notation. A decimal point and a leading plus or minus sign is optional. Scientific notation uses the letter e to specify a power-of-ten scale factor. Imaginary numbers use either i or j as a suffix. Some examples of legal numbers are: e e21 2i j 2e3i j Operators Expressions use familar arithmetic operators and precedence rules. Some examples are:

7 + Addition - Subtraction * Multiplication / Division Complex conjugate transpose ( ) Brackets to specify the evaluation order Functions Matlab provides a large number of standard elementary mathematical functions, including sin, sqrt, exp and abs. Taking the square root or logarithm of a negative number does not lead to an error; the appropriate komplex result is produced automatically. Matlab also provides a lot of advanced mathematical functions, including Bessel and Gamma functions. Most of these functions accept complex arguments. For a list of the elementary mathematical functions, type >> help elfun Some of the functions, like sqrt and sin are build-in. They are a fixed part of the Matlab core so they are very efficient. The drawback is that the computational details are not readily accessible. Other functions, like gamma, are implemented in so called M-files. You can see the code and even modify it if you want. 1.3 Handling Matrices Matlab was mainly designed to deal with matrices. In Matlab, a matrix is a rectangular array of numbers. So scalars can be interpreted to be 1-by-1 matrices and vektors are matrices with only one row or column. Matlab has other ways to store both numeric and nonnumeric data, but in the beginning of learning Matlab, it is usually best to think of everything as a matrix. The operations in Matlab are designed to be as natural as possible. Where other programming languages work only with single numbers, Matlab allows to work with entire matrices quickly and easily Entering Matrices and Addressing the Elements The elements of a matrix must be entered one-by-one in a list where the elements of a row must be separated with commas or blank spaces and the rows are divided by semicolons. The whole list must be surrounded with square brackets, e.g.: >> A = [1 2 3; 8 6 4; 3 6 9] After pressing " Enter" Matlab displays the numbers entered in the command line

8 >> A = Addressing an element of a matrix is also very easy. The n-th element of the m-th column in matrix A from above is A(n,m). So typing >> A(1,3) + A(2,1) + A(3,2) will compute the answer ans = 17 Thek-th to1-th elements of them-th ton-th columns can be addressed bya(k:1,m:n),e.g. >> A(2:3,1:2) ans = Further exaples: >> A(1,1:2) addresses the first two elements of the first row. ans = 1 2 >> A(:,2) addresses all elements of the second column. ans = Generating Matrices There are different ways to generate matrices. Assigning elements explicitly was presented in the paragraph above. To create a row vector with 101 equidistant values starting at 0 and ending by π, this method would be very tedious. So two other possibilities are shown below:

9 >> x = linspace(0, pi, 101) or >> x = (0:0.01:1)*pi In the first case, the Matlab function linspace is used to create x. The function s arguments are described by: linspace(first_value, last_value, number_of_values) with the default number_of_values = 100. In the second case, the colon notation (0:0.01:1) creates an array that starts at 0, increments by 0.01 and ends at 1. Afterwards each element in this array is multiplied by π to create the desired values in x. Both of these array creation forms are common in Matlab. While the colon notation form allws to specify the increment between data elements directly, but not the number of data elements, the Matlab function linspace allows to specify the number of data elements directly, but not the increment value between these data elements. The colon notation is very often used in Matlab therefore a closer look should be taken on it. (first_value:increment:last_value) creates an array starting at first_value, ending at last_value with an increment which can be negative as well, e.g. >> v = (10:-2:0) v = If the increment is 1, then its usage is optional: >> w = (5:10) w = Matlab also provides four functions that generate basic matrices: zeros, ones, rand and randn. These functions will be discussed in chapter Concatenation Concatenation is a process of joining small matrices to make bigger ones. In fact, the first matrix A was created by concatenating its individual elements. The pair of square brackets, [ ], is the concatenation operator. For an example, start with the 3-by-3 matrix A, and form

10 >> F = [A A+10; A*2 A*4]. The result is an 6-by-6 matrix, obtained by joining the four submatrices. F = Deleting rows and columns To delete rows or columns of a matrix, just use a pair of square brackets, e.g. >> A(2,:) = [] deletes the second row of A. A = It is not possible to delete a single element of a matrix, because afterwards it would not still be a matrix. (Exception: vectors, since here deleting an element is the same as deleting a row/column.) Array Orientation The orientation of an array can be changed with the Matlab transpose operator : >> a = 0:3 a = >> b = a b = Skalar-Array Mathematics Addition, subtraction, multiplication and division by a scalar apply the operation to all elements of the array:

11 >> c = [ ; ; ] c = >> 2*c-1 multiplies each element in c by two and subtracts one from each element of the result. ans = Array-Array Mathematics When two arrays have the same dimensions, which means that they have the same number of rows and columns, addition, subtraction, multiplication and division apply on an element-by-element basis in Matlab. >> d = [1 2 3; 4 5 6] d = >> e = [2 2 2; 3 3 3] e = >> f = d+e % adds d to e on an element-by-elenemt basis f = >> g = 2*d-e % multiplies d by two and subtracts e from the result g = Element-by-element multiplication an division work similary, but the notation is slightly different: >> h = d.*e h =

12 The element-by-element multiplication uses the dot multiplication symbol.*, the elementby-element array division uses either./ or.\ >> d./e ans = >> e.\d ans = In both cases, the elements of the array in front of the slash is divided by the elements of the array behind the slash. To compute a matrix multiplication only the asterisk * must be used, e.g. >> C = A * B Therefore the number of columns of A must be equal the number of rows of B. >> A = [1 2 3; 4 5 6] A = >> B = [1 2; 3 4; 5 6] B = >> C = A * B C =

13 9 Chapter 2 Basic Plotting using Matlab 2.1 Two-Dimensional Graphics Graphs (in 2-D) are drawn with the plot statement. In its simplest form, it takes a single vector argument y as in plot(y). In this case the elements of y are plotted against their indexes, e.g. plot(rand(1, 20)) plots 20 random numbers against the integers 1 to 20, joining successive points with straight lines. Straight-line graphs are drawn by giving the x and y coordinates of the end-points in two vectors. For example, to draw a line between the point with cartesian coordinates (0, 1) and (4, 3) use the statement plot([0 4], [1 3]) Exercise 1 Draw lines joining the following points: (0, 0), (1, 1), (2, 0), (1,-1) and (0, 0). If x and y are vectors of the same length, the command plot(x,y) opens a graphics window and draws the elements of y versus the elements of x. For example, x = -4 : 0.01 : 4 ; y = sin(x) ; plot(x, y) The vector x is a partition of the domain with mesh size 0.01, and y is a vector giving the values of sine at the nodes of this partition (recall that sin(x) operates entry-wise). When plotting a curve, the plot routine is actually connecting consecutive points induced by the partition with line segments. Thus, the mesh size should be chosen sufficiently small to render the appearance of a smooth curve.

14 Exercise 2 Plot y versus x for y = exp( x 2 ) and x varies from -10 to 10. Plot y versus t for y = sin(2πft), t varies from 0 to 1, for f = 2 and f = 5. Plot y versus t for y = cos(2πft), t varies from 0 to 1, for f = 2 and f = Multiple plots on the same axis The easiest way is simply to use hold to keep the current plot on the axes. All subsequent plots are added to the axes until hold is released, either with hold off, or just hold, which toggles the hold state. The second way is to use plot with multiple arguments, e.g. plot(x1, y1, x2, y2, x3, y3,... ) plots the (vector) pairs (x1, y1), (x2, y2), etc. The advantage of this method is that the vector pairs may have different lengths. MATLAB automatically selects a different color for each pair. For example, x = -2*pi : 0.01 : 2*pi ; plot(x,cos(x),x,sin(x)) %Equivalent to this command is: plot(x,cos(x)) hold on plot(x,sin(x), -r ) hold off Exercise 3 Draw x 2,x 3,x 4, exp( x 2 ) on the same figure using both methods as described above. Add legend using Matlab command legend( x^2,x^3,x^4,exp(-x^2) ) Line styles, markers and color Line styles, markers and colors may be selected for a graph with a string argument to plot, e.g. plot(x, y, -- ) joins the plotted points with dashed lines, whereas plot(x, y, o )

15 draws circles at the data points with no lines joining them. You can specify all three properties, e.g. plot(x,sin(x), x, cos(x), --mo ) plots sin (x) in the default style and color and cos (x) with circles joined with dashes in magenta. The available colors are denoted by the symbols c, m, y, k, r, g, b, w. You can have fun trying to figure out what they mean, or you can use help plot to see the full range of possible symbols Plotting rapidly changing mathematical functions In all the graphing examples so far, the x coordinates of the points plotted have been incremented uniformly, e.g. x = 0 : 0.01 : 4. If the function being plotted changes very rapidly in some places, this can be inefficient, and can even give a misleading graph. For example, x = 0.01:.001:.1; plot(x, sin(1./x)) MATLAB has a function called fplot which uses a more elegant approach. Whereas the above method evaluates sin(1/x) at equally spaced intervals, fplot evaluates it more frequently over regions where it changes more rapidly. Here is how to use it: fplot( sin(1/x),[ ]) % 1./x not needed! Exercise 4 Now draw the functions from exercise 3 using fplot. Try also using ezplot. For more information check the MATLAB help by typing at command window help ezplot. 2.2 Three-Dimensional graphics MATLAB s primary commands for creating three dimensional graphics of numericallydefined functions are plot3, mesh, surf, and surfl Curve plots Completely analogous to plot in two dimensions, the command plot3 produces curves in three-dimensional space. If x, y, and z are three vectors of the same size, then the command plot3(x,y,z) produces a perspective plot of the piecewise linear curve in threespace passing through the points whose coordinates are the respective elements of x, y, and z. These vectors are usually defined parametrically. For example,

16 t = 0.01 : 0.01 : 20*pi ; x = cos(t) ; y = sin(t) ; z = t.^3 ; plot3(x, y, z) %produces a helix that is compressed near the x-y plane Mesh and surface plots The mesh command draws three-dimensional wire mesh surface plots.similarly, threedimensional faceted surface plots are drawn with the command surf. The following MATLAB M-File generate a mexican hut using the mesh command. % Mexican hut as an example for 3D plot. [x y] = meshgrid (-8: 0.5 : 8) ; r = sqrt(x.^2 + y.^2) ; z = sin(r)./r ; mesh(x,y,z) title( Mexican hut ) Mexican hut The following script shows how to graph the function over the disk f(x,y) = x 1 + y 2 (2.1) (x 1) 2 + (y 3) 2 = 4 (2.2) % Example for 3D Plot from the book A Matlab comapanion for a multivariable calculus % by J. Cooper, University of Maryland % First make a meshgrid in r, theta coordinates r = linspace(0,2,21); theta = linspace(0, 2*pi, 41);

17 [R,TH] = meshgrid(r,theta) % Now convert into a curvilinear meshgrid in x,y % coordinates X = 1 + R.*cos(TH); Y = 3 + R.*sin(TH); Z = X-1 + Y.^2; surf(x,y,z) hold on % add the plane z = -5 with the curvilinear % meshgrid surf(x,y,-5+0*z) hold off Plot of f(x,y) = x 1 +y 2 over the disk (x 1) 2 + (y 3) 2 = z axis y axis x axis 2 3 Exercise 5 Plot a Gaussian probability density function f x,y (x,y) with zero mean and variance 1 within the range x [ 5, 5],y [ 5, 5] : f x,y (x,y) = 1 1 2π e 2 (x2 +y 2 ) Try out the commands mesh, surf and contour to plot the graph! Exercise 6 Plot the function (2.3) over the unit disk, centered at the origin. g(r,θ) = (r/2) sin(θ) + r 3 cos(3θ) (2.4) Multiple plots in a figure: subplot You can show a number of plots in the same figure window with the subplot function. The statement subplot(m,n,p) divides the figure window into m X n small sets of axes, and selects the p th set for the current plot (numbered by row from the left of the top row).

18 Exercise 7 Plot the function from Exercise 5 in four subplots using the commands mesh in subplot(2,2,1), surf in subplot(2,2,2), surfl in subplot(2,2,3) and contour in subplot(2,2,4). Give title to each plot as for instance title( Plot of Gaussian pdf using mesh )

19 15 Chapter 3 Functions This chapter analyzes important characteristics of functions using Matlab. 3.1 Domain, Range and Symmetries Consider the functions Exercise 1 f(x) = 1 x2 4 1 g(x) =. 1 x2 4 Draw on the same figure the functions f(x) and g(x) for 5 x 5 with distinct colors, markers and legends. Determine the domain, range and symmetry points of f(x) and g(x) so that these are real-valued. Name the x- and y-axis using the Matlab commands xlabel( x \rightarrow ) ; ylabel( f(x), g(x) \rightarrow ) 3.2 Transformation of Coordinates Consider the function g(x) drawn in the interval 5 x 5: clc; clear;close all x = -5 :.05 : 5 ; g_x = 1./ sqrt( abs(1-0.25*x.^2 ) ) ; plot( x, g_x, -r. ) hold on;

20 A simple coordinate transformation is obtained by shifting g(x) to g 2 (x) = g(x x 0 ). For x 0 = 1: x_0 = 1; g2_x = 1./ sqrt( abs(1 - (x-x_0).^2) ) ; g2_x = 1./ sqrt( abs(1 -.25*(x-x_0).^2) ) ; plot( x, g2_x, -g ) hold off; Coordinate transformation g(x) g(x 1) g(x), g 2 (x) x Exercise Draw on the same figure the coordinate transformation g 3 (x) = g(ax) for a = 2 (scaling of the x-axis). Draw on the same figure the coordinate transformation g 4 (x) = g(ax x 0 ) for a = 2 and x 0 = 1. Draw a new figure with the non-linear coordinate transformation g 5 (x) = g(x 2 ). 3.3 Normalization of Physical Quantities Physical quantities are normalized with the purpose of simplifying calculations and eliminate the use of the physical units of distinct variables. Consider the the transfer function of the following RLC filter: H(ω) = U o(ω) U i (ω) = jωl/r 1 ω 2 LC + jωl/r.

21 R U i (ω) L C U o (ω) The squared magnitude of the RLC filter using the technical frequency f is given by H(f) 2 = (2πfL/R) 2 [ 1 (2πf) 2 LC ] 2 + [2πfL/R] 2. Expressing: f in khz, L in mh, C in mf, R in Ω results in: H(f) 2 = [ 1 ( 2π f khz ( 2π f khz ) 2 L C mh mf ) 2 L/mH R/Ω ] 2 + [ 2π f khz ] 2. L/mH R/Ω Exercise Draw H(f) 2 in the range 0 f 20kHz for L = 100µH, C = 10µF and R = 10Ω with the corresponding labels in the x- and y-axis. 3.4 Local Minima and Maxima For a function y = f(x), local minima and maxima are determined by solving the expression dy dx = Lim f(x + x) f(x) x 0 x A graphical approximation of the derivate can be calculated in Matlab using the diff command. For a vector y, diff(y) calculates the differences between adjacent elements of y. As an example, we would like to determine graphically the local minima and maxima of the function y(x) = x cos(x) for π x π: = 0

22 clc;clear;close all Delta = 0.01; x = -pi : Delta : pi; y = x.* cos( x ); plot(x,y); grid on;hold on plot( x(1:end-1), diff(y)./diff(x), r ) xlabel( x \rightarrow ) ylabel( f(x) \rightarrow ) title( Approximate derivation ) legend( y = xcos(x), dy/dx ) 4 3 Approximate derivation y = xcos(x) dy/dx f(x) Local Minimum Local Maximum x Notice that the command diff( y ) reduces the dimension of the vector y by one element. Therefore, the figure is drawn by reducing the elements of the vector x by one element - using the command x(1:end-1). Exercise Determine the local minima and maxima of the function ( ) 2 2π f L/mH khz R/Ω H(f) 2 = [ 1 ( 2π f khz ) 2 L C mh mf ] 2 + [ 2π f khz ] 2 L/mH R/Ω for 0 f 20kHz, L = 100µH, C = 10µF and R = 10Ω with the corresponding labels in the x- and y-axis. The location of the local minima and maxima can be solved analytically in the case that a function can be expressed in a polynomial form. The procedure is described in the following.

23 First, a polynomial is defined in Matlab by a row vector that contain the coefficients of the polynomial. As an example, the polynomial p(x) = x 3 2x 5 is represented by: p = [ ]; The derivative q(x) = dp(x) dx is calculated using the Matlab command polyder: q = polyder( p ); The calculation of the roots of q(x), that is q(x) = 0, provides the location of the local minima and maxima. This takes place using the command roots: r = roots( q ); Finally, the value of the local minima and maxima of p(x) are evaluated by means of the command polyval: polyval( p, r ); 1 2 p(x) x = 0.81 y = 3.91 x = 0.81 y = x More complex functions can be represented by the ratio of two polynomials H(x) = p 1(x) p 2 (x) (as is the case of the transfer function of most linear time invariant systems, for example). The derivative of H(x) results in the ratio of two polynomials q 1 (x) and q 2 (x), that is: dh(x) dx = q 1(x) q 2 (x). The polynomials q 1 (x) and q 2 (x) are evaluated using the command polyder as follows:

24 [ q_1, q_2 ] = polyder( p_1, p_2 ); Finally, the location of the local minima and maxima can be determined by calculating the roots of q 1 (ω) using the command roots, as it was done before. Exercise Determine the local minima and maxima of the function ( ) 2 2π f L/mH khz R/Ω H(f) 2 = [ 1 ( 2π f khz ) 2 L C mh mf ] 2 + [ 2π f khz ] 2 L/mH R/Ω for L = 100µH, C = 10µF and R = 10Ω. Compare this result with the resonant frequency f = 1 2π LC. 3.5 Poles and Zeros The poles and zeros of a function H(x) are obtained by calculating the roots of the denominator and the numerator H(x), respectively: Exercise Draw the poles and zeros diagram of H(f) 2 = H(x) = k (x X N,1) (x X N,2 ) (x X P,1 ) (x X P,2 ) [ 1 ( 2π f khz for L = 100µH, C = 10µF and R = 10Ω. ( 2π f khz ) 2 L C mh mf ) 2 L/mH R/Ω ] 2 + [ 2π f khz ] 2 L/mH R/Ω

25 21 Chapter 4 Curve fitting, interpolation and approximation of functions using Polynomials This chapter covers the basic MATLAB tools for curve fitting, interpolation and approximation of functions using polynomials. 4.1 Polynomial curve fitting The Matlab command polyfit finds the coefficients of a polynomial that fits a set of data in a least-squares sense: p = polyfit(x, y, n) finds the best-fit n-degree polynomial that approximates the data points x and y. x and y are vectors containing the x and y data to be fitted, and n is the degree of the polynomial to return. For example, consider the x-y test data: x = [ ]; y = [ ]; %A third degree polynomial that approximately fits the data is : p = polyfit(x,y,3) p = Let us now compute the values of the polyfit estimate over a finer range, and plot the estimate over the real data values for comparison: x2 = 1:.1:5; y2 = polyval(p,x2); plot(x,y, o,x2,y2) grid on legend( measured points, polyfit of degree 3 ) title( \bf{polynomial Curve Fitting} ) Note: The command polyval(p,x2) evaluates the polynomial p for each element of the vector x2. For more information check Matlab help by writting at command window help polyval The figure on the next page shows the measured data and the curve fitting to it.

26 Polynomial Curve Fitting measured points polyfit of degree y x Exercise 1 Consider the following test data : x = [ ] y = [ ] Find a fifth degree polynomial that fits the data, compute the values of the polyfit estimate over a finer range and plot the estimate over the real data values for comparison. 4.2 Polynomial interpolation Polynomials are useful as easier-to-compute approximations of more complicated functions, via a Taylor series expansion or by a low-degree best-fit polynomial using the polyfit function. Example Let s approximate y = sin(x) between 0 and 2π using a polynomial of degree 5 and plot both on the same figure for comaprison. % Example: function approxiamtion using polynomial % the given function is y = sin(x) % the objective is to approximate the function b/n 0 and 2*pi using poly - % nomial of degree 5. close all x = 0:0.1:2*pi ;

27 y = sin(x); plot(x,y) xlabel( x \rightarrow ) ylabel( y \rightarrow ) hold on p = polyfit(x,y,5) xx = 0: 0.1: 2*pi ; yy = polyval(p,xx); plot(xx,yy, -sr ) legend( sin(x), poly. of degree 5 approx. ) Polynomial approximation of the sin(x) over one period sin(x) poly. of degree 5 approx. 0.5 y x Exercise 2 Approximate y = sin(x) between 2π and 2π using a polynomial of degree 5 and plot both on the same figure for comaprison. Now approximate y = sin(x) between 2π and 2π using a polynomial of degree 7 and plot both on the second figure for comaprison. Piecewise-polynomial interpolation is typically better than a single high-degree polynomial. The following example shows the difference between them. % comparison of piecewise-polynomial versus single high degree polynomial

28 %interpolations % first in fig1 single polynomial approximation of higher order close all n = 10; x = -5:0.1:5 ; y = 1./(x.^2 + 1) ; p = polyfit(x,y,n) figure(1) fplot( 1/(x^2 + 1), [-7 7], rs- ) hold on xx = -5:0.01:5 ; plot(xx,polyval(p,xx), g*- ) legend( f(x)=1/(x^2 + 1), Single polynomial approx. of f(x) ) title( \bf{single polynomial approximation of a function } ) % Now the piecewise polynomial interpolation using spline or spline + ppval figure(2) yy = spline(x,y,xx) ; fplot( 1/(x^2 + 1), [-7 7], rs- ) hold on plot(xx,yy, g*- ) legend( f(x)=1/(x^2 + 1), Piecewise-polynomial approx. of f(x) ) title( \bf{piecewise-polynomial approximation of a function } ) The result of the first plot using the single polynomial approximation is : Single polynomial approximation of a function f(x)=1/(x 2 + 1) Single polynomial approx. of f(x) From this figure it could be observed that as n increases the error in the center improves but increases near the endpoints.

29 The second figure, which is shown below, using the piecewise-polynomial interpolation shows a better result Piecewise polynomial approximation of a function f(x)=1/(x^2 + 1} Piecewise polynomial approx. of f(x) Exercise 3 a) Approximate the function y = sin 3 (x) between 2π and 2π using a single polynomial of degree 7 and plot both the original function and the approximated polynomial on the same figure for comaprison. b) Approximate the function y = sin 3 (x) between 2π and 2π using piecewise-polynomial interpolation and plot both the original function and the approximated polynomial on the same figure for comparison. 4.3 Taylor series expansion The Taylor series for an analytic function f(x) about the base point x = a is given by : f(x) = (x a) n. f(n) (a) (4.1) n! n=0 The Matlab syntax and its description about taylor series is available from the Matlab help under Symbolic Math Toolbox. The main commands are : taylor(f) is the fifth order Maclaurin polynomial approximation to f(x). taylor(f,n,v) returns the (n-1)-order Maclaurin polynomial approximation to f(x), where f is a symbolic expression representing a function and v specifies the independent variable in the expression. v can be a string or symbolic variable.

30 taylor(f,n,v,a) returns the Taylor series approximation to f(x) about a. The argument a can be a numeric value, a symbol, or a string representing a numeric value or an unknown. You can supply the arguments n, v, and a in any order. taylor determines the purpose of the arguments from their position and type. You can also omit any of the arguments n,v, and a. If you do not specify v, taylor uses findsym to determine the function s independent variable.the default value to n is 6. Note: The independent variable in the above descriptions is symbolic and hence should first be declared as syms x. Example The taylor series expansion of f(x) = sin(x) at x = 0 up to the order of 5 is : syms x f = sin(x) f_taylor = taylor(f) Matlab answer to these commands is : f_taylor = x^5/120 - x^3/6 + x The taylor series expansion of f(x) = sin(x) at around x = 0 up to the order of 7 is : syms x f = sin(x) f_tr_7 = taylor(f,8) Matlab answer to these commands is : f_tr_7 = x^5/120 - x^7/ x^3/6 + x We now plot the function sin(x) and the taylor series obtained above for comparison. fplot( sin(x), [-2*pi 2*pi -1 1]) hold on fplot( x^5/120 - x^7/ x^3/6 + x, [-2*pi 2*pi ], rs-- ) Observe from the figure below how well the polynomial obtained through taylor series approximates the function for small values of x ( 3 x 3).

31 1.5 1 Taylor series of a sin function sin(x) x 7 / x 5 /120 x 3 /6 + x Exercise 4 Determine the taylor series expansion of the following functions at around 0 up to the order of 9 and plot both the function and the approximate taylor series on the same figure like the above example. exp(x) cosh(x) sinh(x) Taylor series approximation using the Matlab command taylortool Syntax taylortool taylortool( f ) Description taylortool initiates a GUI that graphs a function against the N th partial sum of its Taylor series about a base point x = a. The default function, value of N, base point, and interval of computation for taylortool are f = x cos(x), N = 7, a = 0, and [ 2π, 2π], respectively. taylortool( f ) initiates the GUI for the given expression f. Example taylortool( exp(x*sin(x)) ), this command opens the following GUI:

32 Taylor Series Approximation T N (x) = x 6 /120 + x 4 /3 + x Exercise 5 Now use the command taylortool, like the example above, and determine the taylor series approximations near the origin for the following functions: tan(x) sin(x) cosh(x) sinh(x) sin(tan(x)) tan(sin(x))

33 29 Chapter 5 Vectors and Matrices This chapter covers the basic opration on Vectors and Matrices in the MATLAB environment. 5.1 Creating Matrices The MATLAB environment uses the term matrix to indicate a variable containing real or complex numbers arranged in a two-dimensional grid. An array is, more generally, a vector, matrix, or higher-dimensional grid of numbers. All arrays in MATLAB are rectangular, in the sense that the component vectors along any dimension are all the same length. MATLAB has a number of functions that create different kinds of matrices. The functions shown in the table below create matrices for more general use. Function ones zeros eye diag magic rand randn Description Create a matrix or array of all ones. Create a matrix or array of all zeros. Create a matrix with ones on the diagonal and zeros elsewhere. Create a diagonal matrix from a vector. Create a square matrix with rows, columns, and diagonals that add up to the same number. Create a matrix or array of uniformly distributed random numbers. Create a matrix or array of normally distributed random numbers and arrays. For more information check help matfun. Examples Here are some examples of how you can use these functions. Creating a Random Matrix. The rand function creates a matrix or array with elements uniformly distributed between zero and one. This example multiplies each element by 20:

34 A = rand(5)*20 A = Creating a Diagonal Matrix. Use diag to create a diagonal matrix from a vector. You can place the vector along the main diagonal of the matrix, or on a diagonal that is above or below the main one, as shown here. The -1 input places the vector one row below the main diagonal: >> A = [ ] A = >> diag(a) ans = >> diag(a,-1) ans = Creating a Magic Square Matrix. A magic square is a matrix in which the sum of the elements in each column, or each row, or each main diagonal is the same. To create

35 a 5-by-5 magic square matrix, use the magic function as shown. >> A = magic(5) A = Note that the elements of each row, each column, and each main diagonal add up to the same value: 65. Concatenating Matrices Matrix concatenation is the process of joining one or more matrices to make a new matrix. The brackets [] operator which we have used often serves not only as a matrix constructor, but also as the MATLAB concatenation operator. The expression C = [A B] horizontally concatenates matrices A and B. The expression C = [A; B] vertically concatenates them. >> A = ones(2, 5) * 6; % 2-by-5 matrix of 6 s >> B = rand(3, 5); >> C = [A; B] % Vertically concatenate A and B C = Accessing Single Elements We have already discussed in the previous sessions how to reference single elements of a matrix. The syntax is : A(row, column), where A is a variable matrix. Linear Indexing You can refer to the elements of a MATLAB matrix with a single subscript, A(k). MAT- LAB stores matrices and arrays not in the shape that they appear when displayed in the MATLAB Command Window, but as a single column of elements. This single column is composed of all of the columns from the matrix, each appended to the last. So, matrix A >> A = [2 6 9; 4 2 8; 3 5 1]

36 A = is actually stored in memory as the sequence 2, 4, 3, 6, 2, 5, 9, 8, 1 The element at row 3, column 2 of matrix A (value = 5) can also be identified as element 6 in the actual storage sequence. To access this element, you have a choice of using the standard A(3,2) syntax, or you can use A(6), which is referred to as linear indexing. Accessing Multiple Elements For the 4-by-4 matrix A shown below, it is possible to compute the sum of the elements in the fourth column of A by typing >> A = magic(4); >> A(1,4) + A(2,4) + A(3,4) + A(4,4) ans = 34 You can reduce the size of this expression using the colon operator. Subscript expressions involving colons refer to portions of a matrix. The expression A(1:m, n) refers to the elements in rows 1 through m of column n of matrix A. Using this notation, you can compute the sum of the fourth column of A more succinctly: sum(a(1:4, 4)) Nonconsecutive Elements To refer to nonconsecutive elements in a matrix, use the colon operator with a step value. The m:3:n in this expression means to make the assignment to every third element in the matrix. Note that this example uses linear indexing: >> B = A; >> B(1:3:16) = -10 B =

37 MATLAB supports a type of array indexing that uses one array as the index into another array. You can base this type of indexing on either the values or the positions of elements in the indexing array. Here is an example of value-based indexing where array B indexes into elements 1, 3, 6, 7, and 10 of array A. In this case, the numeric values of array B designate the intended elements of A: >> A = 5:5:50 A = >> B = [ ]; >> A(B) ans = The end Keyword MATLAB provides the keyword end to designate the last element in a particular dimension of an array. This keyword can be useful in instances where your program does not know how many rows or columns there are in a matrix. You can replace the expression in the previous example with B(1:3:end) = -10 Specifying All Elements of a Row or Column The colon by itself refers to all the elements in a row or column of a matrix. Using the following syntax, you can compute the sum of all elements in the second column of a 4-by-4 magic square A: >> A = magic(4); >> sum(a(:,2)) ans = 34 By using the colon with linear indexing, you can refer to all elements in the entire matrix. The command A(:) displays all the elements of matrix A, returning them in a columnwise order. Check it! Using Logicals in Array Indexing

38 A logical array index designates the elements of an array A based on their position in the indexing array, B, not their value. In this masking type of operation, every true element in the indexing array is treated as a positional index into the array being accessed. In the following example, B is a matrix of logical ones and zeros. The position of these elements in B determines which elements of A are designated by the expression A(B): >> A = [1 2 3; 4 5 6; 7 8 9] A = >> B = logical([0 1 0; 1 0 1; 0 0 1]); >> A(B) ans = The find function can be useful with logical arrays as it returns the linear indices of nonzero elements in B, and thus helps to interpret A(B): >> find(b) ans =

39 5.2 Inverses and Determinants If A and B are square matrices, each of order n n, which satisfy the equations AB = BA = I n then B is called the inverse of A. We write B = A 1. Since the definition is symmetric, A is the inverse of B, that is A = B 1. Let us consider a general 2 2 matrix, and determine the inverse matrix and also look for the conditions for the existance of the inverse matrix. Ax = d where [ ] [ ] [ ] a11 a A = 12 x1 d1, x =, d = a 21 a 22 x 2 d 2 Thus a 11 x 1 + a 12 x 2 = d 1 a 21 x 1 + a 22 x 2 = d 2 These are linear equations in the unknowns x 1 and x 2. x 1 and x 2 are given by, provided that a 11 a 22 a 21 a 12 0, x 1 = a 22d 1 a 12 d 2 a 11 a 22 a 21 a 12, x 2 = a 21d 1 + a 11 d 2 a 11 a 22 a 21 a 12 x = [ ] [ ] 1 a22 a 12 d1 a 11 a 22 a 21 a 12 a 21 + a 11 d 2 The number a 11 a 22 a 21 a 12 is known as the determinat of the matrix A, det(a). [ ] Ax = d x = A 1 d A 1 1 a22 a = 12 det(a) a 21 a 11 The Matlab command to find the determinant of the square matrix A is det(a) and the inverse of A can be obtained using the command inv(a) if it exists, i.e. if A is non-singular. If A is square and nonsingular, then, without roundoff error, X = inv(a)*d is theoretically the same as X = A\d and Y = d*inv(a) is theoretically the same as Y = d/a. But the computations involving the backslash and slash operators are preferable because they require less computer time, less memory, and have better error-detection properties. Exercise A) Decide [ whether ] A, where 1 3 A =, 1 4

40 is singular or not. If it is non-singular, find its inverse. B)Given [ are] the matrices [ : ] A =, B = Find A 1, B 1, (AB) 1, and B 1 A C) Find A 1, where A = Find the determinants of A T, A and A 1 D) Given that A = [ ] , B = 2 1, C = verify the distributive law A(B + C) = AB + AC for the three matrices. E)Given are the matrices : A = [ ] 4 2, B = 2 1 [ ] Find the inverse of (BA) and (AB) if they exist. F)Given is the matrix : A = Find a matrix C such that A + C is the identity matrix I 3, i.e. 3 3 identity matrix. Determine AC, CA and A 2 + C 2. Check whether AC = CA. G)For a general n n matrix it could be shown that A +A T is a symmetric matrix, and A A T is a skew-symmetric matrix. Now, express the matrix : A = as the sum of a symmetric matrix and a skew-symmetric matrix.

41 Pseudoinverses Rectangular matrices do not have inverses or determinants. At least one of the equations AX = I and XA = I does not have a solution. A partial replacement for the inverse is provided by the Moore-Penrose pseudoinverse, which is computed by the pinv function. The Matalab syntax is: B = pinv(a) The Moore-Penrose pseudoinverse is a matrix B of the same dimensions as A satisfying the four conditions: A B A = A B A B = B A B is Hermitian B A is Hermitian Example >> rand( state, 0); >> A = rand(3,2) A = >> B = pinv(a) B = >> A*B ans = >> (A*B) ans =

42 >> B*A ans = >> (B*A) ans = B*A is the 2-by-2 identity matrix, but A*B is not the 3-by-3 identity matrix. However, A*B acts like an identity on a portion of the space in the sense that A*B is symmetric, A*B*A is equal to A, and B*A*B is equal to B. Exercise Let now A is given by : A = 10*rand(2,3) Determine the Moore-Penrose pseudoinverse B, proof the four conditions described earlier. 5.3 Vector Norms and the scalar product in Matlab The p-norm of a vector x ( ) 1/p x p = xi p is computed by norm(x,p). This is defined by any value of p > 1, but the most common values of p are 1, 2 and. The default value is p = 2, which corresponds to Euclidean length: Example >> v = [2 0-1]; >> [norm(v,1) norm(v) norm(v,inf)] ans = Exercise Compute the 1 st, 2 nd, 3 rd, 10 th and the infinity norms of the following vectors :

43 w = [ ] x = [ ] y = [ ] z = [ ] The scalar product of two vectors Suppose that two vectors a and b are given in component form in 3D as : a = (a 1,a 2,a 3 ) and b = (b 1,b 2,b 3 ) The scalar product is defined as : a b = a 1 b 1 + a 2 b 2 + a 3 b 3 The Matlab equivalent to this is element by element multiplication of two vectors of the same size. Exercise Let a be a vector on x-z plane with values ( 1, 0, 1) and b = (2, 3, 2) Determine the scalar product a b Check the results of (a b) (a b) and a 2 b Matlab functions that work on diagonals of a matrix Function trace diag tril triu Description Compute the sum of the elements on the main diagonal. Return the diagonals of a matrix. Return the lower triangular part of a matrix. Return the upper triangular part of a matrix. Exercise 5.4 The Matlab command pascal(3) creates a 3 3 symmetric matrix. Now, create 4 4 symmetric matrix using the function pascal and then determine : The lower triangular part of this matrix. The upper triangular part of this matrix. A vector with the main diagnoal elements of this matrix. The sum of the elements on the main diagonal.

44 40 Chapter 6 Systems of Linear Equations 6.1 Linear System, Coefficient Matrix, Augmented Matrix A linear system of equations in n unknowns x 1,x 2,,x n is a set of equations of the form a 11 x a 1n x n = b 1 a 21 x a 2n x n = b 2.. (6.1) a m1 x a mn x n = b m Thus, a system of two equations in three unknown is a 11 x 1 + a 12 x 2 + a 13 x 3 = b 1 a 21 x 1 + a 22 x 2 + a 23 x 3 = b 2 The a jk are given numbers, which are called the coefficients of the system. If the b i are all zero, then (6.1) is called a homogeneous system.if at least one b i is not zero, then (6.1) is called a nonhomogeneous system. A solution of (6.1) is a set of numbers x 1,,x n that satisfies all the m equations. A solution vector of (6.1) is a verctor x whose components constitute a solution of (6.1). If the system is homogeneous, it has at least the trivial solution x 1 = 0,,x n = 0. Matrix form of the Linear System (6.1). The m equations of (6.1) can be written as a single vector equation Ax = b (6.2) where the coefficient matrix A = [a jk ] is the m n matrix a 11 a 12 a x 1 1n a 21 a 22 a 2n A =......, x = a m1 a m2 a mn x n b 1 and b = b n

45 are column verctors. It is assumed that A is not a zero matrix, which means not all the coefficients a jk are zero.the augumented matrix à of (6.1) is a 11 a 12 a 1n b 1 à = [ A b ] a 21 a 22 a 2n b 2 = a m1 a m2 a mn b n The method of solving such a system by determinants(cramer s rule) is not practical, but the Gauss elimination methos is often used and discussed brifely below. 6.2 Solutions of Linear Systems: Existence and Uniqueness The necessary and sufficient conditions for the existence of solutions and for the uniqueness can be given using the rank of the coefficient matrix A and Ã. (a) Existence A linear system of m equations in n unknowns(6.1) has solutions if and only if the coefficient matrix A and the augmented matrix à have the same rank. (b) Uniqueness The system(6.1) has precisely one solution if and only if this common rank r of A and à equals n. (c) Infinitely many solutions If this rank r is less than n, the system has infinitely many solutions. All of these are obtained by determinig r suitable unknowns in terms of the remaining n - r unknowns, to which arbitrary values can be assigned. (d) Gauss elimination If solutions exist, they can be obtained by the Gauss elimination. A homogeneous linear system has always the trivial solutionx 1 = 0,,x n = 0. Nontrivial solutions exist if and only if rank A < n. Exercise 6a Determine the existance of the solutions to the following systems of linear equations and proof also the uniqueness of the solutions 1. 2x 1 + 2x 2 + 4x 3 = 2 4x 1 + 5x 2 +13x 3 = 7 10x 1 +14x 2 +43x 3 = 25

46 2. 3x 1 4x 2 = 2 x 1 +5x 2 = 4 5x 1 +2x 2 = x 1 +3x 2 + 2x 3 = 2 x 1 x 2 3x 3 = 5 3x 1 +5x 2 + 5x 3 = 3 4. x 1 + x 2 + x 3 = 1 x 1 2x 2 + x 3 = 2 x 1 x 2 + 5x 3 = 0 5. x 1 +x 2 + x 3 + 3x 4 =0 2x 2 + 2x 4 =5 x 1 x 2 2x 3 2x 4 =4 2x 1 +4x 2 + 2x 3 +8x 4 =5 6.3 Numerical methods in Linear Algebra Gauss Elimlination This standard method for solving linear systems (6.1) is a systematic process of elimination that reduces (6.1) to triangular form because the sytem can easily solved by back substitution. For instance, a triangular system is 3x 1 + 5x 2 + 2x 3 = 8 8x 2 + 2x 3 = 7 6x 3 = 3 LU-Factorization A is now assumed to be a square matrix, n n. Below is briefly discussed three related methods that are modifications of the Gauss elimination. They are named after Doolittle, Crout, and Cholesky and use the idea of LU-Factorization, which will be expalined first. An LU-factorization of a given square matrix A is of the form A = LU (6.3)

47 where L is lower triangular and U is upper triangular matrices. For example, [ ] [ ][ ] A = = LU = It could be proved that for any nonsingular matrix (interested reader can refer to Sec.6 of advanced engineering mathematics by Kreyszig,E.)the rows can be reordered so that the resulting matrix A has an LU-factrorization (6.3) in which U turns out to be the triangular system at the end of the Gauss elimination and L is the matrix of the multipliers m jk of the Gauss elimination, with diagonal 1,, 1. The main idea here is that L and U in (6.3) can be computed directly, without solving the simultaneous equations(thus, without using the Gauss elimination. Once we have (6.3), Ax = b can be solved in two steps, simply by noting that Ax = LUx = b can be written as : Ly = b (6.4a) where Ux = y (6.4b) and solving first (6.4a) for y and then (6.4b) for x. This is called Doolittle s method. Both systems (6.4a) and (6.4b) are triangular, so their solution is the same as back substitution in the Gausss elimination. A similar method, Crout s method, is obtained from (6.3) if U(instead of L) is required to have main diagonal 1,, 1. In either case the factorization (6.3) is unique. Example A system is given by a matrix A and the vector b as follows : A = b = [ ] Solve the system using Doolittle s method (LU factorization with main diagonal elements of L are 1 ). Solution u 11 u 12 u 13 A = = m u 22 u m 31 m u 33 u 11 = 3, m 21 u 11 = 0 m 21 = 0, A = =

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

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

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

Seminar to the lecture Computer-based Engineering Mathematics

Seminar to the lecture Computer-based Engineering Mathematics Seminar to the lecture Computer-based Engineering Mathematics N T S Prof. Dr.-Ing. A. Czylwik Mohammad Abdelqader, M.Sc. Room: BA 249, Tel: +49-203-379-3474 E-Mail: abdelqader@nts.uni-duisburg-essen.de

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

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

(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

Math 307 Learning Goals. March 23, 2010

Math 307 Learning Goals. March 23, 2010 Math 307 Learning Goals March 23, 2010 Course Description The course presents core concepts of linear algebra by focusing on applications in Science and Engineering. Examples of applications from recent

More information

L3: Review of linear algebra and MATLAB

L3: Review of linear algebra and MATLAB L3: Review of linear algebra and MATLAB Vector and matrix notation Vectors Matrices Vector spaces Linear transformations Eigenvalues and eigenvectors MATLAB primer CSCE 666 Pattern Analysis Ricardo Gutierrez-Osuna

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

OR MSc Maths Revision Course

OR MSc Maths Revision Course OR MSc Maths Revision Course Tom Byrne School of Mathematics University of Edinburgh t.m.byrne@sms.ed.ac.uk 15 September 2017 General Information Today JCMB Lecture Theatre A, 09:30-12:30 Mathematics revision

More information

Systems of Linear Equations and Matrices

Systems of Linear Equations and Matrices Chapter 1 Systems of Linear Equations and Matrices System of linear algebraic equations and their solution constitute one of the major topics studied in the course known as linear algebra. In the first

More information

Using MATLAB. Linear Algebra

Using MATLAB. Linear Algebra Using MATLAB in Linear Algebra Edward Neuman Department of Mathematics Southern Illinois University at Carbondale One of the nice features of MATLAB is its ease of computations with vectors and matrices.

More information

Systems of Linear Equations and Matrices

Systems of Linear Equations and Matrices Chapter 1 Systems of Linear Equations and Matrices System of linear algebraic equations and their solution constitute one of the major topics studied in the course known as linear algebra. In the first

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

Lab 2: Static Response, Cantilevered Beam

Lab 2: Static Response, Cantilevered Beam Contents 1 Lab 2: Static Response, Cantilevered Beam 3 1.1 Objectives.......................................... 3 1.2 Scalars, Vectors and Matrices (Allen Downey)...................... 3 1.2.1 Attribution.....................................

More information

Fundamentals of Engineering Analysis (650163)

Fundamentals of Engineering Analysis (650163) Philadelphia University Faculty of Engineering Communications and Electronics Engineering Fundamentals of Engineering Analysis (6563) Part Dr. Omar R Daoud Matrices: Introduction DEFINITION A matrix is

More information

A Review of Matrix Analysis

A Review of Matrix Analysis Matrix Notation Part Matrix Operations Matrices are simply rectangular arrays of quantities Each quantity in the array is called an element of the matrix and an element can be either a numerical value

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

Math 307 Learning Goals

Math 307 Learning Goals Math 307 Learning Goals May 14, 2018 Chapter 1 Linear Equations 1.1 Solving Linear Equations Write a system of linear equations using matrix notation. Use Gaussian elimination to bring a system of linear

More information

Lecture 28 The Main Sources of Error

Lecture 28 The Main Sources of Error Lecture 28 The Main Sources of Error Truncation Error Truncation error is defined as the error caused directly by an approximation method For instance, all numerical integration methods are approximations

More information

Chapter 2. Linear Algebra. rather simple and learning them will eventually allow us to explain the strange results of

Chapter 2. Linear Algebra. rather simple and learning them will eventually allow us to explain the strange results of Chapter 2 Linear Algebra In this chapter, we study the formal structure that provides the background for quantum mechanics. The basic ideas of the mathematical machinery, linear algebra, are rather simple

More information

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel LECTURE NOTES on ELEMENTARY NUMERICAL METHODS Eusebius Doedel TABLE OF CONTENTS Vector and Matrix Norms 1 Banach Lemma 20 The Numerical Solution of Linear Systems 25 Gauss Elimination 25 Operation Count

More information

Chapter 5. Linear Algebra. A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form

Chapter 5. Linear Algebra. A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form Chapter 5. Linear Algebra A linear (algebraic) equation in n unknowns, x 1, x 2,..., x n, is an equation of the form a 1 x 1 + a 2 x 2 + + a n x n = b where a 1, a 2,..., a n and b are real numbers. 1

More information

Linear Algebra. The analysis of many models in the social sciences reduces to the study of systems of equations.

Linear Algebra. The analysis of many models in the social sciences reduces to the study of systems of equations. POLI 7 - Mathematical and Statistical Foundations Prof S Saiegh Fall Lecture Notes - Class 4 October 4, Linear Algebra The analysis of many models in the social sciences reduces to the study of systems

More information

Math 302 Outcome Statements Winter 2013

Math 302 Outcome Statements Winter 2013 Math 302 Outcome Statements Winter 2013 1 Rectangular Space Coordinates; Vectors in the Three-Dimensional Space (a) Cartesian coordinates of a point (b) sphere (c) symmetry about a point, a line, and a

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2 MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS SYSTEMS OF EQUATIONS AND MATRICES Representation of a linear system The general system of m equations in n unknowns can be written a x + a 2 x 2 + + a n x n b a

More information

Physics with Matlab and Mathematica Exercise #1 28 Aug 2012

Physics with Matlab and Mathematica Exercise #1 28 Aug 2012 Physics with Matlab and Mathematica Exercise #1 28 Aug 2012 You can work this exercise in either matlab or mathematica. Your choice. A simple harmonic oscillator is constructed from a mass m and a spring

More information

MTH Linear Algebra. Study Guide. Dr. Tony Yee Department of Mathematics and Information Technology The Hong Kong Institute of Education

MTH Linear Algebra. Study Guide. Dr. Tony Yee Department of Mathematics and Information Technology The Hong Kong Institute of Education MTH 3 Linear Algebra Study Guide Dr. Tony Yee Department of Mathematics and Information Technology The Hong Kong Institute of Education June 3, ii Contents Table of Contents iii Matrix Algebra. Real Life

More information

Review Questions REVIEW QUESTIONS 71

Review Questions REVIEW QUESTIONS 71 REVIEW QUESTIONS 71 MATLAB, is [42]. For a comprehensive treatment of error analysis and perturbation theory for linear systems and many other problems in linear algebra, see [126, 241]. An overview of

More information

Examples and MatLab. Vector and Matrix Material. Matrix Addition R = A + B. Matrix Equality A = B. Matrix Multiplication R = A * B.

Examples and MatLab. Vector and Matrix Material. Matrix Addition R = A + B. Matrix Equality A = B. Matrix Multiplication R = A * B. Vector and Matrix Material Examples and MatLab Matrix = Rectangular array of numbers, complex numbers or functions If r rows & c columns, r*c elements, r*c is order of matrix. A is n * m matrix Square

More information

a11 a A = : a 21 a 22

a11 a A = : a 21 a 22 Matrices The study of linear systems is facilitated by introducing matrices. Matrix theory provides a convenient language and notation to express many of the ideas concisely, and complicated formulas are

More information

Finite Difference Methods for Boundary Value Problems

Finite Difference Methods for Boundary Value Problems Finite Difference Methods for Boundary Value Problems October 2, 2013 () Finite Differences October 2, 2013 1 / 52 Goals Learn steps to approximate BVPs using the Finite Difference Method Start with two-point

More information

Introduction - Motivation. Many phenomena (physical, chemical, biological, etc.) are model by differential equations. f f(x + h) f(x) (x) = lim

Introduction - Motivation. Many phenomena (physical, chemical, biological, etc.) are model by differential equations. f f(x + h) f(x) (x) = lim Introduction - Motivation Many phenomena (physical, chemical, biological, etc.) are model by differential equations. Recall the definition of the derivative of f(x) f f(x + h) f(x) (x) = lim. h 0 h Its

More information

Quaternion Dynamics, Part 1 Functions, Derivatives, and Integrals. Gary D. Simpson. rev 00 Dec 27, 2014.

Quaternion Dynamics, Part 1 Functions, Derivatives, and Integrals. Gary D. Simpson. rev 00 Dec 27, 2014. Quaternion Dynamics, Part 1 Functions, Derivatives, and Integrals Gary D. Simpson gsim100887@aol.com rev 00 Dec 27, 2014 Summary Definitions are presented for "quaternion functions" of a quaternion. Polynomial

More information

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and Section 5.5. Matrices and Vectors A matrix is a rectangular array of objects arranged in rows and columns. The objects are called the entries. A matrix with m rows and n columns is called an m n matrix.

More information

Linear Algebra: Matrix Eigenvalue Problems

Linear Algebra: Matrix Eigenvalue Problems CHAPTER8 Linear Algebra: Matrix Eigenvalue Problems Chapter 8 p1 A matrix eigenvalue problem considers the vector equation (1) Ax = λx. 8.0 Linear Algebra: Matrix Eigenvalue Problems Here A is a given

More information

Gaussian Elimination and Back Substitution

Gaussian Elimination and Back Substitution Jim Lambers MAT 610 Summer Session 2009-10 Lecture 4 Notes These notes correspond to Sections 31 and 32 in the text Gaussian Elimination and Back Substitution The basic idea behind methods for solving

More information

Mathematics for Graphics and Vision

Mathematics for Graphics and Vision Mathematics for Graphics and Vision Steven Mills March 3, 06 Contents Introduction 5 Scalars 6. Visualising Scalars........................ 6. Operations on Scalars...................... 6.3 A Note on

More information

TI89 Titanium Exercises - Part 10.

TI89 Titanium Exercises - Part 10. TI89 Titanium Exercises - Part. Entering matrices directly in the HOME screen s entry line ) Enter your nxm matrix using this format: [[ a, a 2,,a m ][a 2, a 22, a 2m ] [a n, a n2,, a nm ]] This is a matrix

More information

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and Section 5.5. Matrices and Vectors A matrix is a rectangular array of objects arranged in rows and columns. The objects are called the entries. A matrix with m rows and n columns is called an m n matrix.

More information

Introduction to Matrices and Linear Systems Ch. 3

Introduction to Matrices and Linear Systems Ch. 3 Introduction to Matrices and Linear Systems Ch. 3 Doreen De Leon Department of Mathematics, California State University, Fresno June, 5 Basic Matrix Concepts and Operations Section 3.4. Basic Matrix Concepts

More information

MAT Linear Algebra Collection of sample exams

MAT Linear Algebra Collection of sample exams MAT 342 - Linear Algebra Collection of sample exams A-x. (0 pts Give the precise definition of the row echelon form. 2. ( 0 pts After performing row reductions on the augmented matrix for a certain system

More information

Chapter 9: Systems of Equations and Inequalities

Chapter 9: Systems of Equations and Inequalities Chapter 9: Systems of Equations and Inequalities 9. Systems of Equations Solve the system of equations below. By this we mean, find pair(s) of numbers (x, y) (if possible) that satisfy both equations.

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

Chapter 7. Linear Algebra: Matrices, Vectors,

Chapter 7. Linear Algebra: Matrices, Vectors, Chapter 7. Linear Algebra: Matrices, Vectors, Determinants. Linear Systems Linear algebra includes the theory and application of linear systems of equations, linear transformations, and eigenvalue problems.

More information

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations Chapter 1: Systems of linear equations and matrices Section 1.1: Introduction to systems of linear equations Definition: A linear equation in n variables can be expressed in the form a 1 x 1 + a 2 x 2

More information

Linear Algebra for Machine Learning. Sargur N. Srihari

Linear Algebra for Machine Learning. Sargur N. Srihari Linear Algebra for Machine Learning Sargur N. srihari@cedar.buffalo.edu 1 Overview Linear Algebra is based on continuous math rather than discrete math Computer scientists have little experience with it

More information

MATRICES. a m,1 a m,n A =

MATRICES. a m,1 a m,n A = MATRICES Matrices are rectangular arrays of real or complex numbers With them, we define arithmetic operations that are generalizations of those for real and complex numbers The general form a matrix of

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

TOPIC 2 Computer application for manipulating matrix using MATLAB

TOPIC 2 Computer application for manipulating matrix using MATLAB YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 2 Computer application for manipulating matrix using MATLAB Definition of Matrices in MATLAB

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

LS.1 Review of Linear Algebra

LS.1 Review of Linear Algebra LS. LINEAR SYSTEMS LS.1 Review of Linear Algebra In these notes, we will investigate a way of handling a linear system of ODE s directly, instead of using elimination to reduce it to a single higher-order

More information

Foundations of Matrix Analysis

Foundations of Matrix Analysis 1 Foundations of Matrix Analysis In this chapter we recall the basic elements of linear algebra which will be employed in the remainder of the text For most of the proofs as well as for the details, the

More information

USE OF MATLAB TO UNDERSTAND BASIC MATHEMATICS

USE OF MATLAB TO UNDERSTAND BASIC MATHEMATICS USE OF MATLAB TO UNDERSTAND BASIC MATHEMATICS Sanjay Gupta P. G. Department of Mathematics, Dev Samaj College For Women, Punjab ( India ) ABSTRACT In this paper, we talk about the ways in which computer

More information

Linear Algebra Homework and Study Guide

Linear Algebra Homework and Study Guide Linear Algebra Homework and Study Guide Phil R. Smith, Ph.D. February 28, 20 Homework Problem Sets Organized by Learning Outcomes Test I: Systems of Linear Equations; Matrices Lesson. Give examples of

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

Lecture 3: Special Matrices

Lecture 3: Special Matrices Lecture 3: Special Matrices Feedback of assignment1 Random matrices The magic matrix commend magic() doesn t give us random matrix. Random matrix means we will get different matrices each time when we

More information

SIGNALS AND LINEAR SYSTEMS LABORATORY EELE Experiment (2) Introduction to MATLAB - Part (2) Prepared by:

SIGNALS AND LINEAR SYSTEMS LABORATORY EELE Experiment (2) Introduction to MATLAB - Part (2) Prepared by: The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department SIGNALS AND LINEAR SYSTEMS LABORATORY EELE 110 Experiment () Introduction to MATLAB - Part () Prepared by: Eng. Mohammed

More information

MATRICES. knowledge on matrices Knowledge on matrix operations. Matrix as a tool of solving linear equations with two or three unknowns.

MATRICES. knowledge on matrices Knowledge on matrix operations. Matrix as a tool of solving linear equations with two or three unknowns. MATRICES After studying this chapter you will acquire the skills in knowledge on matrices Knowledge on matrix operations. Matrix as a tool of solving linear equations with two or three unknowns. List of

More information

Introduction to Linear Algebra

Introduction to Linear Algebra Introduction to Linear Algebra Thomas L. Scofield August 31, 2014 Contents 1 Solving Linear Systems of Equations 1 1.1 Matrices, and Introduction to Octave....................... 1 1.2 Matrix Algebra...................................

More information

ENGI 9420 Lecture Notes 2 - Matrix Algebra Page Matrix operations can render the solution of a linear system much more efficient.

ENGI 9420 Lecture Notes 2 - Matrix Algebra Page Matrix operations can render the solution of a linear system much more efficient. ENGI 940 Lecture Notes - Matrix Algebra Page.0. Matrix Algebra A linear system of m equations in n unknowns, a x + a x + + a x b (where the a ij and i n n a x + a x + + a x b n n a x + a x + + a x b m

More information

Table 1 Principle Matlab operators and functions Name Description Page reference

Table 1 Principle Matlab operators and functions Name Description Page reference Matlab Index Table 1 summarises the Matlab supplied operators and functions to which we have referred. In most cases only a few of the options available to the individual functions have been fully utilised.

More information

LINEAR SYSTEMS, MATRICES, AND VECTORS

LINEAR SYSTEMS, MATRICES, AND VECTORS ELEMENTARY LINEAR ALGEBRA WORKBOOK CREATED BY SHANNON MARTIN MYERS LINEAR SYSTEMS, MATRICES, AND VECTORS Now that I ve been teaching Linear Algebra for a few years, I thought it would be great to integrate

More information

FF505 Computational Science. Matrix Calculus. Marco Chiarandini

FF505 Computational Science. Matrix Calculus. Marco Chiarandini FF505 Computational Science Matrix Calculus Marco Chiarandini (marco@imada.sdu.dk) Department of Mathematics and Computer Science (IMADA) University of Southern Denmark Resume MATLAB, numerical computing

More information

ADDITIONAL MATHEMATICS

ADDITIONAL MATHEMATICS ADDITIONAL MATHEMATICS GCE Ordinary Level (Syllabus 4018) CONTENTS Page NOTES 1 GCE ORDINARY LEVEL ADDITIONAL MATHEMATICS 4018 2 MATHEMATICAL NOTATION 7 4018 ADDITIONAL MATHEMATICS O LEVEL (2009) NOTES

More information

B553 Lecture 5: Matrix Algebra Review

B553 Lecture 5: Matrix Algebra Review B553 Lecture 5: Matrix Algebra Review Kris Hauser January 19, 2012 We have seen in prior lectures how vectors represent points in R n and gradients of functions. Matrices represent linear transformations

More information

Math Assignment 3 - Linear Algebra

Math Assignment 3 - Linear Algebra Math 216 - Assignment 3 - Linear Algebra Due: Tuesday, March 27. Nothing accepted after Thursday, March 29. This is worth 15 points. 10% points off for being late. You may work by yourself or in pairs.

More information

Elementary Linear Algebra

Elementary Linear Algebra Elementary Linear Algebra Linear algebra is the study of; linear sets of equations and their transformation properties. Linear algebra allows the analysis of; rotations in space, least squares fitting,

More information

Contents. 1 Vectors, Lines and Planes 1. 2 Gaussian Elimination Matrices Vector Spaces and Subspaces 124

Contents. 1 Vectors, Lines and Planes 1. 2 Gaussian Elimination Matrices Vector Spaces and Subspaces 124 Matrices Math 220 Copyright 2016 Pinaki Das This document is freely redistributable under the terms of the GNU Free Documentation License For more information, visit http://wwwgnuorg/copyleft/fdlhtml Contents

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

APPENDIX A. Background Mathematics. A.1 Linear Algebra. Vector algebra. Let x denote the n-dimensional column vector with components x 1 x 2.

APPENDIX A. Background Mathematics. A.1 Linear Algebra. Vector algebra. Let x denote the n-dimensional column vector with components x 1 x 2. APPENDIX A Background Mathematics A. Linear Algebra A.. Vector algebra Let x denote the n-dimensional column vector with components 0 x x 2 B C @. A x n Definition 6 (scalar product). The scalar product

More information

Assignment 6, Math 575A

Assignment 6, Math 575A Assignment 6, Math 575A Part I Matlab Section: MATLAB has special functions to deal with polynomials. Using these commands is usually recommended, since they make the code easier to write and understand

More information

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu MATLAB BASICS Instructor: Prof. Shahrouk Ahmadi 1. What are M-files TA: Kartik Bulusu M-files are files that contain a collection of MATLAB commands or are used to define new MATLAB functions. For the

More information

SECTION 2: VECTORS AND MATRICES. ENGR 112 Introduction to Engineering Computing

SECTION 2: VECTORS AND MATRICES. ENGR 112 Introduction to Engineering Computing SECTION 2: VECTORS AND MATRICES ENGR 112 Introduction to Engineering Computing 2 Vectors and Matrices The MAT in MATLAB 3 MATLAB The MATrix (not MAThematics) LABoratory MATLAB assumes all numeric variables

More information

Algebra II Vocabulary Alphabetical Listing. Absolute Maximum: The highest point over the entire domain of a function or relation.

Algebra II Vocabulary Alphabetical Listing. Absolute Maximum: The highest point over the entire domain of a function or relation. Algebra II Vocabulary Alphabetical Listing Absolute Maximum: The highest point over the entire domain of a function or relation. Absolute Minimum: The lowest point over the entire domain of a function

More information

Some Notes on Linear Algebra

Some Notes on Linear Algebra Some Notes on Linear Algebra prepared for a first course in differential equations Thomas L Scofield Department of Mathematics and Statistics Calvin College 1998 1 The purpose of these notes is to present

More information

Linear Algebra. Min Yan

Linear Algebra. Min Yan Linear Algebra Min Yan January 2, 2018 2 Contents 1 Vector Space 7 1.1 Definition................................. 7 1.1.1 Axioms of Vector Space..................... 7 1.1.2 Consequence of Axiom......................

More information

Elementary Linear Algebra

Elementary Linear Algebra Matrices J MUSCAT Elementary Linear Algebra Matrices Definition Dr J Muscat 2002 A matrix is a rectangular array of numbers, arranged in rows and columns a a 2 a 3 a n a 2 a 22 a 23 a 2n A = a m a mn We

More information

MAT 275 Laboratory 7 Laplace Transform and the Symbolic Math Toolbox

MAT 275 Laboratory 7 Laplace Transform and the Symbolic Math Toolbox Laplace Transform and the Symbolic Math Toolbox 1 MAT 275 Laboratory 7 Laplace Transform and the Symbolic Math Toolbox In this laboratory session we will learn how to 1. Use the Symbolic Math Toolbox 2.

More information

8. Diagonalization.

8. Diagonalization. 8. Diagonalization 8.1. Matrix Representations of Linear Transformations Matrix of A Linear Operator with Respect to A Basis We know that every linear transformation T: R n R m has an associated standard

More information

Fundamentals of Linear Algebra. Marcel B. Finan Arkansas Tech University c All Rights Reserved

Fundamentals of Linear Algebra. Marcel B. Finan Arkansas Tech University c All Rights Reserved Fundamentals of Linear Algebra Marcel B. Finan Arkansas Tech University c All Rights Reserved 2 PREFACE Linear algebra has evolved as a branch of mathematics with wide range of applications to the natural

More information

Companion. Jeffrey E. Jones

Companion. Jeffrey E. Jones MATLAB7 Companion 1O11OO1O1O1OOOO1O1OO1111O1O1OO 1O1O1OO1OO1O11OOO1O111O1O1O1O1 O11O1O1O11O1O1O1O1OO1O11O1O1O1 O1O1O1111O11O1O1OO1O1O1O1OOOOO O1111O1O1O1O1O1O1OO1OO1OO1OOO1 O1O11111O1O1O1O1O Jeffrey E.

More information

GRAPHIC WEEK 7 DR. USMAN ULLAH SHEIKH DR. MUSA MOHD MOKJI DR. MICHAEL TAN LOONG PENG DR. AMIRJAN NAWABJAN DR. MOHD ADIB SARIJARI

GRAPHIC WEEK 7 DR. USMAN ULLAH SHEIKH DR. MUSA MOHD MOKJI DR. MICHAEL TAN LOONG PENG DR. AMIRJAN NAWABJAN DR. MOHD ADIB SARIJARI GRAPHIC SKEE1022 SCIENTIFIC PROGRAMMING WEEK 7 DR. USMAN ULLAH SHEIKH DR. MUSA MOHD MOKJI DR. MICHAEL TAN LOONG PENG DR. AMIRJAN NAWABJAN DR. MOHD ADIB SARIJARI 1 OBJECTIVE 2-dimensional line plot function

More information

Introduction to Matrices

Introduction to Matrices POLS 704 Introduction to Matrices Introduction to Matrices. The Cast of Characters A matrix is a rectangular array (i.e., a table) of numbers. For example, 2 3 X 4 5 6 (4 3) 7 8 9 0 0 0 Thismatrix,with4rowsand3columns,isoforder

More information

Chapter 4. Vector Space Examples. 4.1 Diffusion Welding and Heat States

Chapter 4. Vector Space Examples. 4.1 Diffusion Welding and Heat States Chapter 4 Vector Space Examples 4.1 Diffusion Welding and Heat States In this section, we begin a deeper look into the mathematics for diffusion welding application discussed in Chapter 1. Recall that

More information

APPENDIX: MATHEMATICAL INDUCTION AND OTHER FORMS OF PROOF

APPENDIX: MATHEMATICAL INDUCTION AND OTHER FORMS OF PROOF ELEMENTARY LINEAR ALGEBRA WORKBOOK/FOR USE WITH RON LARSON S TEXTBOOK ELEMENTARY LINEAR ALGEBRA CREATED BY SHANNON MARTIN MYERS APPENDIX: MATHEMATICAL INDUCTION AND OTHER FORMS OF PROOF When you are done

More information

Math Precalculus I University of Hawai i at Mānoa Spring

Math Precalculus I University of Hawai i at Mānoa Spring Math 135 - Precalculus I University of Hawai i at Mānoa Spring - 2014 Created for Math 135, Spring 2008 by Lukasz Grabarek and Michael Joyce Send comments and corrections to lukasz@math.hawaii.edu Contents

More information

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b) Numerical Methods - PROBLEMS. The Taylor series, about the origin, for log( + x) is x x2 2 + x3 3 x4 4 + Find an upper bound on the magnitude of the truncation error on the interval x.5 when log( + x)

More information

Algebraic. techniques1

Algebraic. techniques1 techniques Algebraic An electrician, a bank worker, a plumber and so on all have tools of their trade. Without these tools, and a good working knowledge of how to use them, it would be impossible for them

More information

Linear Algebra Massoud Malek

Linear Algebra Massoud Malek CSUEB Linear Algebra Massoud Malek Inner Product and Normed Space In all that follows, the n n identity matrix is denoted by I n, the n n zero matrix by Z n, and the zero vector by θ n An inner product

More information

Jim Lambers MAT 610 Summer Session Lecture 2 Notes

Jim Lambers MAT 610 Summer Session Lecture 2 Notes Jim Lambers MAT 610 Summer Session 2009-10 Lecture 2 Notes These notes correspond to Sections 2.2-2.4 in the text. Vector Norms Given vectors x and y of length one, which are simply scalars x and y, the

More information

8.5 Taylor Polynomials and Taylor Series

8.5 Taylor Polynomials and Taylor Series 8.5. TAYLOR POLYNOMIALS AND TAYLOR SERIES 50 8.5 Taylor Polynomials and Taylor Series Motivating Questions In this section, we strive to understand the ideas generated by the following important questions:

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

Scientific Computing: Dense Linear Systems

Scientific Computing: Dense Linear Systems Scientific Computing: Dense Linear Systems Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course MATH-GA.2043 or CSCI-GA.2112, Spring 2012 February 9th, 2012 A. Donev (Courant Institute)

More information

Extra Problems for Math 2050 Linear Algebra I

Extra Problems for Math 2050 Linear Algebra I Extra Problems for Math 5 Linear Algebra I Find the vector AB and illustrate with a picture if A = (,) and B = (,4) Find B, given A = (,4) and [ AB = A = (,4) and [ AB = 8 If possible, express x = 7 as

More information

Linear Algebra. Matrices Operations. Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0.

Linear Algebra. Matrices Operations. Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0. Matrices Operations Linear Algebra Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0 The rectangular array 1 2 1 4 3 4 2 6 1 3 2 1 in which the

More information

Homework 1 Solutions

Homework 1 Solutions 18-9 Signals and Systems Profs. Byron Yu and Pulkit Grover Fall 18 Homework 1 Solutions Part One 1. (8 points) Consider the DT signal given by the algorithm: x[] = 1 x[1] = x[n] = x[n 1] x[n ] (a) Plot

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

Matrices and Determinants

Matrices and Determinants Chapter1 Matrices and Determinants 11 INTRODUCTION Matrix means an arrangement or array Matrices (plural of matrix) were introduced by Cayley in 1860 A matrix A is rectangular array of m n numbers (or

More information