MATH 552 Spectral Methods Spring Homework Set 5 - SOLUTIONS

Size: px
Start display at page:

Download "MATH 552 Spectral Methods Spring Homework Set 5 - SOLUTIONS"

Transcription

1 MATH 55 Spectral Methods Spring 9 Homework Set 5 - SOLUTIONS. Suppose you are given an n n linear system Ax = f where the matrix A is tridiagonal b c a b c. A = ,. a n b n c n a n b n with x = (x, x,..., x n ) T and f = (f, f,..., f n ) T. (a) Write a MATLAB M-file trisolve.m which computes the solution of the tridiagonal system Ax = f given the n-vectors a, b, c, and f. Include a copy of your code. The first line of the M-file should read function x = trisolve(a,b,c,f) (b) To check your code, let n =, a, b 5 and c. Compute the solution for f = (,,...,, ) T, with the exact solution easily seen to be x = (,..., ) T. Use the diary command in MATLAB to include a copy of your results. ANS: For (a) here is the code: function x = trisolve(a,b,c,f) % % TRISOLVE : tridiagonal solver for nxn system Ax=f where % A = diag(a(:n),-) + diag(b) + diag(c(:n-),) % n = length(b); x = zeros(n,); for i = :n end m = a(i)/b(i-); b(i) = b(i)-m*c(i); f(i) = f(i)-m*f(i-); % forward reduction x(n) = f(n)/b(n); % back substitution for i = n-:-: x(i) = (f(i)-c(i)*x(i+))/b(i); end To check that it works in MATLAB I executed >> a = -*ones(,); c = a; b = 5*ones(,); f = ones(,); f()=; f()=; >> x = trisolve(a,b,c,f);

2 >> x x = and indeed the answer is correct.

3 . Consider the discrete finite difference (FD) analog of the continuous eigenproblem d u dx = λu, < x < u() = u() = with d /dx D, the centered O(h ) FD approximation to the second derivative. To this end, choose N >, let h = /N and x i = i h for i =,,..., N. Note we now have N + grid points with x = and x N =. So we seek eigenpairs (λ, v) which satisfy (D v) i = v i v i + v i+ h = λv i for i =,,..., N, v = v N =, or in matrix form, h v v. v N v N = λ v v. v N v N (a) Show that (λ k, v k ) is an eigenpair for k =,,..., N where λ k = ( cos kπh)/h and v k is the vector with (v k ) i = sin ikπh for i =,,..., N. Hint: Use trig identities, and note that sin kπh = sin Nkπh =. (b) For N = 8 and N = 6 separately, plot (using MATLAB s subplot) the continuous eigenfunctions found in class, and the discrete eigenvectors from (a) for k =,, N/ and N. Thus each plot should have 4 images. Use a linetype for the continuous eigenfunctions and symbols for the discrete eigenvectors. Label and title your graphs. (c) In a single plot display the first eigenvalues vs. there number, i.e., k =,,..., of the continuous problem along with the N eigenvalues for the discrete case for N = 8, 6 and. For the continuous case plot the eigenvalues using a linetype with a symbol, and in the discrete case just symbols. Label, title, and place a legend on your plot. Discuss the results. ANS: (a) Noting that sin kπh = sin Nkπh =. Fix a k, k =,..., N. For i =,..., N, v k,i v k,i = v k,i+ h = = = = sin (i )kπh sin ikπh + sin (i + )kπh h (sin ikπh cos kπh cos ikπh sin kπh) sin ikπh+(sin ikπh cos kπh+cos ikπh sin kπh) h sin ikπh cos kπh sin ikπh h ( cos kπh) sin ikπh h = λ k sin ikπh. = λ k v k,i. So we have Av k = λ k v k for k =,..., N, thus (λ k, v k ) are e-pairs for k =,..., N.

4 (b) Here is the code for N = 8: N=8; h=/n; x=:h:; xx=:.:; k=[ N/ N-]; for i=:4 subplot(,,i) plot(xx,sin(k(i)*pi*xx),x,sin(k(i)*pi*x), o ) grid,axis( tight ) title([ sin(,numstr(k(i)), \pix): N=,numstr(N),, k=,numstr(k(i))]); end And the graphs for N = 8 and N = 6: sin(πx): N=8, k= sin(πx): N=8, k= sin(4πx): N=8, k=4 sin(7πx): N=8, k= sin(πx): N=6, k= sin(πx): N=6, k= sin(8πx): N=6, k=8 sin(5πx): N=6, k=

