The limitation to be Hermitian is not essential and comes for the limitation of the standard Ada linear algebra library. The following program implements exponentiation of a square Hermitian complex matrix by any complex power. Second, it can efficiently visualize a vector field by iterating a grid of initial states forward in time and using arrows to connect the initial and final states.With Ada.Text_IO use Ada.Text_IO procedure Test_Matrix is generic type Element is private Zero : Element One : Element with function "+" ( A, B : Element ) return Element is with function "*" ( A, B : Element ) return Element is with function Image ( X : Element ) return String is package Matrices is type Matrix is array ( Integer range, Integer range ) of Element function "*" ( A, B : Matrix ) return Matrix function "**" ( A : Matrix Power : Natural ) return Matrix procedure Put ( A : Matrix ) end Matrices package body Matrices is function "*" ( A, B : Matrix ) return Matrix is R : Matrix ( A ' Range ( 1 ), B ' Range ( 2 )) Sum : Element := Zero begin for I in R ' Range ( 1 ) loop for J in R ' Range ( 2 ) loop Sum := Zero for K in A ' Range ( 2 ) loop Sum := Sum + A ( I, K ) * B ( K, J ) end loop R ( I, J ) := Sum end loop end loop return R end "*" function "**" ( A : Matrix Power : Natural ) return Matrix is begin if Power = 1 then return A end if declare R : Matrix ( A ' Range ( 1 ), A ' Range ( 2 )) := ( others => ( others => Zero )) P : Matrix := A E : Natural := Power begin for I in P ' Range ( 1 ) loop - R is identity matrix R ( I, I ) := One end loop if E = 0 then return R end if loop if E mod 2 /= 0 then R := R * P end if E := E / 2 exit when E = 0 P := P * P end loop return R end end "**" procedure Put ( A : Matrix ) is begin for I in A ' Range ( 1 ) loop for J in A ' Range ( 1 ) loop Put ( Image ( A ( I, J ))) end loop New_Line end loop end Put end Matrices package Integer_Matrices is new Matrices (Integer, 0, 1, Image => Integer'Image ) use Integer_Matrices M : Matrix ( 1. Thus, the matrix exponential converts a continuous-time system into a discrete iterative system. This article demonstrates two useful properties of the matrix exponential.įirst, it can be used as a "one-step" operator that enables you to generate points along a trajectory by iterating an initial state. In elementary courses on differential equations, it is often presented either as a formal power series of matrices or as a concise notation that represents the general solution of a linear system of ODEs. This article discusses the matrix exponential operator. Notice that the entire graph is produced by using one matrix multiplication there are no loops. Trajectories approach the origin along the X axis and move away from the origin along the Y axis. The graph visualizes the linear vector field. Vector x=x1 y=y1 / xorigin=x0 yorigin=y0 ).įor a square matrix, A, the matrix expm(A) is defined by the following infinite series, which is based on the Taylor series expansion for the scalar exponential function:.Is a generalization of the familiar exponential function.ĭenote the matrix exponential function by expm( (Actually, these sets are non-commutative rings since they support addition and multiplication.) The matrix exponential function is a mapping from the set of square matrices to the set of invertible matrices. This article discusses the exponential of a matrix: what it is, how to compute it, why it is useful, and why you should think of it as a linear map that converts a continuous system of differential equations into a discrete iterative process. In SAS, you can approximate the exponential of a matrix by using the EXPMATRIX function in SAS IML software.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |