advertisement

Math 442 Assignment 1 - Spring 2015 Due Friday, January 30th 1. Use MATLAB to evaluate the following expressions correct to four decimal places. Print out a diary session of your MATLAB commands. π (a) cos − 1 3 √ 2 (b) e − 1 (c) e3 ln(5) √ 2 π + tan−1 ( 3) (d) sin 4 (e) sin2 (20◦ ) + cos2 (75◦ ) 2. Use MATLAB to solve the following problems. Print out a diary session of your MATLAB commands. (a) Find the magnitude of the vector ~v = [−1, 2, −3, 5]. (b) Find the magnitude of the vector w ~ = [1 + i, 3i, 2, 1 + 2i]. (c) Consider the matrices 1 2 3 A = 2 3 1 3 2 1 and 2 4 6 B = 6 2 4 . 1 5 7 i. Compute AB and BA. ii. Define a 3 × 3 matrix, C, whose (m, n) entry is the product of the (m, n) entries of A and B. (d) Consider the following system of equations: x + 2y + 3z = 12 −4x + y + 2z = 13 2x + 7y − 3z = 2. i. What is the determinant of the coefficient matrix? ii. Use matrices to find a solution of this set of equations. 3. Use the solve command in MATLAB to solve the following equations. (Hint: You may need to use the eval or double commands to simplify the MATLAB output). Print out a diary session of your MATLAB commands. (a) x3 + 2x2 + 5x − 1 = 0 (b) x3 − 3x2 + 2x = 1 4x − y + 5z = 2 3x + y − 3z = 4. 1 4. Use MATLAB to evaluate the following expressions. Print out a diary session of your MATLAB commands. √ x − 3x − 2 (a) lim x→2 x2 − 4 ! 2 d ex − 1 √ (b) dx x2 + 1 d2 (x2 + y 2 + tan xy) dy 2 Z (d) x tan xdx (c) Z (e) 5 e3x cos xdx 0 5. Write a single MATLAB script M-file to generate the following plots. Use the plot command rather than ezplot or fplot. Print out your script and a separate plot for each part. (Hint: Use the figure command before each plot command to generate the figures in different windows.) (a) Plot the function f (x) = x + sin(x) for x ∈ [0, 10]. Label the x and y axes and add a title to the plot. (b) Plot the functions g(x) = e−x and h(x) = x2 on a single figure for 0 ≤ x ≤ 1. The graph of g(x) should be a solid blue line and the graph of h(x) should be a dashed red line. Label the x and y axes and include a legend in your plot. (c) Consider the parametric curve in R2 defined by x(t) = e−t sin t, y(t) = e−t cos t for 0 ≤ t ≤ 10. Generate a single figure with two subplots. In the first subplot, graph x(t) and y(t) as functions of t. In the second plot, graph the curve in the xy-plane. Label the x and y axes in each subplot and include a legend in the first subplot. 6. (Radioactive Decay) Let y(t) denote the mass of a radioactive substance at time t ≥ 0. The Law of Radioactive Decay states that the substance decays at a rate proportional to its mass. That is, dy = −ky, dt where k > 0 is the decay rate for the substance. The solution of this differential equation is y(t) = y(0)e−kt . (a) Write a function M-file which takes as input the decay rate k, the initial mass y(0), a final time T > 0, and returns the following: i. The half-life of the substance. ii. A plot of the mass y(t) = y(0)e−kt for t ∈ [0, T ]. Be sure to label your axes! 2 (b) Suppose that a substance has an initial mass of 500 mg and decay rate k = 0.0001 day−1 . Use your function to determine the half-life of this substance (in days) and plot the mass over a period of 10 days. Include your M-file, a diary session of its implementation, and the figure your function generates. 7. (Bilinear Forms) Consider the bilinear form BA (~v , w) ~ = ~v T Aw, ~ where A is any n × n matrix and ~v and w ~ are n × 1 column vectors. (a) Write a MATLAB function M-file that takes as input an n × n matrix A, two n × 1 vectors ~v and w, ~ and returns the value BA (~v , w). ~ (b) Use your function to compute BA (~v , w) ~ for 1 2 3 4 −1 5 6 7 8 −1 A= ~v = 9 10 11 12 1 13 14 15 16 0 0 1 w ~ = 0 . 1 Include both the M-file and a diary session of its implementation. 3