5 (c) Here is the code to generate the plot, and the plot itself: N=[8 6 ]; h=./n; N=N-; plot( :N(),-*(-cos((:N())*pi*h()))/(h()^), p,... :N(),-*(-cos((:N())*pi*h()))/(h()^), +,... :N(),-*(-cos((:N())*pi*h()))/(h()^), *,... :,-(pi*(:)).^, -o, markersize,6, linewidth,) grid,title( Continuous vs. Discrete spectrum of d^/dx^ ) ylabel( eigenvalue ),xlabel( mode number ),legend( N=, N=6, N=8, continuous,) Discussion: From part (b) we see that the eigenvectors of the discrete differentiation matrix are the corresponding eigenfunctions of the continuous problem evaluated at the grid points determined by the specific N. In this sense the discrete problem is clearly a very good approximation to the continuous one. On the other hand, note in the plot above that while for each N the first few discrete eigenvalues are good approximations, this is not the case for the eigenvalues corresponding to the higher modes. Thus one expects these modes in the continuous problems not to be modeled well by the discrete approximation. Note: A Taylor series expansion gives (kπ) λ k = (kπ) + ( cos kπh) h = (kπ) + (kπh) ( ( + (kπh)4 )) h 4 = (kπ) + ( ) (kπh) h (kπh)4 + = (kπ) + (kπ) h ( (kπh) 4 ( ) 4 4 (kπ) 4 = h + O(h 4 ) = O(h ) So we do have the expected accuracy of approximation, but remember there is still a term in the error that depends on the eigenvalue being approximated, (kπ) 4 /, which explains, even for larger N, why we do not see rapid convergence of the discrete eigenvalues to the continuous ones as k N. In fact, for a fixed N and k large, we see divergence in the upper spectrum. )

