Group Abstract Group Abstract

Message Boards Message Boards

0
|
76 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Picking a specific output from a function in the selection parameter of Solve[]

Posted 6 days ago

Hi;

I am trying to use the function Solve[] and Eigenvalues[] to solve for an unknown p variable as follows:

SolveValues[Eigenvalues[{{6/10, 1/2}, {-p, 6/5}}] == {1,}, p]

The problem is that the function Eigenvalues[] returns 2 values but I am only interested in the value of the 1st Eigenvalue as shown above with == {1, }. In these functions that return multiple values, is there a way that I can select only the variables of interest. In the above example, I am only interested in solving for the value of p if the first Eigenvalue equals "1" and I don't care about the value of the 2nd Eigenvalue.

Thanks,
Mitch Sandlin

POSTED BY: Mitchell Sandlin
6 Replies
Posted 2 days ago

-moved to thread-

POSTED BY: Eric Rimbey

If by "first" eigenvalue you mean the larger one, you can do it this way:

mat = {{6/10, 1/2}, {-p, 6/5}};
sol = Solve[Max[Eigenvalues[mat]] == 1, p]
Eigenvalues[mat /. sol[[1]]]
POSTED BY: Gianluca Gorni

Thanks so much Glanluca;

What your response was not exactly what I asked for, but it was exactly what I needed.

Thanks Again,

Mitch Sandlin

POSTED BY: Mitchell Sandlin
Posted 6 days ago

You can just take the first member of the pair returned by Eigenvalues:

Solve[Eigenvalues[{{6/10, 1/2}, {-p, 6/5}}][[1]] == 1, p]

But how do you know which result from Eigenvalues will be the one that has the form that you want to solve?

POSTED BY: Eric Rimbey

Hi Eric;

I find your response extremely interesting. Correct me if I am wrong, but it appears that you are using the Eigenvalues function as a pure function identifying and isolating the first Eigenvalue as the comparison value. What would the syntax look like if I wanted to make comparisons on both Eigenvalues, if that is possible?

To answer your question about which Eigenvalue to use, I used trial and error by obtaining an answer and plugging it back into the matrix and then calculating the Eigenvalues using the updated matrix.

Thanks,

Mitch Sandlin

POSTED BY: Mitchell Sandlin
Posted 2 days ago

Sure, you can think of Eigenvalues as a pure function, but that's beside the point in terms of an explanation. Eigenvalues returns a list, and Part (I'm using the [[]] syntax for Part) extracts elements from a list. So, when you said you wanted to use the first eigenvalue, I just used [[1]] to extract the first item from the list given by Eigenvalues.

To make the same type of comparison on both eigenvalues simultaneously, you probably want to do some sort of threading. There are several functions that do some form of threading, but the simplest and most obvious one is Thread:

Thread[{a, b} == {c, d}]
(* {a == c, b == d} *)

So,

Thread[Eigenvalues[{{1, 1}, {p, 1}}] == {x, y}]
(* {1 - Sqrt[p] == x, 1 + Sqrt[p] == y} *)

I'm not sure this is what you were asking for, just my best guess.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard