Question: Equivalent of lookup function?

test.mw

Hello. As you can see the minimum of set X is 2.

the time pair in set W whose difference is 2 corresponds to elements 54 and 55. How do i locate and print these automatically?

Digits:=4:

U := [1.010, 1.110, 1.210, 1.310, 1.410, 1.510, 1.610, 1.710, 1.810, 1.910, 2.020, 2.120, 2.220, 2.320, 2.420, 2.520, 2.620, 2.720, 2.820, 2.920, 3.030, 3.130, 3.230, 3.330, 3.430, 3.530, 3.630, 3.730, 3.830, 3.930, 4.040, 4.140, 4.240, 4.340, 4.440, 4.540, 4.640, 4.740, 4.840, 4.940, 5.050, 5.150, 5.250, 5.350, 5.450, 5.550, 5.650, 5.750, 5.850, 5.950, 6.060, 6.160, 6.260, 6.360, 6.460, 6.560, 6.660, 6.760, 6.860, 6.960, 7.070, 7.170, 7.270, 7.370, 7.470, 7.570, 7.670, 7.770, 7.870, 7.970, 8.080, 8.180, 8.280, 8.380, 8.480, 8.580, 8.680, 8.780, 8.880, 8.980, 9.090, 9.190, 9.290, 9.390, 9.490, 9.590, 9.690, 9.790, 9.890, 9.990, 10.01, 11.11, 12.21]:

W := select(proc (t) options operator, arrow; .59 >= frac(t) end proc, U);

[1.010, 1.110, 1.210, 1.310, 1.410, 1.510, 2.020, 2.120, 2.220, 2.320, 2.420, 2.520, 3.030, 3.130, 3.230, 3.330, 3.430, 3.530, 4.040, 4.140, 4.240, 4.340, 4.440, 4.540, 5.050, 5.150, 5.250, 5.350, 5.450, 5.550, 6.060, 6.160, 6.260, 6.360, 6.460, 6.560, 7.070, 7.170, 7.270, 7.370, 7.470, 7.570, 8.080, 8.180, 8.280, 8.380, 8.480, 8.580, 9.090, 9.190, 9.290, 9.390, 9.490, 9.590, 10.01, 11.11, 12.21]

(1)

X:=[seq(trunc(W[i+1])*60+frac(W[i+1])*100-(trunc(W[i])*60+frac(W[i])*100),i=1..nops(W)-1)];

[10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 11.00, 10.00, 10.00, 10.00, 10.00, 10.00, 2.00, 70.00, 70.00]

(2)

NULL

min(X),{W[54],W[55]};

2.00, {9.590, 10.01}

(3)

 



Download test.mw

Please Wait...