Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagonalize parametric matrix #77

Open
matteoettam09 opened this issue Mar 12, 2021 · 6 comments
Open

Diagonalize parametric matrix #77

matteoettam09 opened this issue Mar 12, 2021 · 6 comments

Comments

@matteoettam09
Copy link

Hello,

is it possible to get a parametric eigendecomposition of a matrix whose elements are a mix of known numerical values and parametric variables, expressed as ndpoly entries?

Thank you.

@jonathf
Copy link
Owner

jonathf commented Mar 14, 2021

Currently no. I am not even sure if I understand how that would work. In the governing equation A x = lambda x do we assume all terms are polynomial scalar/vectors/matrices?

If you know how to approach such a problem and know of reading matterial I can look at, I can let you know if it would be feasable to implement or not.

@matteoettam09
Copy link
Author

I think both the eigenvalue matrix and the eigenvector matrix (and its inverse) are in general a function of polynomial scalars appearing inside the given matrix, so yes, if I understand your question correctly.

Unfortunately, I have no idea about how to deal with the problem, it's just something that came out of my research.

@jonathf
Copy link
Owner

jonathf commented Mar 28, 2021

I figured a way to solve this, but it requires a few new functions that are not currently implemented.
Stay tuned and I'll get back to this thread when all needed compoents are in place.

@matteoettam09
Copy link
Author

Great! Thank you.

@jonathf
Copy link
Owner

jonathf commented Apr 2, 2021

So here is working example that should work in version 1.1.3:

import numpy as np
import numpoly as nu

# q1, q2 are parameters, q0 reserved for calculations as lambda
q0, q1, q2 = nu.variable(3)

# parametric matrix to find eigen vectors/values from
mat = nu.polynomial([[1, q1], [q2, 1]])

# characteristic eq == 0
char_expr = nu.det(mat-np.eye(len(mat))*q0)

# evaluate parameters and extract eigen values
eig_vals = nu.roots(nu.polynomial(char_expr(q1=3, q2=1)))

Temporary caveates:

  • q0 has to be reserved to the "lambda" variable.
  • char_expr needs to be cast to nu.polynomial to ensure end polynomial is in face 1D before root algorithm is used.

Let me know if this is what you were looking for.

@matteoettam09
Copy link
Author

Yes, thank you, this is exactly was I was looking for!
I will start working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants