Download MATH2605 Homework 4: Matlab Scripting, Symbolics, Eigenvalues, and Nonlinear Surfaces and more Assignments Mathematics in PDF only on Docsity! [MATH2605] Homework 4 Feb. 2 - Feb. 9 Problem 1: Matlab Practice #2 We will learn writing matlab scripts and using symbolics. Answer or do questions with ∗. 1. Try pwd. This will show you the current working directory. You can use cd command to move to any other directory. You may create a matlab directory in your home directory and move to there. 2. Matlab script is a text file with extension ’m’. Try edit test1.m. This will open the matlab editor with a file ”test1.m”. You can write any matlab command and save the script file. You can execute this script by test1. ∗From internet or matlab help, can you find whether this script is interpreted or compiled? 3. Try help function. ∗Create a script that takes a matrix, and compute and return the largest and smallest eigenval- ues. You may submit hand-written (or printed) copy of the script. 4. We now try symbolics. This will allow you to compute partial derivatives quickly. Try syms x y real;. This will declare real variables x and y. 5. Define a function f (x,y) by f = (3*(1+x)̂ 2 + x*yˆ3 + yˆ2) / (1+xˆ2+yˆ2). 6. Try help sym/diff and read help. ∗What is the command that computes ∂ f ∂x and ∂ f ∂y ? 7. Try help pretty and read help. Try help simplify and read help. ∗Using the simplify and pretty commands, compute and submit the simplified forms of ∂ f ∂x and ∂ f ∂y ? 8. ∗What are the commands that compute ∂ ∂y ∂ f ∂x and ∂ ∂x ∂ f ∂y ? ∗Is ∂ ∂x ∂ f ∂y = ∂ ∂y ∂ f ∂x true? Problem 2 Last week, we have computed eigenvalues and eigenvectors of the two matrices A = −1 2 2−1 2 1 −2 2 3 , and B = 1 4 3−7 8 6 2 2 3 . The matrix A has eigenvalues {1,1,2}, where 1 is the eigenvalue with multiplicity 2 that has two linearly independent eigenvectors. In contrast, B has eigenvalues {3,3,6}, where 3 is the eigenvalue with multiplicity 2, but it has only one linearly independent eigenvector. Note that A has three linearly independent eigenvectors: two associated with 1 and another associated with 2. There- fore, we can construct an invertible eigenvector matrix VA and the diagonal eigenvalue matrix DA so that AVA = VADA. Since VA is invertible, we can right multiply V−1A to obtain an eigenvalue decomposition A = VADAV −1 A . Since DA is diagonal, we say A is diagonalizable. However, even though we can construct an eigenvector matrix VB and the diagonal eigenvalue matrix DB so that BVB = VBDB, the eigenvector matrix VB is not invertible. There are only two eigenvectors: one associated with 3 and 1