Select the vector component if the real part is sufficiently small

In summary, the conversation discusses the process of selecting a specific element from a list of complex numbers based on its real or imaginary part. The speaker is trying to identify the correct way to order and sort these numbers, which are being used to solve a quadratic eigenvalue problem. The conversation ends with a suggested solution to the problem using Mathematica.
  • #1
member 428835
Hi PF!

Given a list of numbers, how do I select the element that has the smallest real part? I don't just want the real part though, I want the entire component.

I googled this and tried a few things but nothing works.
 
Physics news on Phys.org
  • #2
Can you provide some context here? Are these complex numbers or vectors whose components are complex numbers or qaternions?
 
  • #3
jedishrfu said:
Can you provide some context here? Are these complex numbers or vectors whose components are complex numbers or qaternions?
I'm given a single vector who's components are complex. I'm iterating through a parameter, and as I do, Mathematica automatically sorts them (unsure how, it's under the hood). The parameter value I loop through sometimes sends the real part of some components to zero. Then Mathematica sorts, but the output is different, causing me a headache to find the correct vector position.

Example: let's say after three iterations the output vector looks as follows for each iteration $$\begin{bmatrix}1.6+i\\6.5+0i\\4+21i\end{bmatrix}\to\begin{bmatrix}1.5+1.2i\\4.8+200i\\0+36i\end{bmatrix}\to \begin{bmatrix}1.2+1.5i\\0+53i\\0+400i\end{bmatrix}$$

Each vector component should be smoothly transitioning through iterations, so there should be no jumps, and in fact each progression should be monotonic in both real and imaginary components. Notice going from vector 2 to 3 the sorting changes. Clearly in vector 3, the 2nd and 3rd component should be changed. However, sometimes Mathematica sorts outputs very confusing.

So I'm trying to identify the correct way to order these outputs.
 
  • #4
Honestly I don’t know how sorting is involved here. Is it using the modulus of the complex number to order the components of each vector or more correctly list if it’s being sorted?

Are you saying you have some parameter say “t” that you are iterating over and multiplying the first vector by “t” to get the next vector? So that you are tracing some particles trajectory in a 3D complex number space?
 
  • #5
jedishrfu said:
Honestly I don’t know how sorting is involved here. Is it using the modulus of the complex number to order the components of each vector or more correctly list if it’s being sorted?
Yea I think that's exactly what it's doing.

jedishrfu said:
Are you saying you have some parameter say “t” that you are iterating over and multiplying the first vector by “t” to get the next vector? So that you are tracing some particles trajectory in a 3D complex number space?
I'm afraid it's a little more complicated. I'm solving the quadratic eigenvalue problem $$M+\lambda \epsilon \Phi + \lambda^2 K = 0$$ where ##\epsilon## is changing. As it changes, the eigenvalues change, but they do so smoothly. The real parts of the eigenvalues eventually vanish, but the complex components monotonically rise, but at different slopes. But if the quantities are well ordered (no overlap) then I'm actually thinking I could order these by their imaginary components, since these components should grow approximately linearly.

Do you know how to do this?
 
  • #6
No, but it’s good you explained it better as someone might jump in and help.

Can you add any more on the M, ##\lambda##, ##\epsilon##, ##\Phi##, and K?
 
  • #7
If you want to extract the element of a list of complex constants with the smallest real part then

Code:
SortBy[{1.5 + 1.2 I, 4.8 + 200 I, 0 + 36 I}, Re][[1]]

will give you

Code:
36 I

If you want to order a vector of complex constants by their imaginary components then this

Code:
SortBy[{1.5 + 1.2 I, 4.8 + 200 I, 0 + 36 I}, Im]

will give you this

Code:
{1.5 + 1.2 I, 0 + 36 I, 4.8 + 200 I}
 
Last edited:
  • Like
Likes jedishrfu and member 428835

Related to Select the vector component if the real part is sufficiently small

1. What is a vector component?

A vector component is a quantity that represents the magnitude and direction of a vector. It is a part of the vector that contributes to its overall direction and can be used to break down a vector into smaller, more manageable parts.

2. How is the real part of a vector determined to be sufficiently small?

The real part of a vector is determined to be sufficiently small when its value is close to zero. This can be determined using mathematical calculations or by comparing it to other vectors in the same system.

3. Why is it important to select the vector component if the real part is sufficiently small?

Selecting the vector component when the real part is sufficiently small allows for more accurate calculations and analysis. It helps to simplify the vector and make it easier to work with in mathematical equations.

4. Can a vector component be negative if the real part is sufficiently small?

Yes, a vector component can be negative even if the real part is sufficiently small. The real part only refers to the size of the component, not its direction. A negative vector component simply means that it is pointing in the opposite direction of a positive vector component.

5. How is this concept applied in scientific research?

The concept of selecting the vector component when the real part is sufficiently small is commonly used in fields such as physics, engineering, and mathematics. It allows scientists to simplify complex vector equations and make accurate predictions and calculations in their research.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Science and Math Textbooks
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
13
Views
647
  • Differential Geometry
Replies
6
Views
2K
Replies
9
Views
1K
  • Mechanical Engineering
Replies
15
Views
1K
  • Calculus and Beyond Homework Help
Replies
9
Views
1K
Back
Top