MATLAB Tutorial

Total Page:16

File Type:pdf, Size:1020Kb

MATLAB Tutorial MATLAB Tutorial You need a small numb er of basic commands to start using MATLAB This short tutorial describ es those fundamental commands You need to create vectors and matrices to change operate with them Those are all short highlevel commands b ecause MATLAB them and to constantly works with matrices I b elieve that you will like the p ower that this software gives by a series of short instructions to do linear algebra create E create u change E multiply E u E eye E E u v E u 2 3 2 3 2 3 2 3 4 5 4 5 4 5 4 5 The word eye stands for the identity matrix The submatrix u E picks out column E resets the entry to The command E u multiplies the The instruction u All these commands are rep eated in our list b elow Here is an example matrices E and inverting a matrix and solving a linear system of create A create b invert A solve Ax b A C invA x Anb or A ones eye b x C b 2 3 2 3 2 3 2 3 4 5 4 5 4 5 4 5 The matrix of all ones was added to eye and b is its third column Then invA pro duces inverse matrix normally in decimals for fractions use format rat The system Ax b the solved by x invA b which is the slow way The backslash command x Anb uses is never computes the inverse matrix When the right Gaussian elimination if A is square and 0 A the solution x must b e The transpose symbol side b equals the third column of vector Then A x picks out the third column of A and we have Ax b makes x a column Here are a few comments The comment symb ol is The symb ols a and A are dierent MATLAB is casesensitive Typ e help slash for a description of how to use the backslash symb ol The word help b e followed by a MATLAB symb ol or command name or Mle name can Note The command name is upp er case in the description given by help but must b e lower case in actual use And the backslash Anb is dierent when A is not square To display all digits typ e format long The normal format short gives digits after the decimal after a command avoids display of the result A semicolon display the identity matrix A ones will not uparrow cursor to return to previous commands Use the How to input a row or column vector u has one row with three comp onents a matrix rows separated by semicolons a matrix v has three 0 0 v or v u transposes u to pro duce the same v w generates the row vector w with unit steps takes steps of to give u u How to input a matrix a row at a time A has two rows always a semicolon b etween rows A also pro duces the matrix A but is harder to typ e 0 T 0 B is the transpose of A Thus A is A in MATLAB How to create sp ecial matrices diagv pro duces the diagonal matrix with vector v on its diagonal to eplitzv gives the symmetric constantdiagonal matrix with v as rst row and rst col umn to eplitzw v gives the constantdiagonal matrix with w as rst column and v as rst row onesn gives an n n matrix of ones zerosn gives an n n matrix of zeros eyen gives the n n identity matrix randn gives an n n matrix with random entries b etween and uniform distribution randnn gives an n n matrix with normally distributed entries mean and variance onesm n zerosm n randm n give m n matrices onessizeA zerossizeA eyesizeA give matrices of the same shap e as A How to change entries in a given matrix A A resets the entry to equal A v resets the third row to equal v A w resets the second column to equal w The colon symb ol stands for al l all columns or all rows A A exchanges rows and of A How to create submatrices of an m � n matrix A Ai j returns the i j entry of the matrix A scalar matrix Ai returns the ith row of A as row vector A j returns the j th column of A as column vector A returns rows from to and columns from to as matrix A returns rows and and all columns as n matrix A returns one long column formed from the columns of A mn matrix triuA sets all entries b elow the main diagonal to zero upp er triangular trilA sets all entries ab ove the main diagonal to zero lower triangular Matrix multiplication and inversion A B gives the matrix pro duct AB if A can multiply B A B gives the entrybyentry pro duct if sizeA sizeB ;1 invA gives A if A is square and invertible pinvA gives the pseudoinverse of A AnB gives inv A B if invA exists backslash is left division Anb gives the solution to Ax b if invA exists x See help slash when A is a rectangular matrix Numb ers and matrices asso ciated with A detA is the determinant if A is a square matrix rankA is the rank numb er of pivots dimension of row space and of column space sizeA is the pair of numb ers m n traceA is the trace sum of diagonal entries sum of eigenvalues nullA is a matrix whose n r columns are an orthogonal basis for the nullspace of A orthA is a matrix whose r columns are an orthogonal basis for the column space of A Examples E eye E creates a elementary elimination matrix A subtracts times row of A from row E A b creates the augmented matrix with b as extra column B eye P E creates a p ermutation matrix E triuA trilA diagdiagA equals A Note that Builtin Mles for matrix factorizations all imp ortant L U P luA gives three matrices with P A LU e eig A is a vector containing the eigenvalues of A S E eig A gives a diagonal eigenvalue matrix E and eigenvector matrix S with AS S E If A is not diagonalizable to o few eigenvectors then S is not invertible Q R qrA gives an m m orthogonal matrix Q and m n triangular R with A QR Creating Mles Mles are text les ending with m which MATLAB uses for functions and scripts A script which may b e executed often and can b e placed in an mle so is a sequence of commands do not have to b e retyp ed MATLABs demos are examples of these scripts the commands house Most of MATLABs functions are actually mles An example is the demo called viewed by writing type xxx where xxx is the name of the function and can b e To write your own scripts or functions you have to create a new text le with any name you like provided it ends with m so MATLAB will recognize it Text les can b e created saved with any text editor like emacs EZ or vi A script le is simply a list of edited and MATLAB commands When the le name is typ ed at the MATLAB prompt the contents of le will b e executed For an mle to b e a function it must start with the word function the followed by the output variables in brackets the function name and the input variables Examples function CmultA rrankA 0 A A C Save the ab ove commands into a text le named multm Then this funtion will take a pro duct C The variable r is not returned b ecause it matrix A and return only the matrix was not included as an output variable The commands are followed by so that they will printed to the MATLAB window every time they are executed It is useful when not b e dealing with large matrices Here is another example function VDrpropertiesA rank eigenvalues and eigenvectors of A This function nds the mnsizeA if mn VDeigA rrankA else dispError The matrix must be square end Here the function takes the matrix A as input and only returns two matrices and the rank comment The function checks to see if the input ma as output The is used as a trix is square and then nds the rank eigenvalues and eigenvectors of a matrix A Typing propertiesA only returns the rst output V the matrix of eigenvectors You must typ e VDrpropertiesA to get all three outputs Keeping a diary of your work The command diaryle tells MATLAB to record everything done in the MATLAB window and save the results in the text le named le Typing diary on or diary o b e viewed using a text editor or printed using lpr toggles the recording Old diary les can MATLAB they can b e viewed using the typ e le command in unix In Saving your variables and matrices The command diary saves the commands you typ ed as well as MATLABs output but it do es not save the content of your variables and matrices These variables can b e listed by which also lists the sizes of the matrices The command save xxx the command whos save the matrices and all variables listed by the whos command into the le named will xxx MATLAB lab els these les with a mat extension instead of m which are scripts or by MATLAB at a later time by typing load xxx functions xxxmat les can b e read Graphics The simplest command is plotx y which uses two vectors x and y of the same length The will ints x y b e plotted and connected by solid lines p o i i If no vector x is given MATLAB assumes that xi i Then ploty has equal spacing xaxis the p oints are i y i on the The typ e and color of the line b etween p oints can b e changed by a third argument The with no argument is a solid black line Use help plot for many options we indi default cate only a few 0 0 MATLAB plotx y r plots in r red with for p oints and dotted line 0 0 0 0 MATLAB plotx y is a dashed line and plotx y is a dotted line You can omit the lines and plot only the discrete p oints in dierent ways 0 0 0 0 0 0 0 0 plotx y o gives circles Other options are or or For two graphs on the same axes use plotx y X Y Replace plot by loglog or change one or b oth axes to logarithmic scale The command semilogy or semilogx to axis a b c d will scale the graph to lie in the rectangle a x b c y d To title the lab el the xaxis or the y axis put the desired lab el in quotes as in these examples graph or title height of satellite xlabel time in seconds y label height in meters The command hold keeps the current graph as you plot a new graph Rep eating hold To print or save the graphics window in a le see help print or use will clear the screen print Pprintername print d lename MIT OpenCourseWare http://ocw.mit.edu 18.06 Linear Algebra Spring 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Recommended publications
  • ADDITIVE MAPS on RANK K BIVECTORS 1. Introduction. Let N 2 Be an Integer and Let F Be a Field. We Denote by M N(F) the Algeb
    Electronic Journal of Linear Algebra, ISSN 1081-3810 A publication of the International Linear Algebra Society Volume 36, pp. 847-856, December 2020. ADDITIVE MAPS ON RANK K BIVECTORS∗ WAI LEONG CHOOIy AND KIAM HEONG KWAy V2 Abstract. Let U and V be linear spaces over fields F and K, respectively, such that dim U = n > 2 and jFj > 3. Let U n−1 V2 V2 be the second exterior power of U. Fixing an even integer k satisfying 2 6 k 6 n, it is shown that a map : U! V satisfies (u + v) = (u) + (v) for all rank k bivectors u; v 2 V2 U if and only if is an additive map. Examples showing the indispensability of the assumption on k are given. Key words. Additive maps, Second exterior powers, Bivectors, Ranks, Alternate matrices. AMS subject classifications. 15A03, 15A04, 15A75, 15A86. 1. Introduction. Let n > 2 be an integer and let F be a field. We denote by Mn(F) the algebra of n×n matrices over F. Given a nonempty subset S of Mn(F), a map : Mn(F) ! Mn(F) is called commuting on S (respectively, additive on S) if (A)A = A (A) for all A 2 S (respectively, (A + B) = (A) + (B) for all A; B 2 S). In 2012, using Breˇsar'sresult [1, Theorem A], Franca [3] characterized commuting additive maps on invertible (respectively, singular) matrices of Mn(F). He continued to characterize commuting additive maps on rank k matrices of Mn(F) in [4], where 2 6 k 6 n is a fixed integer, and commuting additive maps on rank one matrices of Mn(F) in [5].
    [Show full text]
  • Immanants of Totally Positive Matrices Are Nonnegative
    IMMANANTS OF TOTALLY POSITIVE MATRICES ARE NONNEGATIVE JOHN R. STEMBRIDGE Introduction Let Mn{k) denote the algebra of n x n matrices over some field k of characteristic zero. For each A>valued function / on the symmetric group Sn, we may define a corresponding matrix function on Mn(k) in which (fljji—• > X\w )&i (i)'"a ( )' (U weSn If/ is an irreducible character of Sn, these functions are known as immanants; if/ is an irreducible character of some subgroup G of Sn (extended trivially to all of Sn by defining /(vv) = 0 for w$G), these are known as generalized matrix functions. Note that the determinant and permanent are obtained by choosing / to be the sign character and trivial character of Sn, respectively. We should point out that it is more traditional to use /(vv) in (1) where we have used /(W1). This change can be undone by transposing the matrix. If/ happens to be a character, then /(w-1) = x(w), so the generalized matrix function we have indexed by / is the complex conjugate of the traditional one. Since the characters of Sn are real (and integral), it follows that there is no difference between our indexing of immanants and the traditional one. It is convenient to associate with each AeMn(k) the following element of the group algebra kSn: [A]:= £ flliW(1)...flBiW(B)-w~\ In terms of this notation, the matrix function defined by (1) can be described more simply as A\—+x\Ai\, provided that we extend / linearly to kSn. Note that if we had used w in place of vv"1 here and in (1), then the restriction of [•] to the group of permutation matrices would have been an anti-homomorphism, rather than a homomorphism.
    [Show full text]
  • Some Classes of Hadamard Matrices with Constant Diagonal
    BULL. AUSTRAL. MATH. SOC. O5BO5. 05B20 VOL. 7 (1972), 233-249. • Some classes of Hadamard matrices with constant diagonal Jennifer Wallis and Albert Leon Whiteman The concepts of circulant and backcircul-ant matrices are generalized to obtain incidence matrices of subsets of finite additive abelian groups. These results are then used to show the existence of skew-Hadamard matrices of order 8(1*f+l) when / is odd and 8/ + 1 is a prime power. This shows the existence of skew-Hadamard matrices of orders 296, 592, 118U, l6kO, 2280, 2368 which were previously unknown. A construction is given for regular symmetric Hadamard matrices with constant diagonal of order M2m+l) when a symmetric conference matrix of order km + 2 exists and there are Szekeres difference sets, X and J , of size m satisfying x € X =» -x £ X , y £ Y ~ -y d X . Suppose V is a finite abelian group with v elements, written in additive notation. A difference set D with parameters (v, k, X) is a subset of V with k elements and such that in the totality of all the possible differences of elements from D each non-zero element of V occurs X times. If V is the set of integers modulo V then D is called a cyclic difference set: these are extensively discussed in Baumert [/]. A circulant matrix B = [b. •) of order v satisfies b. = b . (j'-i+l reduced modulo v ), while B is back-circulant if its elements Received 3 May 1972. The authors wish to thank Dr VI.D. Wallis for helpful discussions and for pointing out the regularity in Theorem 16.
    [Show full text]
  • Do Killingâ•Fiyano Tensors Form a Lie Algebra?
    University of Massachusetts Amherst ScholarWorks@UMass Amherst Physics Department Faculty Publication Series Physics 2007 Do Killing–Yano tensors form a Lie algebra? David Kastor University of Massachusetts - Amherst, [email protected] Sourya Ray University of Massachusetts - Amherst Jennie Traschen University of Massachusetts - Amherst, [email protected] Follow this and additional works at: https://scholarworks.umass.edu/physics_faculty_pubs Part of the Physics Commons Recommended Citation Kastor, David; Ray, Sourya; and Traschen, Jennie, "Do Killing–Yano tensors form a Lie algebra?" (2007). Classical and Quantum Gravity. 1235. Retrieved from https://scholarworks.umass.edu/physics_faculty_pubs/1235 This Article is brought to you for free and open access by the Physics at ScholarWorks@UMass Amherst. It has been accepted for inclusion in Physics Department Faculty Publication Series by an authorized administrator of ScholarWorks@UMass Amherst. For more information, please contact [email protected]. Do Killing-Yano tensors form a Lie algebra? David Kastor, Sourya Ray and Jennie Traschen Department of Physics University of Massachusetts Amherst, MA 01003 ABSTRACT Killing-Yano tensors are natural generalizations of Killing vec- tors. We investigate whether Killing-Yano tensors form a graded Lie algebra with respect to the Schouten-Nijenhuis bracket. We find that this proposition does not hold in general, but that it arXiv:0705.0535v1 [hep-th] 3 May 2007 does hold for constant curvature spacetimes. We also show that Minkowski and (anti)-deSitter spacetimes have the maximal num- ber of Killing-Yano tensors of each rank and that the algebras of these tensors under the SN bracket are relatively simple exten- sions of the Poincare and (A)dS symmetry algebras.
    [Show full text]
  • An Infinite Dimensional Birkhoff's Theorem and LOCC-Convertibility
    An infinite dimensional Birkhoff's Theorem and LOCC-convertibility Daiki Asakura Graduate School of Information Systems, The University of Electro-Communications, Tokyo, Japan August 29, 2016 Preliminary and Notation[1/13] Birkhoff's Theorem (: matrix analysis(math)) & in infinite dimensinaol Hilbert space LOCC-convertibility (: quantum information ) Notation H, K : separable Hilbert spaces. (Unless specified otherwise dim = 1) j i; jϕi 2 H ⊗ K : unit vectors. P1 P1 majorization: for σ = a jx ihx j, ρ = b jy ihy j 2 S(H), P Pn=1 n n n n=1 n n n ≺ () n # ≤ n # 8 2 N σ ρ i=1 ai i=1 bi ; n . def j i ! j i () 9 2 N [ f1g 9 H f gn 9 ϕ n , POVM on Mi i=1 and a set of LOCC def K f gn unitary on Ui i=1 s.t. Xn j ih j ⊗ j ih j ∗ ⊗ ∗ ϕ ϕ = (Mi Ui ) (Mi Ui ); in C1(H): i=1 H jj · jj "in C1(H)" means the convergence in Banach space (C1( ); 1) when n = 1. LOCC-convertibility[2/13] Theorem(Nielsen, 1999)[1][2, S12.5.1] : the case dim H, dim K < 1 j i ! jϕi () TrK j ih j ≺ TrK jϕihϕj LOCC Theorem(Owari et al, 2008)[3] : the case of dim H, dim K = 1 j i ! jϕi =) TrK j ih j ≺ TrK jϕihϕj LOCC TrK j ih j ≺ TrK jϕihϕj =) j i ! jϕi ϵ−LOCC where " ! " means "with (for any small) ϵ error by LOCC". ϵ−LOCC TrK j ih j ≺ TrK jϕihϕj ) j i ! jϕi in infinite dimensional space has LOCC been open.
    [Show full text]
  • Alternating Sign Matrices and Polynomiography
    Alternating Sign Matrices and Polynomiography Bahman Kalantari Department of Computer Science Rutgers University, USA [email protected] Submitted: Apr 10, 2011; Accepted: Oct 15, 2011; Published: Oct 31, 2011 Mathematics Subject Classifications: 00A66, 15B35, 15B51, 30C15 Dedicated to Doron Zeilberger on the occasion of his sixtieth birthday Abstract To each permutation matrix we associate a complex permutation polynomial with roots at lattice points corresponding to the position of the ones. More generally, to an alternating sign matrix (ASM) we associate a complex alternating sign polynomial. On the one hand visualization of these polynomials through polynomiography, in a combinatorial fashion, provides for a rich source of algo- rithmic art-making, interdisciplinary teaching, and even leads to games. On the other hand, this combines a variety of concepts such as symmetry, counting and combinatorics, iteration functions and dynamical systems, giving rise to a source of research topics. More generally, we assign classes of polynomials to matrices in the Birkhoff and ASM polytopes. From the characterization of vertices of these polytopes, and by proving a symmetry-preserving property, we argue that polynomiography of ASMs form building blocks for approximate polynomiography for polynomials corresponding to any given member of these polytopes. To this end we offer an algorithm to express any member of the ASM polytope as a convex of combination of ASMs. In particular, we can give exact or approximate polynomiography for any Latin Square or Sudoku solution. We exhibit some images. Keywords: Alternating Sign Matrices, Polynomial Roots, Newton’s Method, Voronoi Diagram, Doubly Stochastic Matrices, Latin Squares, Linear Programming, Polynomiography 1 Introduction Polynomials are undoubtedly one of the most significant objects in all of mathematics and the sciences, particularly in combinatorics.
    [Show full text]
  • Preserivng Pieces of Information in a Given Order in HRR and GA$ C$
    Proceedings of the Federated Conference on ISBN 978-83-60810-22-4 Computer Science and Information Systems pp. 213–220 Preserivng pieces of information in a given order in HRR and GAc Agnieszka Patyk-Ło´nska Abstract—Geometric Analogues of Holographic Reduced Rep- Secondly, this method of encoding will not detect similarity resentations (GA HRR or GAc—the continuous version of between eye and yeye. discrete GA described in [16]) employ role-filler binding based A quantum-like attempt to tackle the problem of information on geometric products. Atomic objects are real-valued vectors in n-dimensional Euclidean space and complex statements belong to ordering was made in [1]—a version of semantic analysis, a hierarchy of multivectors. A property of GAc and HRR studied reformulated in terms of a Hilbert-space problem, is compared here is the ability to store pieces of information in a given order with structures known from quantum mechanics. In particular, by means of trajectory association. We describe results of an an LSA matrix representation [1], [10] is rewritten by the experiment: finding the alignment of items in a sequence without means of quantum notation. Geometric algebra has also been the precise knowledge of trajectory vectors. Index Terms—distributed representations, geometric algebra, used extensively in quantum mechanics ([2], [4], [3]) and so HRR, BSC, word order, trajectory associations, bag of words. there seems to be a natural connection between LSA and GAc, which is the ground for fututre work on the problem I. INTRODUCTION of preserving pieces of information in a given order. VER the years several attempts have been made to As far as convolutions are concerned, the most interesting O preserve the order in which the objects are to be remem- approach to remembering information in a given order has bered with the help of binding and superposition.
    [Show full text]
  • Counterfactual Explanations for Graph Neural Networks
    CF-GNNExplainer: Counterfactual Explanations for Graph Neural Networks Ana Lucic Maartje ter Hoeve Gabriele Tolomei University of Amsterdam University of Amsterdam Sapienza University of Rome Amsterdam, Netherlands Amsterdam, Netherlands Rome, Italy [email protected] [email protected] [email protected] Maarten de Rijke Fabrizio Silvestri University of Amsterdam Sapienza University of Rome Amsterdam, Netherlands Rome, Italy [email protected] [email protected] ABSTRACT that result in an alternative output response (i.e., prediction). If Given the increasing promise of Graph Neural Networks (GNNs) in the modifications recommended are also clearly actionable, this is real-world applications, several methods have been developed for referred to as achieving recourse [12, 28]. explaining their predictions. So far, these methods have primarily To motivate our problem, we consider an ML application for focused on generating subgraphs that are especially relevant for computational biology. Drug discovery is a task that involves gen- a particular prediction. However, such methods do not provide erating new molecules that can be used for medicinal purposes a clear opportunity for recourse: given a prediction, we want to [26, 33]. Given a candidate molecule, a GNN can predict if this understand how the prediction can be changed in order to achieve molecule has a certain property that would make it effective in a more desirable outcome. In this work, we propose a method for treating a particular disease [9, 19, 32]. If the GNN predicts it does generating counterfactual (CF) explanations for GNNs: the minimal not have this desirable property, CF explanations can help identify perturbation to the input (graph) data such that the prediction the minimal change one should make to this molecule, such that it changes.
    [Show full text]
  • 8 Rank of a Matrix
    8 Rank of a matrix We already know how to figure out that the collection (v1;:::; vk) is linearly dependent or not if each n vj 2 R . Recall that we need to form the matrix [v1 j ::: j vk] with the given vectors as columns and see whether the row echelon form of this matrix has any free variables. If these vectors linearly independent (this is an abuse of language, the correct phrase would be \if the collection composed of these vectors is linearly independent"), then, due to the theorems we proved, their span is a subspace of Rn of dimension k, and this collection is a basis of this subspace. Now, what if they are linearly dependent? Still, their span will be a subspace of Rn, but what is the dimension and what is a basis? Naively, I can answer this question by looking at these vectors one by one. In particular, if v1 =6 0 then I form B = (v1) (I know that one nonzero vector is linearly independent). Next, I add v2 to this collection. If the collection (v1; v2) is linearly dependent (which I know how to check), I drop v2 and take v3. If independent then I form B = (v1; v2) and add now third vector v3. This procedure will lead to the vectors that form a basis of the span of my original collection, and their number will be the dimension. Can I do it in a different, more efficient way? The answer if \yes." As a side result we'll get one of the most important facts of the basic linear algebra.
    [Show full text]
  • 2.2 Kernel and Range of a Linear Transformation
    2.2 Kernel and Range of a Linear Transformation Performance Criteria: 2. (c) Determine whether a given vector is in the kernel or range of a linear trans- formation. Describe the kernel and range of a linear transformation. (d) Determine whether a transformation is one-to-one; determine whether a transformation is onto. When working with transformations T : Rm → Rn in Math 341, you found that any linear transformation can be represented by multiplication by a matrix. At some point after that you were introduced to the concepts of the null space and column space of a matrix. In this section we present the analogous ideas for general vector spaces. Definition 2.4: Let V and W be vector spaces, and let T : V → W be a transformation. We will call V the domain of T , and W is the codomain of T . Definition 2.5: Let V and W be vector spaces, and let T : V → W be a linear transformation. • The set of all vectors v ∈ V for which T v = 0 is a subspace of V . It is called the kernel of T , And we will denote it by ker(T ). • The set of all vectors w ∈ W such that w = T v for some v ∈ V is called the range of T . It is a subspace of W , and is denoted ran(T ). It is worth making a few comments about the above: • The kernel and range “belong to” the transformation, not the vector spaces V and W . If we had another linear transformation S : V → W , it would most likely have a different kernel and range.
    [Show full text]
  • 23. Kernel, Rank, Range
    23. Kernel, Rank, Range We now study linear transformations in more detail. First, we establish some important vocabulary. The range of a linear transformation f : V ! W is the set of vectors the linear transformation maps to. This set is also often called the image of f, written ran(f) = Im(f) = L(V ) = fL(v)jv 2 V g ⊂ W: The domain of a linear transformation is often called the pre-image of f. We can also talk about the pre-image of any subset of vectors U 2 W : L−1(U) = fv 2 V jL(v) 2 Ug ⊂ V: A linear transformation f is one-to-one if for any x 6= y 2 V , f(x) 6= f(y). In other words, different vector in V always map to different vectors in W . One-to-one transformations are also known as injective transformations. Notice that injectivity is a condition on the pre-image of f. A linear transformation f is onto if for every w 2 W , there exists an x 2 V such that f(x) = w. In other words, every vector in W is the image of some vector in V . An onto transformation is also known as an surjective transformation. Notice that surjectivity is a condition on the image of f. 1 Suppose L : V ! W is not injective. Then we can find v1 6= v2 such that Lv1 = Lv2. Then v1 − v2 6= 0, but L(v1 − v2) = 0: Definition Let L : V ! W be a linear transformation. The set of all vectors v such that Lv = 0W is called the kernel of L: ker L = fv 2 V jLv = 0g: 1 The notions of one-to-one and onto can be generalized to arbitrary functions on sets.
    [Show full text]
  • MATLAB Array Manipulation Tips and Tricks
    MATLAB array manipulation tips and tricks Peter J. Acklam E-mail: [email protected] URL: http://home.online.no/~pjacklam 14th August 2002 Abstract This document is intended to be a compilation of tips and tricks mainly related to efficient ways of performing low-level array manipulation in MATLAB. Here, “manipu- lation” means replicating and rotating arrays or parts of arrays, inserting, extracting, permuting and shifting elements, generating combinations and permutations of ele- ments, run-length encoding and decoding, multiplying and dividing arrays and calcu- lating distance matrics and so forth. A few other issues regarding how to write fast MATLAB code are also covered. I'd like to thank the following people (in alphabetical order) for their suggestions, spotting typos and other contributions they have made. Ken Doniger and Dr. Denis Gilbert Copyright © 2000–2002 Peter J. Acklam. All rights reserved. Any material in this document may be reproduced or duplicated for personal or educational use. MATLAB is a trademark of The MathWorks, Inc. (http://www.mathworks.com). TEX is a trademark of the American Mathematical Society (http://www.ams.org). Adobe PostScript and Adobe Acrobat Reader are trademarks of Adobe Systems Incorporated (http://www.adobe.com). The TEX source was written with the GNU Emacs text editor. The GNU Emacs home page is http://www.gnu.org/software/emacs/emacs.html. The TEX source was formatted with AMS-LATEX to produce a DVI (device independent) file. The PS (PostScript) version was created from the DVI file with dvips by Tomas Rokicki. The PDF (Portable Document Format) version was created from the PS file with ps2pdf, a part of Aladdin Ghostscript by Aladdin Enterprises.
    [Show full text]