Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8326271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:42:35+00:00 2026-06-09T00:42:35+00:00

Trying to use scipy’s linalg.eig to solve a generalized eigenvalue problem. I then check

  • 0

Trying to use scipy’s linalg.eig to solve a generalized eigenvalue problem. I then check the solution I get and it does not seem like proper eigenvectors were returned. Also, the documentation suggests vectors returned are normalized and this is not the case (though that doesn’t bother me that much).

Here are sample matrices:

>>> a
array([[  2.05630374e-01,   8.89584493e-10,  -1.46171715e-06],
       [  8.89584493e-10,   2.38374743e-02,   9.43440334e-06],
       [ -1.46171715e-06,   9.43440334e-06,   1.39685787e-02]])
>>> b
array([[ 0.22501692, -0.07509864, -0.05774453],
       [-0.07509864,  0.02569336,  0.01976284],
       [-0.05774453,  0.01976284,  0.01524993]])

Running eig I get:

>>> w,v = linalg.eig(a,b)
>>> w
array([  3.08431414e-01+0.j,   5.31170281e+01+0.j,   6.06298605e+02+0.j])
>>> v
array([[-0.26014092, -0.46277857, -0.0224057 ],
       [ 0.76112351, -0.59384527, -0.83594841],
       [ 1.        , -1.        ,  1.        ]])

And then testing the result:

>>> a*v[:,0]
array([[ -5.34928750e-02,   6.77083674e-10,  -1.46171715e-06],
       [ -2.31417329e-10,   1.81432622e-02,   9.43440334e-06],
       [  3.80252446e-07,   7.18074620e-06,   1.39685787e-02]])
>>> w[0]*b*v[:,0]
array([[-0.01805437+0.j, -0.01762974+0.j, -0.01781023+0.j],
       [ 0.00602559-0.j,  0.00603163+0.j,  0.00609548+0.j],
       [ 0.00463317-0.j,  0.00463941+0.j,  0.00470356+0.j]])

I thought those two will be equal but they are not… I also tried using eigh instead with no success. Would appreciate any help, I’m obviously missing something.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:42:36+00:00Added an answer on June 9, 2026 at 12:42 am

    You can see what’s going on by looking at the shape of your output. Your a*v[:,0] should give a vector, so why are you getting a 3×3 array? Answer: because you’re not doing matrix multiplication, you’re doing component-wise array multiplication.

    IOW, you did

    >>> a * v[:,0]
    array([[ -5.34928759e-02,   6.77083679e-10,  -1.46171715e-06],
           [ -2.31417334e-10,   1.81432623e-02,   9.43440334e-06],
           [  3.80252453e-07,   7.18074626e-06,   1.39685787e-02]])
    >>> w[0] * b * v[:,0]
    array([[-0.01805437+0.j, -0.01762974+0.j, -0.01781023+0.j],
           [ 0.00602559-0.j,  0.00603163+0.j,  0.00609548+0.j],
           [ 0.00463317-0.j,  0.00463941+0.j,  0.00470356+0.j]])
    

    when you really wanted

    >>> a.dot(v[:,0])
    array([-0.05349434,  0.0181527 ,  0.01397614])
    >>> w[0] * b.dot(v[:,0])
    array([-0.05349434+0.j,  0.01815270+0.j,  0.01397614+0.j])
    

    or

    >>> matrix(a)*matrix(v[:,0]).T
    matrix([[-0.05349434],
            [ 0.0181527 ],
            [ 0.01397614]])
    >>> w[0]*matrix(b)*matrix(v[:,0]).T
    matrix([[-0.05349434+0.j],
            [ 0.01815270+0.j],
            [ 0.01397614+0.j]])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use SciPy to solve a very simple equation (Kepler's equation)
I'm trying to use scipy.leastsq() as a method of finding a best fit point
I am trying to use the scipy stats package in Python and am getting
I'm trying to use the ndimage library from scipy, but its apparently missing. I
I am trying to use scipy and numpy to perform matrix addition and multiplication.
I am trying use Thread but i have some problem (I am beginner at
I'm trying to use Python and Numpy/Scipy to implement an image processing algorithm. The
I'm trying to use scikit.learn which needs numpy/scipy arrays for input. The featureset generated
I am trying use an iterator to go through a set and then do
I've been trying to use scipy.interpolate.bisplrep() and scipy.interpolate.interp2d() to find interpolants for data on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.