eig(A,?,?,?)

..  eig(A,[irange,][vl,][vu,][permute=true,][scale=true]) -> D, V

Computes eigenvalues and eigenvectors of ``A``. See :func:`eigfact` for
details on the ``balance`` keyword argument.

.. doctest::

   julia> eig([1.0 0.0 0.0; 0.0 3.0 0.0; 0.0 0.0 18.0])
   ([1.0,3.0,18.0],
   3x3 Array{Float64,2}:
    1.0  0.0  0.0
    0.0  1.0  0.0
    0.0  0.0  1.0)

``eig`` is a wrapper around :func:`eigfact`, extracting all parts of the
factorization to a tuple; where possible, using :func:`eigfact` is
recommended.

Examples

In the Julia programming language, the eig(A, B) function computes the generalized eigenvalues and eigenvectors of matrix A with respect to matrix B. It is a wrapper around the eigfact function, extracting all parts of the factorization into a tuple. However, it is recommended to use eigfact directly whenever possible.

Here are some common examples of using the eig(A, B) function:

  1. Compute generalized eigenvalues and eigenvectors:

    julia> A = [1 2; 3 4];
    julia> B = [5 6; 7 8];
    julia> D, V = eig(A, B);
    julia> D
    2-element Array{Complex{Float64},1}:
    -0.3722813232690143 + 0.0im
     5.372281323269014 + 0.0im
    
    julia> V
    2×2 Array{Complex{Float64},2}:
    -0.5615528128088303+0.0im  -0.24347053680771607-0.0im
     0.8276707946526256+0.0im  -0.9701425001453313 +0.0im

    This example computes the generalized eigenvalues and eigenvectors of matrices A and B and stores them in D and V respectively.

  2. Compute generalized eigenvalues only:
    julia> A = [1 2; 3 4];
    julia> B = [5 6; 7 8];
    julia> D = eig(A, B)[1];
    julia> D
    2-element Array{Complex{Float64},1}:
    -0.3722813232690143 + 0.0im
     5.372281323269014 + 0.0im

    In this example, only the generalized eigenvalues are computed and stored in D.

Remember, it is typically recommended to use eigfact instead of eig for better performance and flexibility.

See Also

Ac_ldiv_B, Ac_ldiv_Bc, Ac_mul_B, Ac_mul_Bc, Ac_rdiv_B, Ac_rdiv_Bc, At_ldiv_B, At_ldiv_Bt, At_mul_B, At_mul_Bt, At_rdiv_B, At_rdiv_Bt, A_ldiv_Bc, A_ldiv_Bt, A_mul_B!, A_mul_Bc, A_mul_Bt, A_rdiv_Bc, A_rdiv_Bt, Bidiagonal, cond, conv2, det, diag, diagind, diagm, diff, eig, eigvals, eigvecs, expm, eye, full, inv, isdiag, ishermitian, isposdef, isposdef!, issym, istril, istriu, logabsdet, logdet, lyap, norm, qrfact, rank, repmat, rot180, rotl90, rotr90, sortrows, sqrtm, SymTridiagonal, trace, Tridiagonal, tril, tril!, triu, triu!, writedlm,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: