Computing eigenvectors from a transition matrix











up vote
0
down vote

favorite












I have a 21x21 transition matrix modeling the population of a species, and I'm trying to find the long term population proportions of the states. To do this, I'm using numpy.



I found the dominant eigenvalue to be 1.128+0i, however when I access that eigenvalue's associated right eigenvector (which should give long term population proportions), I'm getting an eigenvector with complex entries.



Can a real eigenvalue have a complex eigenvector? I'm beginning to think my numpy code for calculating these values may be incorrect.



This is the matrix. Blank entries have a value of zero.










share|cite|improve this question
























  • Is it possible to post the matrix?
    – Moo
    Nov 14 at 17:11










  • I edited the post.
    – FiFi
    Nov 14 at 18:02






  • 1




    Are you getting something like: $lambda =1.127649281886682$ and $v_1 = {-0.593046+0. i,-0.315548+0. i,-0.223862+0. i,-0.188595+0. i,-0.167246+0. i,-0.148314+0. i,-0.131525+0. i,-0.116637+0. i,-0.077575+0. i,-0.0233898+0. i,-0.446881+0. i,-0.237777+0. i,-0.189774+0. i,-0.159877+0. i,-0.137526+0. i,-0.118299+0. i,-0.0996625+0. i,-0.0839618+0. i,-0.0707345+0. i,-0.0439092+0. i,-0.0311509+0. i}$
    – Moo
    Nov 14 at 19:37












  • I wonder if you have some machine precision, rounding or those types of issues. Are you using infinite precision? Can you increase that?
    – Moo
    Nov 14 at 19:59










  • Ah, I figured it out. The eig() function returns the eigenvectors as columns, when I was reading them as the rows. Thanks for the help.
    – FiFi
    Nov 14 at 20:55















up vote
0
down vote

favorite












I have a 21x21 transition matrix modeling the population of a species, and I'm trying to find the long term population proportions of the states. To do this, I'm using numpy.



I found the dominant eigenvalue to be 1.128+0i, however when I access that eigenvalue's associated right eigenvector (which should give long term population proportions), I'm getting an eigenvector with complex entries.



Can a real eigenvalue have a complex eigenvector? I'm beginning to think my numpy code for calculating these values may be incorrect.



This is the matrix. Blank entries have a value of zero.










share|cite|improve this question
























  • Is it possible to post the matrix?
    – Moo
    Nov 14 at 17:11










  • I edited the post.
    – FiFi
    Nov 14 at 18:02






  • 1




    Are you getting something like: $lambda =1.127649281886682$ and $v_1 = {-0.593046+0. i,-0.315548+0. i,-0.223862+0. i,-0.188595+0. i,-0.167246+0. i,-0.148314+0. i,-0.131525+0. i,-0.116637+0. i,-0.077575+0. i,-0.0233898+0. i,-0.446881+0. i,-0.237777+0. i,-0.189774+0. i,-0.159877+0. i,-0.137526+0. i,-0.118299+0. i,-0.0996625+0. i,-0.0839618+0. i,-0.0707345+0. i,-0.0439092+0. i,-0.0311509+0. i}$
    – Moo
    Nov 14 at 19:37












  • I wonder if you have some machine precision, rounding or those types of issues. Are you using infinite precision? Can you increase that?
    – Moo
    Nov 14 at 19:59










  • Ah, I figured it out. The eig() function returns the eigenvectors as columns, when I was reading them as the rows. Thanks for the help.
    – FiFi
    Nov 14 at 20:55













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a 21x21 transition matrix modeling the population of a species, and I'm trying to find the long term population proportions of the states. To do this, I'm using numpy.



I found the dominant eigenvalue to be 1.128+0i, however when I access that eigenvalue's associated right eigenvector (which should give long term population proportions), I'm getting an eigenvector with complex entries.



Can a real eigenvalue have a complex eigenvector? I'm beginning to think my numpy code for calculating these values may be incorrect.



This is the matrix. Blank entries have a value of zero.










share|cite|improve this question















I have a 21x21 transition matrix modeling the population of a species, and I'm trying to find the long term population proportions of the states. To do this, I'm using numpy.



I found the dominant eigenvalue to be 1.128+0i, however when I access that eigenvalue's associated right eigenvector (which should give long term population proportions), I'm getting an eigenvector with complex entries.



Can a real eigenvalue have a complex eigenvector? I'm beginning to think my numpy code for calculating these values may be incorrect.



This is the matrix. Blank entries have a value of zero.







eigenvalues-eigenvectors mathematical-modeling python transition-matrix






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 14 at 18:02

























asked Nov 14 at 16:04









FiFi

284




