In a previous question I asked how to distinguish between the roots of a system of equations. However I did not obtain any working solution, so let's make things simpler now.
Assuming we have the following list
data = {{-0.613042, 3.72089*10^-20}, {0.3, 0.0631203},
{0.3, -0.0631203}, {0.302369, 8.6956*10^-17},
{0.969193, 4.35961*10^-19}}
As we can see, it contains five elements corresponding to five points on the $(x,y)$ plane. Three of them lie on the $x$ axis, while the other two have non zero value of $y$.
I want to create a second list, data2
, containing the following information
data2 = {xL1, xL2, xL3, xL4, yL4}
where
- xL2 is the root on the $x$ axis with the highest value of $x$,
- xL3 is the root on the $x$ axis with the smallest value of $x$,
- xL1 is the root on the $x$ axis which is between xL2 and xL3,
- xL4 is the root on the (x,y) plane with non zero value of $y$,
- yL4 is the corresponding value of xL4.
For this example we have xL1 = 0.302369
, xL2 = 0.969193
, xL3 = -0.613042
, and (xL4, yL4) = (0.3, 0.0631203)
.
Note 1: The determination of the elements of data2
should be done automatically for every given list (data
).
Note 2: In some cases the initial list could contain only three elements which are the three points on the $x$ axis. For example we could have
data = {{-2.00803, 2.31869*10^-23}, {0.738218, -1.29609*10^-15},
{1.75066, -1.61207*10^-18}}
In this case, data2
should contain only data2 = {xL1, xL2, xL3}
without printing Null
in the 4th and 5th position.
Any ideas on how to achieve this?
xL1
etc just the x-value of the root, or the x-y tuple? $\endgroup$ – Quantum_Oli Oct 17 '16 at 9:30xL1 = 0.302369
,xL2 = 0.969193
,xL3 = -0.613042
, and(xL4, yL4) = (0.3, 0.0631203)
. $\endgroup$ – Vaggelis_Z Oct 17 '16 at 9:37yL4
should be positive. $\endgroup$ – Quantum_Oli Oct 17 '16 at 9:44