6 . Boundary Value Problems and Boundary Layers: Consider the two-point boundary value problem { ɛu + u = x +, < x < u() = u() = where ɛ > is a given parameter. The exact solution is given by u(x) = x + sinh x ɛ + sinh x ɛ sinh ɛ (a) Using your tridiagonal solver compute the solution for ɛ = and N = /h = n for n =, 4, 6, 8. Using the subplot command, plot the exact solution and the computed solution for each N on the same page, i.e. 4 plots on the same page. Also, compute the ratios u v /h for each h = /N. Discuss the results. Include a copy of your code. (b) Repeat the exercise above for ɛ =. Again, discuss the results. What has changed, i.e. what is the effect of a smaller ɛ? ANS: (a) First, here are the computational results with ɛ = : N=4 eps=. N=6 eps=..5.5 N=64 eps=. N=56 eps=..5.5 Note that the computed solution and its linear interpolation does a good job of approximating the true solution for N 8 as is demonstrated in the numerical convergence seen in the error data

7 N inf_err inf_err/h^ e+.885e- 4.66e-.6e+.99e e- 6.4e+.58e-4 5.7e-.56e+ 7.86e e- (b) Now, here are the computational results with ɛ = : Note that the computed N=4 eps=. N=6 eps=..5.5 N=64 eps=. N=56 eps=..5.5 solution does not do a very good job of approximating the true soltuion with N = 4 in this case due to the steep gradients in the solution near the boundary. N inf_err inf_err/h^ e+ 4.54e- 7.67e-.6e+.77e-.757e+ 6.4e+.98e e+.56e+ 7.64e e+ Here is the code for ɛ = : N =.^(::8); epsilon = ^(-); hold off xx = :.5:; % compute true solution uu on fine grid xx uu = *xx+-(sinh((-xx)/sqrt(epsilon))+... *sinh(xx/sqrt(epsilon)))/sinh(/sqrt(epsilon)); err=zeros(4,); % compute approx for each N, plot, and store error for k=:length(n)

8 n = N(k); h = /n; x = (:h:) ; a = -epsilon*ones(n-,)/(h^); c = a; b = *epsilon*ones(n-,)/(h^)+; f = *x(:n)+; v = trisolve(a,b,c,f); v = [ v ] ; subplot(,,k), plot(xx,uu,x,v, *- ), axis([ ]), grid title([ N=,numstr(n), eps=,numstr(epsilon)]) u = *x+-(sinh((-x)/sqrt(epsilon))+*sinh(x/sqrt(epsilon)))... /sinh(/sqrt(epsilon)); err(k,) = n; err(k,) = norm(u-v,inf); err(k,) = err(k,)/(h.^); end hold off, format short e disp( N inf_err inf_err/h^ ) disp( ) disp(err) savepdf( hw5_pa.pdf,,)

9 4. Consider again the BVP in problem, but now using a Chebyshev spectral method. (a) By modifying the m-file cheb.m produce an m-file [D,x] = cheb(n) that produces grid points for the interval [, ] instead of [, ], and an appropriately modified differentiation matrix D. Note that this can be done by applying the linear mapping x (x+)/ to the grid points and then applying the chain rule to compute the modified D. Include a copy of your code. (b) Repeat parts (a) and (b) of problem using a spectral scheme but now with N = n with n =,, 4, 5. Produce a separate plot with four images for each ɛ. In addition, plot the log of the infinity-norm errors for both values of ɛ together on the same plot. Discuss the results in relation to those in problem using a finite difference scheme. ANS: (a) We now recompute the BVP from problem using our spectral method for the interval [, ]. Here are the solution profiles for ɛ =., and the infinity norm errors given N=4 eps=. N=8 eps=..5.5 N=6 eps=. N= eps=..5.5 by N inf_err e+.566e- 8.e+.99e-7.6e+.9984e-5.e+.88e-4

10 Now with ɛ = we have N=4 eps=. N=8 eps=..5.5 N=6 eps=. N= eps=..5.5 N inf_err e+ 7.84e- 8.e+.877e-.6e e-5.e+.98e-4 Putting the results from both the FD and spectral method together we have Here is the code for cheb followed by the BVP solver: % CHEB compute D = differentiation matrix, x = Chebyshev grid % for the interval [,] from right to left function [D,x] = cheb(n) if N==, D=; x=; return, end x = cos(pi*(:n)/n) ; c = [; ones(n-,); ].*(-).^(:N) ; X = repmat(x,,n+); dx = X-X ; D = (c*(./c) )./(dx+(eye(n+))); % off-diagonal entries D = D - diag(sum(d )); % diagonal entries x = (x+)/; D=*D; % mapping to account for [- ] ->[,]

11 Error: FD vs. SPECTRAL for solving BVP Infinity norm error 5 5 FD eps =. FD eps =. SPEC eps =. SPEC eps = N N =.^(:5); epsilon = ^(-); xx = :.5:; % compute true solution uu on fine grid xx uu = *xx+-(sinh((-xx)/sqrt(epsilon))+ *sinh(xx/sqrt(epsilon)))/sinh(/sqrt(epsilon)); err=zeros(4,); % compute approx for each N, plot, and store error for k=:length(n) n = N(k); [D,x] = cheb(n); D = D^; D = D(:n,:n); f = *x(:n)+; v = [-epsilon*d+eye(n-)]\f; v = [ v ] ; subplot(,,k), plot(xx,uu,x,v, *- ), axis([-.5.5.]), grid title([ N=,numstr(n), eps=,numstr(epsilon)]) u = *x+-(sinh((-x)/sqrt(epsilon))+*sinh(x/sqrt(epsilon)))/sinh(/sqrt(epsilon)); err(k,) = n; err(k,) = norm(u-v,inf); end hold off, format short e disp( N inf_err ) disp( ) disp(err)

HW #3 Solutions: M552 Spring (c)

HW #3 Solutions: M552 Spring (c) HW #3 Solutions: M55 Spring 6. (4.-Trefethen & Bau: parts (a), (c) and (e)) Determine the SVDs of the following matrices (by hand calculation): (a) [ 3 (c) (e) [ ANS: In each case we seek A UΣV. The general

More information

Math 552 Scientific Computing II Spring SOLUTIONS: Homework Set 1

Math 552 Scientific Computing II Spring SOLUTIONS: Homework Set 1 Math 552 Scientific Computing II Spring 21 SOLUTIONS: Homework Set 1 ( ) a b 1 Let A be the 2 2 matrix A = By hand, use Gaussian elimination with back c d substitution to obtain A 1 by solving the two

More information

Homework Set 4 - SOLUTIONS

Homework Set 4 - SOLUTIONS MATH 55 Scientific Computing II Spring 6 Homework Set 4 - SOLUTIONS. For N even define a discrete grid x h for [, π] by x k = k h where h = π/n and k N. Show e i( N +j)x k = e i( N j)x k for j =,,...,

More information

HW #1 Solutions: M552 Spring 2006

HW #1 Solutions: M552 Spring 2006 HW #1 Solutions: M55 Spring 006 1. (1.4-Trefethen & Bau) Let f 1,...,f 8 be a set of functions defined on the interval [1,8] with the property that for any numbers d 1,...,d 8, there exists a set of coefficients

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

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

MATH 590: Meshfree Methods

MATH 590: Meshfree Methods MATH 590: Meshfree Methods Chapter 43: RBF-PS Methods in MATLAB Greg Fasshauer Department of Applied Mathematics Illinois Institute of Technology Fall 2010 fasshauer@iit.edu MATH 590 Chapter 43 1 Outline

More information

Interpolation and the Lagrange Polynomial

Interpolation and the Lagrange Polynomial Interpolation and the Lagrange Polynomial MATH 375 J. Robert Buchanan Department of Mathematics Fall 2013 Introduction We often choose polynomials to approximate other classes of functions. Theorem (Weierstrass

More information

Background. Background. C. T. Kelley NC State University tim C. T. Kelley Background NCSU, Spring / 58

Background. Background. C. T. Kelley NC State University tim C. T. Kelley Background NCSU, Spring / 58 Background C. T. Kelley NC State University tim kelley@ncsu.edu C. T. Kelley Background NCSU, Spring 2012 1 / 58 Notation vectors, matrices, norms l 1 : max col sum... spectral radius scaled integral norms

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

MATH 221, Spring Homework 10 Solutions

MATH 221, Spring Homework 10 Solutions MATH 22, Spring 28 - Homework Solutions Due Tuesday, May Section 52 Page 279, Problem 2: 4 λ A λi = and the characteristic polynomial is det(a λi) = ( 4 λ)( λ) ( )(6) = λ 6 λ 2 +λ+2 The solutions to the

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

MATH 590: Meshfree Methods

MATH 590: Meshfree Methods MATH 590: Meshfree Methods Chapter 43: RBF-PS Methods in MATLAB Greg Fasshauer Department of Applied Mathematics Illinois Institute of Technology Fall 2010 fasshauer@iit.edu MATH 590 Chapter 43 1 Outline

More information

Flow Instability Matlab Tutorial Bangalore, January 2010 Matthew Juniper, Dan Henningson, Peter Schmid 1

Flow Instability Matlab Tutorial Bangalore, January 2010 Matthew Juniper, Dan Henningson, Peter Schmid 1 Flow Instability Matlab Tutorial Bangalore, January Matthew Juniper, Dan Henningson, Peter Schmid Simple differentiation matrices Imagine a vector that represents the values of a function y at N equispaced

More information

Numerical Solutions to Partial Differential Equations

Numerical Solutions to Partial Differential Equations Numerical Solutions to Partial Differential Equations Zhiping Li LMAM and School of Mathematical Sciences Peking University The Implicit Schemes for the Model Problem The Crank-Nicolson scheme and θ-scheme

More information

Math/Phys/Engr 428, Math 529/Phys 528 Numerical Methods - Summer Homework 3 Due: Tuesday, July 3, 2018

Math/Phys/Engr 428, Math 529/Phys 528 Numerical Methods - Summer Homework 3 Due: Tuesday, July 3, 2018 Math/Phys/Engr 428, Math 529/Phys 528 Numerical Methods - Summer 28. (Vector and Matrix Norms) Homework 3 Due: Tuesday, July 3, 28 Show that the l vector norm satisfies the three properties (a) x for x

More information

Maria Cameron Theoretical foundations. Let. be a partition of the interval [a, b].

Maria Cameron Theoretical foundations. Let. be a partition of the interval [a, b]. Maria Cameron 1 Interpolation by spline functions Spline functions yield smooth interpolation curves that are less likely to exhibit the large oscillations characteristic for high degree polynomials Splines

More information

Phonon dispersion relation and density of states of a simple cubic lattice

Phonon dispersion relation and density of states of a simple cubic lattice Phonon dispersion relation and density of states of a simple cubic lattice Student project for the course Molecular and Solid State Physics by Eva Meisterhofer Contents 1 The linear spring model 3 1.1

More information

Boundary Layer Problems and Applications of Spectral Methods

Boundary Layer Problems and Applications of Spectral Methods Boundary Layer Problems and Applications of Spectral Methods Sumi Oldman University of Massachusetts Dartmouth CSUMS Summer 2011 August 4, 2011 Abstract Boundary layer problems arise when thin boundary

More information

Numerical Analysis of Differential Equations Numerical Solution of Elliptic Boundary Value

Numerical Analysis of Differential Equations Numerical Solution of Elliptic Boundary Value Numerical Analysis of Differential Equations 188 5 Numerical Solution of Elliptic Boundary Value Problems 5 Numerical Solution of Elliptic Boundary Value Problems TU Bergakademie Freiberg, SS 2012 Numerical

More information

Class notes: Approximation

Class notes: Approximation Class notes: Approximation Introduction Vector spaces, linear independence, subspace The goal of Numerical Analysis is to compute approximations We want to approximate eg numbers in R or C vectors in R

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

Part 1. The diffusion equation

Part 1. The diffusion equation Differential Equations FMNN10 Graded Project #3 c G Söderlind 2016 2017 Published 2017-11-27. Instruction in computer lab 2017-11-30/2017-12-06/07. Project due date: Monday 2017-12-11 at 12:00:00. Goals.

More information

INTERPOLATION Background Polynomial Approximation Problem:

INTERPOLATION Background Polynomial Approximation Problem: INTERPOLATION Background Polynomial Approximation Problem: given f(x) C[a, b], find P n (x) = a 0 + a 1 x + a 2 x 2 + + a n x n with P n (x) close to f(x) for x [a, b]. Motivations: f(x) might be difficult

More information

Homework 1 Math 471, Fall 2008

Homework 1 Math 471, Fall 2008 Homework Math 47, Fall 2008 Section 002 This document is intended to show what a good solution to the first homework assignment might look like. Note in particular the following points of style: There

More information

Preliminary Examination, Numerical Analysis, August 2016

Preliminary Examination, Numerical Analysis, August 2016 Preliminary Examination, Numerical Analysis, August 2016 Instructions: This exam is closed books and notes. The time allowed is three hours and you need to work on any three out of questions 1-4 and any

More information

S(c)/ c = 2 J T r = 2v, (2)

S(c)/ c = 2 J T r = 2v, (2) M. Balda LMFnlsq Nonlinear least squares 2008-01-11 Let us have a measured values (column vector) y depent on operational variables x. We try to make a regression of y(x) by some function f(x, c), where

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

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

18.06 Problem Set 9 - Solutions Due Wednesday, 21 November 2007 at 4 pm in

18.06 Problem Set 9 - Solutions Due Wednesday, 21 November 2007 at 4 pm in 8.6 Problem Set 9 - Solutions Due Wednesday, 2 November 27 at 4 pm in 2-6. Problem : (5) When A = SΛS is a real-symmetric (or Hermitian) matrix, its eigenvectors can be chosen orthonormal and hence S =

More information

MATH 235/W08: Orthogonality; Least-Squares; & Best Approximation SOLUTIONS to Assignment 6

MATH 235/W08: Orthogonality; Least-Squares; & Best Approximation SOLUTIONS to Assignment 6 MATH 235/W08: Orthogonality; Least-Squares; & Best Approximation SOLUTIONS to Assignment 6 Solutions to questions 1,2,6,8. Contents 1 Least Squares and the Normal Equations*** 2 1.1 Solution...........................................

More information

Functional Analysis Review

Functional Analysis Review Outline 9.520: Statistical Learning Theory and Applications February 8, 2010 Outline 1 2 3 4 Vector Space Outline A vector space is a set V with binary operations +: V V V and : R V V such that for all

More information

MATH 412 Fourier Series and PDE- Spring 2010 SOLUTIONS to HOMEWORK 5

MATH 412 Fourier Series and PDE- Spring 2010 SOLUTIONS to HOMEWORK 5 MATH 4 Fourier Series PDE- Spring SOLUTIONS to HOMEWORK 5 Problem (a: Solve the following Sturm-Liouville problem { (xu + λ x u = < x < e u( = u (e = (b: Show directly that the eigenfunctions are orthogonal

More information

Homework 6 MA/CS 375, Fall 2005 Due December 15

Homework 6 MA/CS 375, Fall 2005 Due December 15 Homework 6 MA/CS 375, Fall 25 Due December 5 This homework will count as part of your grade so you must work independently. It is permissible to discuss it with your instructor, the TA, fellow students,

More information

Chapter 1: Introduction

Chapter 1: Introduction Chapter 1: Introduction Definition: A differential equation is an equation involving the derivative of a function. If the function depends on a single variable, then only ordinary derivatives appear and

More information

Lecture 1 INF-MAT3350/ : Some Tridiagonal Matrix Problems

Lecture 1 INF-MAT3350/ : Some Tridiagonal Matrix Problems Lecture 1 INF-MAT3350/4350 2007: Some Tridiagonal Matrix Problems Tom Lyche University of Oslo Norway Lecture 1 INF-MAT3350/4350 2007: Some Tridiagonal Matrix Problems p.1/33 Plan for the day 1. Notation

More information

Math 502 Fall 2005 Solutions to Homework 5. Let x = A ;1 b. Then x = ;D ;1 (L+U)x +D ;1 b, and hence the dierences

Math 502 Fall 2005 Solutions to Homework 5. Let x = A ;1 b. Then x = ;D ;1 (L+U)x +D ;1 b, and hence the dierences Math 52 Fall 25 Solutions to Homework 5 (). The i-th row ofd ; (L + U) is r i =[ a i ::: a i i; a i i+ ::: a i M ] a i i a i i a i i a i i Since A is strictly X row diagonally dominant jr i j = j a i j

More information

Math 308 Week 8 Solutions

Math 308 Week 8 Solutions Math 38 Week 8 Solutions There is a solution manual to Chapter 4 online: www.pearsoncustom.com/tamu math/. This online solutions manual contains solutions to some of the suggested problems. Here are solutions

More information

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB

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

More information

Math 515 Fall, 2008 Homework 2, due Friday, September 26.

Math 515 Fall, 2008 Homework 2, due Friday, September 26. Math 515 Fall, 2008 Homework 2, due Friday, September 26 In this assignment you will write efficient MATLAB codes to solve least squares problems involving block structured matrices known as Kronecker

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

Outline. 1 Boundary Value Problems. 2 Numerical Methods for BVPs. Boundary Value Problems Numerical Methods for BVPs

Outline. 1 Boundary Value Problems. 2 Numerical Methods for BVPs. Boundary Value Problems Numerical Methods for BVPs Boundary Value Problems Numerical Methods for BVPs Outline Boundary Value Problems 2 Numerical Methods for BVPs Michael T. Heath Scientific Computing 2 / 45 Boundary Value Problems Numerical Methods for

More information

INF-MAT Mandatory Exercise 1

INF-MAT Mandatory Exercise 1 INF-MAT336 - Mandatory Exercise 1 Vegard Kjelseth University of Oslo vokjelse@ifi.uio.no March 8, 213 Exercise 1 a) The solution of the ODE u (t) = au (t), t >, u () = 1 is u (t) = Ce at. The value of

More information

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra

Statistical methods. Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Mean value and standard deviations Standard statistical distributions Linear systems Matrix algebra Statistical methods Generating random numbers MATLAB has many built-in functions

More information

Introduction and Stationary Iterative Methods

Introduction and Stationary Iterative Methods Introduction and C. T. Kelley NC State University tim kelley@ncsu.edu Research Supported by NSF, DOE, ARO, USACE DTU ITMAN, 2011 Outline Notation and Preliminaries General References What you Should Know

More information

Matlab Exercise 0 Due 1/25/06

Matlab Exercise 0 Due 1/25/06 Matlab Exercise 0 Due 1/25/06 Geop 523 Theoretical Seismology January 18, 2006 Much of our work in this class will be done using Matlab. The goal of this exercise is to get you familiar with using Matlab

More information

18.06 Problem Set 8 Due Wednesday, 23 April 2008 at 4 pm in

18.06 Problem Set 8 Due Wednesday, 23 April 2008 at 4 pm in 18.06 Problem Set 8 Due Wednesday, 23 April 2008 at 4 pm in 2-106. Problem 1: Do problem 3 in section 6.5 (pg. 339) in the book. The matrix A encodes the quadratic f = x 2 + 4xy + 9y 2. Completing the

More information

3.1 Interpolation and the Lagrange Polynomial

3.1 Interpolation and the Lagrange Polynomial MATH 4073 Chapter 3 Interpolation and Polynomial Approximation Fall 2003 1 Consider a sample x x 0 x 1 x n y y 0 y 1 y n. Can we get a function out of discrete data above that gives a reasonable estimate

More information

MATH 425, HOMEWORK 5, SOLUTIONS

MATH 425, HOMEWORK 5, SOLUTIONS MATH 425, HOMEWORK 5, SOLUTIONS Exercise (Uniqueness for the heat equation on R) Suppose that the functions u, u 2 : R x R t R solve: t u k 2 xu = 0, x R, t > 0 u (x, 0) = φ(x), x R and t u 2 k 2 xu 2

More information

Qualifying Examination

Qualifying Examination Summer 24 Day. Monday, September 5, 24 You have three hours to complete this exam. Work all problems. Start each problem on a All problems are 2 points. Please email any electronic files in support of

More information

Numerical Methods for PDEs

Numerical Methods for PDEs Numerical Methods for PDEs Problems 1. Numerical Differentiation. Find the best approximation to the second drivative d 2 f(x)/dx 2 at x = x you can of a function f(x) using (a) the Taylor series approach

More information

MATH 3511 Lecture 1. Solving Linear Systems 1

MATH 3511 Lecture 1. Solving Linear Systems 1 MATH 3511 Lecture 1 Solving Linear Systems 1 Dmitriy Leykekhman Spring 2012 Goals Review of basic linear algebra Solution of simple linear systems Gaussian elimination D Leykekhman - MATH 3511 Introduction

More information

2.4 Eigenvalue problems

2.4 Eigenvalue problems 2.4 Eigenvalue problems Associated with the boundary problem (2.1) (Poisson eq.), we call λ an eigenvalue if Lu = λu (2.36) for a nonzero function u C 2 0 ((0, 1)). Recall Lu = u. Then u is called an eigenfunction.

More information

The University of Texas at Austin Department of Electrical and Computer Engineering. EE381V: Large Scale Learning Spring 2013.

The University of Texas at Austin Department of Electrical and Computer Engineering. EE381V: Large Scale Learning Spring 2013. The University of Texas at Austin Department of Electrical and Computer Engineering EE381V: Large Scale Learning Spring 2013 Assignment Two Caramanis/Sanghavi Due: Tuesday, Feb. 19, 2013. Computational

More information

Cheat Sheet for MATH461

Cheat Sheet for MATH461 Cheat Sheet for MATH46 Here is the stuff you really need to remember for the exams Linear systems Ax = b Problem: We consider a linear system of m equations for n unknowns x,,x n : For a given matrix A

More information

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

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

More information

MATH2071: LAB #5: Norms, Errors and Condition Numbers

MATH2071: LAB #5: Norms, Errors and Condition Numbers MATH2071: LAB #5: Norms, Errors and Condition Numbers 1 Introduction Introduction Exercise 1 Vector Norms Exercise 2 Matrix Norms Exercise 3 Compatible Matrix Norms Exercise 4 More on the Spectral Radius

More information

Math 118, Handout 4: Hermite functions and the Fourier transform. n! where D = d/dx, are a basis of eigenfunctions for the Fourier transform

Math 118, Handout 4: Hermite functions and the Fourier transform. n! where D = d/dx, are a basis of eigenfunctions for the Fourier transform The Hermite functions defined by h n (x) = ( )n e x2 /2 D n e x2 where D = d/dx, are a basis of eigenfunctions for the Fourier transform f(k) = f(x)e ikx dx on L 2 (R). Since h 0 (x) = e x2 /2 h (x) =

More information

Lecture 1. Finite difference and finite element methods. Partial differential equations (PDEs) Solving the heat equation numerically

Lecture 1. Finite difference and finite element methods. Partial differential equations (PDEs) Solving the heat equation numerically Finite difference and finite element methods Lecture 1 Scope of the course Analysis and implementation of numerical methods for pricing options. Models: Black-Scholes, stochastic volatility, exponential

More information

Notes for CS542G (Iterative Solvers for Linear Systems)

Notes for CS542G (Iterative Solvers for Linear Systems) Notes for CS542G (Iterative Solvers for Linear Systems) Robert Bridson November 20, 2007 1 The Basics We re now looking at efficient ways to solve the linear system of equations Ax = b where in this course,

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

Problem set 3: Solutions Math 207B, Winter Suppose that u(x) is a non-zero solution of the eigenvalue problem. (u ) 2 dx, u 2 dx.

Problem set 3: Solutions Math 207B, Winter Suppose that u(x) is a non-zero solution of the eigenvalue problem. (u ) 2 dx, u 2 dx. Problem set 3: Solutions Math 27B, Winter 216 1. Suppose that u(x) is a non-zero solution of the eigenvalue problem u = λu < x < 1, u() =, u(1) =. Show that λ = (u ) 2 dx u2 dx. Deduce that every eigenvalue

More information

Math 4263 Homework Set 1

Math 4263 Homework Set 1 Homework Set 1 1. Solve the following PDE/BVP 2. Solve the following PDE/BVP 2u t + 3u x = 0 u (x, 0) = sin (x) u x + e x u y = 0 u (0, y) = y 2 3. (a) Find the curves γ : t (x (t), y (t)) such that that

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

Math 577 Assignment 7

Math 577 Assignment 7 Math 577 Assignment 7 Thanks for Yu Cao 1. Solution. The linear system being solved is Ax = 0, where A is a (n 1 (n 1 matrix such that 2 1 1 2 1 A =......... 1 2 1 1 2 and x = (U 1, U 2,, U n 1. By the

More information

2 Solving Ordinary Differential Equations Using MATLAB

2 Solving Ordinary Differential Equations Using MATLAB Penn State Erie, The Behrend College School of Engineering E E 383 Signals and Control Lab Spring 2008 Lab 3 System Responses January 31, 2008 Due: February 7, 2008 Number of Lab Periods: 1 1 Objective

More information

Introduction. Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods. Example: First Order Richardson. Strategy

Introduction. Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods. Example: First Order Richardson. Strategy Introduction Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods M. M. Sussman sussmanm@math.pitt.edu Office Hours: MW 1:45PM-2:45PM, Thack 622 Solve system Ax = b by repeatedly computing

More information

Eigenvalues and Eigenvectors

Eigenvalues and Eigenvectors Eigenvalues and Eigenvectors MAT 67L, Laboratory III Contents Instructions (1) Read this document. (2) The questions labeled Experiments are not graded, and should not be turned in. They are designed for

More information

Math 224, Fall 2007 Exam 3 Thursday, December 6, 2007

Math 224, Fall 2007 Exam 3 Thursday, December 6, 2007 Math 224, Fall 2007 Exam 3 Thursday, December 6, 2007 You have 1 hour and 20 minutes. No notes, books, or other references. You are permitted to use Maple during this exam, but you must start with a blank

More information

MTH50 Spring 07 HW Assignment 7 {From [FIS0]}: Sec 44 #4a h 6; Sec 5 #ad ac 4ae 4 7 The due date for this assignment is 04/05/7 Sec 44 #4a h Evaluate the erminant of the following matrices by any legitimate

More information

Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods

Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods Math 1080: Numerical Linear Algebra Chapter 4, Iterative Methods M. M. Sussman sussmanm@math.pitt.edu Office Hours: MW 1:45PM-2:45PM, Thack 622 March 2015 1 / 70 Topics Introduction to Iterative Methods

More information

Computing Eigenvalues and/or Eigenvectors;Part 1, Generalities and symmetric matrices

Computing Eigenvalues and/or Eigenvectors;Part 1, Generalities and symmetric matrices Computing Eigenvalues and/or Eigenvectors;Part 1, Generalities and symmetric matrices Tom Lyche Centre of Mathematics for Applications, Department of Informatics, University of Oslo November 9, 2008 Today

More information

HAND IN PART. Prof. Girardi Math 142 Spring Exam 3 PIN:

HAND IN PART. Prof. Girardi Math 142 Spring Exam 3 PIN: HAND IN PART Prof. Girardi Math 142 Spring 2014 04.17.2014 Exam 3 MARK BOX problem points possible your score 0A 9 0B 8 0C 10 0D 12 NAME: PIN: solution key Total for 0 39 Total for 1 10 61 % 100 INSTRUCTIONS

More information

Linear Least Squares. Using SVD Decomposition.

Linear Least Squares. Using SVD Decomposition. Linear Least Squares. Using SVD Decomposition. Dmitriy Leykekhman Spring 2011 Goals SVD-decomposition. Solving LLS with SVD-decomposition. D. Leykekhman Linear Least Squares 1 SVD Decomposition. For any

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

EE364a Homework 8 solutions

EE364a Homework 8 solutions EE364a, Winter 2007-08 Prof. S. Boyd EE364a Homework 8 solutions 9.8 Steepest descent method in l -norm. Explain how to find a steepest descent direction in the l -norm, and give a simple interpretation.

More information

Math 502 Fall 2005 Solutions to Homework 3

Math 502 Fall 2005 Solutions to Homework 3 Math 502 Fall 2005 Solutions to Homework 3 (1) As shown in class, the relative distance between adjacent binary floating points numbers is 2 1 t, where t is the number of digits in the mantissa. Since

More information

The answer in each case is the error in evaluating the taylor series for ln(1 x) for x = which is 6.9.

The answer in each case is the error in evaluating the taylor series for ln(1 x) for x = which is 6.9. Brad Nelson Math 26 Homework #2 /23/2. a MATLAB outputs: >> a=(+3.4e-6)-.e-6;a- ans = 4.449e-6 >> a=+(3.4e-6-.e-6);a- ans = 2.224e-6 And the exact answer for both operations is 2.3e-6. The reason why way

More information

MATH 1014 Tutorial Notes 8

MATH 1014 Tutorial Notes 8 MATH4 Calculus II (8 Spring) Topics covered in tutorial 8:. Numerical integration. Approximation integration What you need to know: Midpoint rule & its error Trapezoid rule & its error Simpson s rule &

More information

Programs for Natural Cubic Spline Interpolation

Programs for Natural Cubic Spline Interpolation Outlines November 2, 2004 Outlines Part I: The Basics The Basic Method The Data Part I The Basic Method The Data Review of Natural Cubic Spline Method Given a series of points (x 0, f (x 0 )) (x n, f (x

More information

2D Plotting with Matlab

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

More information

Homework 5 - Solutions

Homework 5 - Solutions Spring Math 54 Homework 5 - Solutions BF 3.4.4. d. The spline interpolation routine below produces the following coefficients: i a i b i c i d i -..869948.75637848.656598 -.5.9589.487644.9847639.887.9863.34456976.489747

More information

1 Inner Product and Orthogonality

1 Inner Product and Orthogonality CSCI 4/Fall 6/Vora/GWU/Orthogonality and Norms Inner Product and Orthogonality Definition : The inner product of two vectors x and y, x x x =.., y =. x n y y... y n is denoted x, y : Note that n x, y =

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

Harman Outline 1A Calculus CENG 5131 PDF

Harman Outline 1A Calculus CENG 5131 PDF Harman Outline 1A Calculus CENG 5131 PDF September 5, 2013 III. Review of Differentiation A.Basic Definitions Harman Ch6,P297 Approximations for the Derivative The expression for the derivative of a function

More information

MAE 107 Homework 7 Solutions

MAE 107 Homework 7 Solutions MAE 107 Homework 7 Solutions 1. Tridiagonal system for u xx (x) + u(x) = 1 + sin(πx/4), for x [0, ], where u(0) =, u() = 4, with step size h = 1/. The total number of segments are: n = 0 1/ =. The nodes

More information

Final Exam May 4, 2016

Final Exam May 4, 2016 1 Math 425 / AMCS 525 Dr. DeTurck Final Exam May 4, 2016 You may use your book and notes on this exam. Show your work in the exam book. Work only the problems that correspond to the section that you prepared.

More information

Lesson 11: Mass-Spring, Resonance and ode45

Lesson 11: Mass-Spring, Resonance and ode45 Lesson 11: Mass-Spring, Resonance and ode45 11.1 Applied Problem. Trucks and cars have springs and shock absorbers to make a comfortable and safe ride. Without good shock absorbers, the truck or car will

More information

Linear Systems. Class 27. c 2008 Ron Buckmire. TITLE Projection Matrices and Orthogonal Diagonalization CURRENT READING Poole 5.4

Linear Systems. Class 27. c 2008 Ron Buckmire. TITLE Projection Matrices and Orthogonal Diagonalization CURRENT READING Poole 5.4 Linear Systems Math Spring 8 c 8 Ron Buckmire Fowler 9 MWF 9: am - :5 am http://faculty.oxy.edu/ron/math//8/ Class 7 TITLE Projection Matrices and Orthogonal Diagonalization CURRENT READING Poole 5. Summary

More information

Matlab Instruction Primer; Chem 691, Spring 2016

Matlab Instruction Primer; Chem 691, Spring 2016 1 Matlab Instruction Primer; Chem 691, Spring 2016 This version dated February 10, 2017 CONTENTS I. Help: To obtain information about any instruction in Matlab 1 II. Scripting 1 III. Loops, determine an

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

Theory of Iterative Methods

Theory of Iterative Methods Based on Strang s Introduction to Applied Mathematics Theory of Iterative Methods The Iterative Idea To solve Ax = b, write Mx (k+1) = (M A)x (k) + b, k = 0, 1,,... Then the error e (k) x (k) x satisfies

More information

Romberg Integration. MATH 375 Numerical Analysis. J. Robert Buchanan. Spring Department of Mathematics

Romberg Integration. MATH 375 Numerical Analysis. J. Robert Buchanan. Spring Department of Mathematics Romberg Integration MATH 375 Numerical Analysis J. Robert Buchanan Department of Mathematics Spring 019 Objectives and Background In this lesson we will learn to obtain high accuracy approximations to

More information

to have roots with negative real parts, the necessary and sufficient conditions are that:

to have roots with negative real parts, the necessary and sufficient conditions are that: THE UNIVERSITY OF TEXAS AT SAN ANTONIO EE 543 LINEAR SYSTEMS AND CONTROL H O M E W O R K # 7 Sebastian A. Nugroho November 6, 7 Due date of the homework is: Sunday, November 6th @ :59pm.. The following

More information

Chapter #4 EEE8086-EEE8115. Robust and Adaptive Control Systems

Chapter #4 EEE8086-EEE8115. Robust and Adaptive Control Systems Chapter #4 Robust and Adaptive Control Systems Nonlinear Dynamics.... Linear Combination.... Equilibrium points... 3 3. Linearisation... 5 4. Limit cycles... 3 5. Bifurcations... 4 6. Stability... 6 7.

More information

Numerical Analysis and Computing

Numerical Analysis and Computing Numerical Analysis and Computing Lecture Notes #02 Calculus Review; Computer Artihmetic and Finite Precision; and Convergence; Joe Mahaffy, mahaffy@math.sdsu.edu Department of Mathematics Dynamical Systems

More information

1 Finite difference example: 1D implicit heat equation

1 Finite difference example: 1D implicit heat equation 1 Finite difference example: 1D implicit heat equation 1.1 Boundary conditions Neumann and Dirichlet We solve the transient heat equation ρc p t = ( k ) (1) on the domain L/2 x L/2 subject to the following

More information

What is on this week. 1 Vector spaces (continued) 1.1 Null space and Column Space of a matrix

What is on this week. 1 Vector spaces (continued) 1.1 Null space and Column Space of a matrix Professor Joana Amorim, jamorim@bu.edu What is on this week Vector spaces (continued). Null space and Column Space of a matrix............................. Null Space...........................................2

More information

A = 3 B = A 1 1 matrix is the same as a number or scalar, 3 = [3].

A = 3 B = A 1 1 matrix is the same as a number or scalar, 3 = [3]. Appendix : A Very Brief Linear ALgebra Review Introduction Linear Algebra, also known as matrix theory, is an important element of all branches of mathematics Very often in this course we study the shapes

More information

Iterative solvers for linear equations

Iterative solvers for linear equations Spectral Graph Theory Lecture 15 Iterative solvers for linear equations Daniel A. Spielman October 1, 009 15.1 Overview In this and the next lecture, I will discuss iterative algorithms for solving linear

More information