5 Pages

class06

Course: ASTR 415, Fall 2008
School: Maryland
Rating:
 
 
 
 
 

Word Count: 905

Document Preview

6. Class Numerical Linear Algebra, Part 1 Probably the simplest kind of problem. Occurs in many contexts, often as part of larger problem. Symbolic manipulation packages can do linear algebra analytically (e.g., Mathematica, Maple, etc.). Numerical methods needed when: Number of equations very large. One or more coecients numerical. Linear Systems Write linear system as: a11 x1 + a12 x2 + + a1n xn = b1...

Register Now

Unformatted Document Excerpt

Coursehero >> Maryland >> Maryland >> ASTR 415

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
6. Class Numerical Linear Algebra, Part 1 Probably the simplest kind of problem. Occurs in many contexts, often as part of larger problem. Symbolic manipulation packages can do linear algebra analytically (e.g., Mathematica, Maple, etc.). Numerical methods needed when: Number of equations very large. One or more coecients numerical. Linear Systems Write linear system as: a11 x1 + a12 x2 + + a1n xn = b1 a21 x1 + a22 x2 + + a2n xn = b2 . .=. . . . am1 x1 + am2 x2 + + amn xn = bm This system has n unknowns and m equations. If n = m, system is closed. If m n and any equation is a linear combination of any others, equations are degenerate and system is singular. Numerical Constraints Numerical methods have their own problems when: 1. Equations are degenerate within round-o error. 2. Accumulated round-o errors swamp solution (magnitudes of as and xs vary wildly). For n, m < 50, single precision usually OK (but why bother?). For n, m < 200, double precision usually OK. For 200 < n, m < few thousand, solutions possible only for sparse systems (lots of as zero). 1 Matrix Form Write system in matrix form: Ax = b, where: A= a11 a21 . . . a12 a22 . . . a1n a2n . . . am1 am2 amn . Matrix Data Representation Recall, C stores data in row-major form: a11 , a12 , . . . , a1n ; a21 , a22 , . . . , a2n ; . . . ; am1 , am2 , . . . , amn . If using pointer to array of pointers to rows scheme in C, can reference entire rows by rst index, e.g., 3rd row = a[2]. (!) Recall in C array indices start at zero! FORTRAN stores data in column-major form: a11 , a21 , . . . , am1 ; a12 , a22 , . . . , am2 ; . . . ; a1n , a2n , . . . , amn . Note on Numerical Recipes in C The canned routines in NRiC make use of special functions dened in nrutil.c (header nrutil.h). In particular, arrays and matrices are allocated dynamically with indices starting at 1, not 0. If you want to interface with the NRiC routines, but prefer the normal C array index convention, pass arrays by subtracting 1 from the pointer address (i.e., pass p - 1 instead of p) and pass matrices by using the functions convert matrix() and free convert matrix() in nrutil.c (see NRiC 1.2 for more information). Tasks of Linear Algebra We will consider the following tasks: 1. Solve Ax = b, given A and b. 2. Solve Axi = bi for multiple bi s. 3. Calculate A1 , where A1 A = 1, the identity matrix. 4. Calculate the determinant of A, det(A). 2 Large packages of routines available for these tasks, e.g., LINPACK, LAPACK, GSL (public domain), IMSL, NAG libraries (commercial). We will look at methods assuming n = m. The Augmented Matrix The equation Ax = b can be generalized to a form better suited to ecient manipulation: a12 a11 a1n b1 a21 a22 a2n b2 . (A|b) = . . . . . . . . . . . . an1 an2 ann bn The system can be solved by performing operations on the augmented matrix. The xi s are placeholders that can be omitted until the end of the computation. Elementary row operations The following row operations can be performed on an augmented matrix without changing the solution of the underlying system of equations: 1. Interchange two rows. 2. Multiply a row by a nonzero real number. 3. Add a multiple of one row to another row. The idea is to apply these operations in sequence until the system of equations is trivially solved. The generalized matrix equation Consider the generalized linear matrix equation: a11 a21 a31 a41 a12 a22 a32 a42 a13 a23 a33 a43 a14 a24 a34 a44 x11 x21 x31 x41 x12 x22 x32 x42 x13 x23 x33 x43 y11 y21 y31 y41 y12 y22 y32 y42 y13 y23 y33 y43 y14 y24 y34 y44 = b11 b21 b31 b41 b12 b22 b32 b42 b13 b23 b33 b43 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 . coefficients solutions and inverse RHS and identity Its solution simultaneously solves the linear sets: Ax1 = b1 , Ax2 = b2 , Ax3 = b3 , and AY = 1, where the xi s and bi s are column vectors. 3 Gauss-Jordan Elimination GJE uses one or more elementary row operations to reduce matrix A to the identity matrix. The RHS of the generalized equation becomes the solution set and Y becomes A1. Disadvantages: 1. Requires all bi s to be stored and manipulated at same time memory hog. 2. Dont always need A1 . Other methods more ecient, but good backup. Procedure Start with simple augmented matrix as example: a11 a12 a13 b1 a21 a22 a23 b2 a31 a32 a33 b3 Divide rst ro...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Maryland - ASTR - 07
Class 7. Numerical Linear Algebra, Part 2LU Decomposition Suppose we can write A as a product of two matrices: A = LU, where L is lower triangular and U is upper triangular: 00 L= 0 U= 0 00 Then Ax = (LU) x = L (Ux) = b, i.e.,
Maryland - ASTR - 415
Class 7. Numerical Linear Algebra, Part 2LU Decomposition Suppose we can write A as a product of two matrices: A = LU, where L is lower triangular and U is upper triangular: 00 L= 0 U= 0 00 Then Ax = (LU) x = L (Ux) = b, i.e.,
Maryland - ASTR - 08
Class 8. Root Finding in 1-DNonlinear Equations Often (most of the time?) the relevant system of equations is nonlinear in the unknowns. Then, cannot decompose as Ax = b. Oh well. Instead write as: 1. f (x) = 0 (for functions of one variable, i.e
Maryland - ASTR - 415
Class 8. Root Finding in 1-DNonlinear Equations Often (most of the time?) the relevant system of equations is nonlinear in the unknowns. Then, cannot decompose as Ax = b. Oh well. Instead write as: 1. f (x) = 0 (for functions of one variable, i.e
Maryland - ASTR - 09
Class 9. Root Finding in Multi-D, and Numerical DifferentiationNonlinear Systems of Equations Consider the system f (x, y) = 0, g(x, y) = 0. Plot zero contours of f and g:
Maryland - ASTR - 415
Class 9. Root Finding in Multi-D, and Numerical DifferentiationNonlinear Systems of Equations Consider the system f (x, y) = 0, g(x, y) = 0. Plot zero contours of f and g:
Maryland - ASTR - 10
Class 10. Statistics and the K-S TestStatistical Description of Data Cf. NRiC 14. Statistics provides tools for understanding data. In the wrong hands these tools can be dangerous! Heres a typical data analysis cycle: 1. Apply some formula to da
Maryland - ASTR - 415
Class 10. Statistics and the K-S TestStatistical Description of Data Cf. NRiC 14. Statistics provides tools for understanding data. In the wrong hands these tools can be dangerous! Heres a typical data analysis cycle: 1. Apply some formula to da
Maryland - ASTR - 11
Class 11. Modeling of Data NRiC 15. Model depends on adjustable parameters. Can be used for constrained interpolation. Basic approach: 1. Choose gure-of-merit function (e.g., 2 ). 2. Adjust best-t parameters: minimize merit function. 3. Compute g
Maryland - ASTR - 415
Class 11. Modeling of Data NRiC 15. Model depends on adjustable parameters. Can be used for constrained interpolation. Basic approach: 1. Choose gure-of-merit function (e.g., 2 ). 2. Adjust best-t parameters: minimize merit function. 3. Compute g
Maryland - ASTR - 12
Class 12. Random Numbers NRiC 7. Frequently needed to generate initial conditions. Often used to solve problems statistically. How can a computer generate a random number? It cant! Generators are pseudo-random. Generators are deterministic: its
Maryland - ASTR - 415
Class 12. Random Numbers NRiC 7. Frequently needed to generate initial conditions. Often used to solve problems statistically. How can a computer generate a random number? It cant! Generators are pseudo-random. Generators are deterministic: its
Maryland - ASTR - 13
Class 13. Numerical IntegrationSimple Monte Carlo Integration (NRiC 7.6) Can use RNGs to estimate integrals. Suppose we pick n random points x1 , ., xN uniformly in a multi-D volume V . Basic theorem of Monte Carlo integration: f dV 1 NNVV &lt;
Maryland - ASTR - 415
Class 13. Numerical IntegrationSimple Monte Carlo Integration (NRiC 7.6) Can use RNGs to estimate integrals. Suppose we pick n random points x1 , ., xN uniformly in a multi-D volume V . Basic theorem of Monte Carlo integration: f dV 1 NNVV &lt;
Maryland - ASTR - 14
Class 14. Ordinary Dierential Equations NRiC 16. ODEs involve derivatives with respect to one independent variable, e.g., time t. ODEs can always be reduced to a set of rst-order equations (i.e., involving only rst derivatives). E.g., d2 y dy + b(
Maryland - ASTR - 415
Class 14. Ordinary Dierential Equations NRiC 16. ODEs involve derivatives with respect to one independent variable, e.g., time t. ODEs can always be reduced to a set of rst-order equations (i.e., involving only rst derivatives). E.g., d2 y dy + b(
Maryland - ASTR - 15
Class 15. ODEs, Part 2The Leapfrog Integrator Very useful for second-order DEs in which d2 x/dt2 = f(x), e.g., SHM, N-body, etc. NOTE: Now dropping the prime ( ) from f. Suppose x is position, so d2 x/dt2 is acceleration. Procedure: dene v = dx/
Maryland - ASTR - 415
Class 15. ODEs, Part 2The Leapfrog Integrator Very useful for second-order DEs in which d2 x/dt2 = f(x), e.g., SHM, N-body, etc. NOTE: Now dropping the prime ( ) from f. Suppose x is position, so d2 x/dt2 is acceleration. Procedure: dene v = dx/
Maryland - ASTR - 16
Class 16. ODEs, Part 3Sti ODEs A system of more than one ODE is sti if solutions vary on two or more widely disparate lengthscales. E.g., y = 100y. General solution: y = Ae10x + Be+10x . Suppose BCs are y(0) = 1, y (0) = 10. Then B = 0, i.e., pur
Maryland - ASTR - 415
Class 16. ODEs, Part 3Sti ODEs A system of more than one ODE is sti if solutions vary on two or more widely disparate lengthscales. E.g., y = 100y. General solution: y = Ae10x + Be+10x . Suppose BCs are y(0) = 1, y (0) = 10. Then B = 0, i.e., pur
Maryland - ASTR - 17
Class 17. ODEs, Part 42-pt BVP: Shooting MethodProcedure: 1. At x1 , must specify N starting values for yi , i = 1, ., N. n1 values given by BC at x1 . n2 = N n1 values can be freely chosen. 2. Represent the free values as a vector V of dimensi
Maryland - ASTR - 415
Class 17. ODEs, Part 42-pt BVP: Shooting MethodProcedure: 1. At x1 , must specify N starting values for yi , i = 1, ., N. n1 values given by BC at x1 . n2 = N n1 values can be freely chosen. 2. Represent the free values as a vector V of dimensi
Maryland - ASTR - 18
Class 18. N -body Techniques, Part 1The N -body Problem Study of the dynamics of interacting particles, usually involving mutual forces. E.g., Application Mutual Force gravity stellar dynamics, planetesimals QM molecular dynamics, solid-state physi
Maryland - ASTR - 415
Class 18. N -body Techniques, Part 1The N -body Problem Study of the dynamics of interacting particles, usually involving mutual forces. E.g., Application Mutual Force gravity stellar dynamics, planetesimals QM molecular dynamics, solid-state physi
Maryland - ASTR - 19
Class 19. N -body Techniques, Part 2Time-integration Schemes Clearly, Newtons laws are IVP. Could use any method (Euler, RK4, etc.). But, issue is to balance accuracy vs. eciency. Typically need many particles to capture dynamics correctly (e.g.,
Maryland - ASTR - 415
Class 19. N -body Techniques, Part 2Time-integration Schemes Clearly, Newtons laws are IVP. Could use any method (Euler, RK4, etc.). But, issue is to balance accuracy vs. eciency. Typically need many particles to capture dynamics correctly (e.g.,
Maryland - ASTR - 20
Class 20. N -body Techniques, Part 3The PM Method, ContinuedThere are several distinct steps in PM process: 1. Assign particles to mesh to compute i . 2. Get boundary conditions for (0 and N +1 ). 3. Solve discretized version of Poissons equation.
Maryland - ASTR - 415
Class 20. N -body Techniques, Part 3The PM Method, ContinuedThere are several distinct steps in PM process: 1. Assign particles to mesh to compute i . 2. Get boundary conditions for (0 and N +1 ). 3. Solve discretized version of Poissons equation.
Maryland - ASTR - 21
Class 21. N -body Techniques, Part 4Tree CodesEciency can be increased by grouping particles together: Nearest particles exert greatest forces direct summation. Distant particles exert smallest forces treat in groups.Treat distant particles as
Maryland - ASTR - 415
Class 21. N -body Techniques, Part 4Tree CodesEciency can be increased by grouping particles together: Nearest particles exert greatest forces direct summation. Distant particles exert smallest forces treat in groups.Treat distant particles as
Maryland - ASTR - 22
Class 22. PDEs, Part 1 Cf. NRiC 19.Classication of PDEs A PDE is simply a dierential equation of more than one variable (so an ODE is a special case of a PDE). PDEs are usually classied into three types: 1. Hyperbolic (second or rst order in time
Maryland - ASTR - 415
Class 22. PDEs, Part 1 Cf. NRiC 19.Classication of PDEs A PDE is simply a dierential equation of more than one variable (so an ODE is a special case of a PDE). PDEs are usually classied into three types: 1. Hyperbolic (second or rst order in time
Maryland - ASTR - 23
Class 23. PDEs, Part 2Solving Hyperbolic PDEs, ContinuedUpwind dierencing In addition to amplitude errors (instability or damping), scheme may also have phase errors (dispersion) or transport errors (spurious transport of information). Upwind die
Maryland - ASTR - 415
Class 23. PDEs, Part 2Solving Hyperbolic PDEs, ContinuedUpwind dierencing In addition to amplitude errors (instability or damping), scheme may also have phase errors (dispersion) or transport errors (spurious transport of information). Upwind die
Maryland - ASTR - 24
Class 24. Fluid Dynamics, Part 1 The equations of uid dynamics are coupled PDEs that form an IVP (hyperbolic). Use the techniques described so far, plus additions.Fluid Dynamics in Astrophysics Whenever mean free path problem scale L in a plasm
Maryland - ASTR - 415
Class 24. Fluid Dynamics, Part 1 The equations of uid dynamics are coupled PDEs that form an IVP (hyperbolic). Use the techniques described so far, plus additions.Fluid Dynamics in Astrophysics Whenever mean free path problem scale L in a plasm
Maryland - ASTR - 415
ASTR415 Survey ResultsSpring 2007 11 respondents 1. Computer familiarity [1=Master, 5=None]: Avg = 2.7 [Skilled], Min = 1 [Master], Max = 4 [Novice] 2. Unix familiarity [1=Master, 5=None]: Avg = 3.6 [Skilled], Min = 2 [Expert], Max = 5 [None] 3. Uni
Maryland - ASTR - 415
ASTR415 Spring 2007Due May 08, 2007Term Project1) For your term project you will install and learn how to use a freely available (opensource) 3D visualization tool based on Open-GL. You will write a short report and present in class the results
Maryland - ASTR - 415
| nsttuustBj1d4tssBnn nn Xdss &amp; Xs T a ` C F U IE W P U Rs y ` EY ' W F I 3 w i w w Te T UEY TYE S I P T C W I W p m UE H U T ` y H T y UE XVeiGu(uo&amp;d(Gvtb6dQ&amp;bc(b(xc iqgGgGeb(uu6(xn(g(BxoVXcgGY FE C
Maryland - ASTR - 415
x i e r | z i g j r v fdV i n rv G} ofe } i im f XGl Xl G im hl m f X u e i} g G i} g im g f fe ov i m v i u IfX u e ofe G i m n m i Vn} } i Vn} G oVe } } X i ofw iml g ine m l g l e iV } ne } dFVG r v m v f } | zx
Maryland - ASTR - 415
4Xeex xe e7jj $v )e `j B I Va U b V V U R I F YH Y W V U W R H c W V V F Y WH Q V I Pgp1eCd)wss`Xgpwhe`Xe1wPX)1T Ia R Y W R S U b V Y I W R U U R S Y I R U V F Y I V H b U U T I Va b Y r WH Raa Rt V F D
Maryland - ASTR - 415
ICadafWWaHH$CHIaRp$a$wraWCawHa 9 i i S x i U bIxpU B @ e F k i 6 d B wP v q D A B FP PT B 8 6 qT Q v D 4 B v 4 @ D B F f D F B A @ A B F 6P k Uif'fbS7)UdRT Y rtuCaCdRR99R7$17t$ICdP Y `CaC9ECGR'$i S
Maryland - ASTR - 415
A Crash Course on UNIXUNIX is an &quot;operating system&quot;.Interface between user and data stored on computer. A Windows-style interface is not required. Many flavors of UNIX (and windows interfaces).Solaris, Mandrake, RedHat (fvwm, Gnome, KDE)
Maryland - ASTR - 415
Data RepresentationsComputers store data as different variable types, e.g. integer, floating point, complex, etc. Different machines have different wordlengths, e.g. 4-byte ints on a 32-bit machine (Pentium), 8-byte ints on a 64-bit machine (Alpha).
Maryland - ASTR - 415
VisualizationVisualization is useful for:1) Data 2) Codeentry (initial conditions) debugging and performance analysis and display of results3) Interpretation Our focus will be #3. The computational astrophysicist can either:1) Develop 2) U
Maryland - ASTR - 415
Numerical Linear Algebra Probably the simplest kind of problem. Occurs in many contexts, often as part of larger problem. Symbolic manipulation packages can do linear algebra &quot;analytically&quot; (e.g. Mathematica, Maple). Numerical methods needed when:
Maryland - ASTR - 415
Nonlinear EquationsOften (most of the time?) the relevant system of equations is not linear in the unknowns. Then, cannot decompose as Ax = b. Oh well. Instead write as:(1) (2) f(x) = 0 f(x) = 0function of one variable (1-D) x = (x1,x2,.,xn
Maryland - ASTR - 415
Statistical Description of Data Cf. NRiC, Chapter 14. Statistics provides tools for understanding data.In the wrong hands these tools can be dangerous! Apply some formula to data to compute a &quot;statistic&quot;. Find where value falls in a probability
Maryland - ASTR - 415
Modeling of Data NRiC Chapter 15. Model depends on adjustable parameters. Can be used for &quot;constrained interpolation&quot;. Basic approach:1. 2. 3. 4.Choose figure-of-merit function (e.g. 2). Adjust best-fit parameters: minimize merit function. Co
Maryland - ASTR - 415
Random Numbers NRiC Chapter 7. Frequently needed to generate initial conditions. Often used to solve problems statistically. How can a computer generate a random number? It can't! Generators are pseudo-random. Generators are deterministic: i
Maryland - ASTR - 415
Numerical Integration (Quadrature) NRiC Chapter 4. Already seen Monte Carlo integration. Can cast problem as a differential equation (DE): = is equivalent to solving for I y(b) the DE dy/dx = f(x) with the boundary condition (BC) y(a) =
Maryland - ASTR - 415
Ordinary Differential Equations (ODEs) NRiC Chapter 16. ODEs involve derivatives wrt one independent variable, e.g. time t. ODEs can always be reduced to a set of firstorder equations (involving only first derivatives).e.g. = is
Maryland - MATH - 241
MATH 241 CALCULUS III FIRST MIDTERM EXAM Instructions. Answer each question on a separate answer sheet. Show all your work. Be sure your name, section number, and problem number are on each answer sheet, and that you have copied and signed the honor
Maryland - MATH - 241
MATH 241 CALCULUS III FIRST MIDTERM EXAM SOLUTIONS (1) For this problem, u = + k, and v = + 2 + 3 k. ij i j (a) u v = 1 + 2 3 = 2. k ij (b) u v = det 1 1 1 = 5 2 + 3 k. i j 1 2 3 (c) The symmetric form of the equations are: 2 x =
Maryland - ASTR - 601
Astronomy 601 - Fall 2005 Radiative ProcessesInstructor Prof. Massimo Ricotti Oce: CSS 0213 E-mail: ricotti@astro.umd.edu Phone: (301) 405 5097 Oce hours: by appointment Class web page: http:/www.astro.umd.edu/ricotti/NEWWEB/teaching/ASTR601.html Sc
Maryland - ECE - 2003
Center for Satellite and Hybrid Communication NetworksIntegrated Security Services for Dynamic Coalition ManagementHimanshu Khurana and Vijay Bharadwaj Electrical and Computer Engineering Department, University of Maryland College Park, Maryland 2
Maryland - ECE - 2003
Proceedings of the DARPA Information Survivability Conference and Exposition (DISCEX03) 0-7695-1897-4/03 $17.00 2003 IEEEProceedings of the DARPA Information Survivability Conference and Exposition (DISCEX03) 0-7695-1897-4/03 $17.00 2003 IEEEPr
Maryland - ECE - 2003
Integrated Security Services for Dynamic CoalitionsHimanshu Khurana1, Serban Gavrila1, Rakeshbabu Bobba, Radostina Koleva, Anuja Sonalker, Emilian Dinu, Virgil Gligor, and John Baras Electrical and Computer Engineering Department, University of Mary
Maryland - ECE - 2003
Towards Automated Negotiation of Access Control PoliciesVijay G. Bharadwaj and John S. Baras Institute for Systems Research, University of Maryland, College Park MD 20742, USA. vgb,baras @umd.eduAbstractWe examine the problem of negotiating acces
Maryland - ECE - 2003
DYNAMIC ADAPTATION OF ACCESS CONTROL POLICIESVijay Bharadwaj and John Baras Institute for Systems Research University of Maryland College Park MD 20742ABSTRACTWe describe an architecture and algorithms for deriving an access control policy by com
Maryland - ECE - 2003
Center for Satellite and Hybrid Communication NetworksIntegrated Security Services for Dynamic Coalition ManagementHimanshu Khurana Electrical and Computer Engineering Department, University of Maryland College Park, Maryland 20742 DARPA DC PI Mee