284












  • Is it possible to post the matrix?
    – Moo
    Nov 14 at 17:11










  • I edited the post.
    – FiFi
    Nov 14 at 18:02






  • 1




    Are you getting something like: $lambda =1.127649281886682$ and $v_1 = {-0.593046+0. i,-0.315548+0. i,-0.223862+0. i,-0.188595+0. i,-0.167246+0. i,-0.148314+0. i,-0.131525+0. i,-0.116637+0. i,-0.077575+0. i,-0.0233898+0. i,-0.446881+0. i,-0.237777+0. i,-0.189774+0. i,-0.159877+0. i,-0.137526+0. i,-0.118299+0. i,-0.0996625+0. i,-0.0839618+0. i,-0.0707345+0. i,-0.0439092+0. i,-0.0311509+0. i}$
    – Moo
    Nov 14 at 19:37












  • I wonder if you have some machine precision, rounding or those types of issues. Are you using infinite precision? Can you increase that?
    – Moo
    Nov 14 at 19:59










  • Ah, I figured it out. The eig() function returns the eigenvectors as columns, when I was reading them as the rows. Thanks for the help.
    – FiFi
    Nov 14 at 20:55


















  • Is it possible to post the matrix?
    – Moo
    Nov 14 at 17:11










  • I edited the post.
    – FiFi
    Nov 14 at 18:02






  • 1




    Are you getting something like: $lambda =1.127649281886682$ and $v_1 = {-0.593046+0. i,-0.315548+0. i,-0.223862+0. i,-0.188595+0. i,-0.167246+0. i,-0.148314+0. i,-0.131525+0. i,-0.116637+0. i,-0.077575+0. i,-0.0233898+0. i,-0.446881+0. i,-0.237777+0. i,-0.189774+0. i,-0.159877+0. i,-0.137526+0. i,-0.118299+0. i,-0.0996625+0. i,-0.0839618+0. i,-0.0707345+0. i,-0.0439092+0. i,-0.0311509+0. i}$
    – Moo
    Nov 14 at 19:37












  • I wonder if you have some machine precision, rounding or those types of issues. Are you using infinite precision? Can you increase that?
    – Moo
    Nov 14 at 19:59










  • Ah, I figured it out. The eig() function returns the eigenvectors as columns, when I was reading them as the rows. Thanks for the help.
    – FiFi
    Nov 14 at 20:55
















Is it possible to post the matrix?
– Moo
Nov 14 at 17:11




Is it possible to post the matrix?
– Moo
Nov 14 at 17:11












I edited the post.
– FiFi
Nov 14 at 18:02




I edited the post.
– FiFi
Nov 14 at 18:02




1




1




Are you getting something like: $lambda =1.127649281886682$ and $v_1 = {-0.593046+0. i,-0.315548+0. i,-0.223862+0. i,-0.188595+0. i,-0.167246+0. i,-0.148314+0. i,-0.131525+0. i,-0.116637+0. i,-0.077575+0. i,-0.0233898+0. i,-0.446881+0. i,-0.237777+0. i,-0.189774+0. i,-0.159877+0. i,-0.137526+0. i,-0.118299+0. i,-0.0996625+0. i,-0.0839618+0. i,-0.0707345+0. i,-0.0439092+0. i,-0.0311509+0. i}$
– Moo
Nov 14 at 19:37






Are you getting something like: $lambda =1.127649281886682$ and $v_1 = {-0.593046+0. i,-0.315548+0. i,-0.223862+0. i,-0.188595+0. i,-0.167246+0. i,-0.148314+0. i,-0.131525+0. i,-0.116637+0. i,-0.077575+0. i,-0.0233898+0. i,-0.446881+0. i,-0.237777+0. i,-0.189774+0. i,-0.159877+0. i,-0.137526+0. i,-0.118299+0. i,-0.0996625+0. i,-0.0839618+0. i,-0.0707345+0. i,-0.0439092+0. i,-0.0311509+0. i}$
– Moo
Nov 14 at 19:37














I wonder if you have some machine precision, rounding or those types of issues. Are you using infinite precision? Can you increase that?
– Moo
Nov 14 at 19:59




I wonder if you have some machine precision, rounding or those types of issues. Are you using infinite precision? Can you increase that?
– Moo
Nov 14 at 19:59












Ah, I figured it out. The eig() function returns the eigenvectors as columns, when I was reading them as the rows. Thanks for the help.
– FiFi
Nov 14 at 20:55




Ah, I figured it out. The eig() function returns the eigenvectors as columns, when I was reading them as the rows. Thanks for the help.
– FiFi
Nov 14 at 20:55










1 Answer
1






active

oldest

votes

















up vote
0
down vote













The eig() function returns the eigenvectors as columns. To access the one I needed, I took the transpose of the evecs array, and then called the desired eigenvector: evecsTrans[i]






share|cite|improve this answer





















    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2998437%2fcomputing-eigenvectors-from-a-transition-matrix%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    The eig() function returns the eigenvectors as columns. To access the one I needed, I took the transpose of the evecs array, and then called the desired eigenvector: evecsTrans[i]






    share|cite|improve this answer

























      up vote
      0
      down vote













      The eig() function returns the eigenvectors as columns. To access the one I needed, I took the transpose of the evecs array, and then called the desired eigenvector: evecsTrans[i]






      share|cite|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        The eig() function returns the eigenvectors as columns. To access the one I needed, I took the transpose of the evecs array, and then called the desired eigenvector: evecsTrans[i]






        share|cite|improve this answer












        The eig() function returns the eigenvectors as columns. To access the one I needed, I took the transpose of the evecs array, and then called the desired eigenvector: evecsTrans[i]







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Nov 14 at 20:58









        FiFi

        284




        284






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2998437%2fcomputing-eigenvectors-from-a-transition-matrix%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix