# Functional operations with data [closed]

I have the following data (a shorter sample of the whole data) :

data = {{1, {{0, 1}}}, {3/2, {{0, 1}}}, {2, {{0, 1}}}, {5/2, {{0, 1}}}, {3, {{0, 1}}}, {7/2, {{2, 1}, {1, 0}, {0, 1}}}, {4, {{2, 1}, {1, 0}, {0, 1}}}, {9/2, {{3, 1}, {2, 1}, {1, 0}, {0, 1}}}, {5, {{3, 1}, {2, 1}, {1, 0}, {0, 1}}}}


A generic element in the data is given by, {9/2, {{3, 1}, {2, 1}, {1, 0}, {0, 1}}}.

The 1st entry of it is some x. Given that x, there can be different y values namely there are only one y=3, one y=2, zero y=1 and one y=0.

I want to have a "degeneracy" function f[x,y] which contains all the information from the data and want to study the asymptotics of that function. E.g. For fixed y/x and x -> Infinity what is the behaviour of (f[x,y]-f[x,0])/y?

Edit : The given x and y the function f[x,y] is known. From the above data, f[9/2,2]=1 , f[4,1]=0, f[3/2,0]=1, and so on.

• Then what are those 1, 1, 0, 1? – Αλέξανδρος Ζεγγ Nov 22 '18 at 2:45
• Can you give the expected output for the data that you have given? – bill s Nov 22 '18 at 6:28
• I know the outputs from data as following. f[9/2,2]=1 , f[4,1]=0, f[3/2,0]=1, and so on. – Physics Moron Nov 22 '18 at 9:34
• Maybe transforming the data into a more "regular" form (a List of {x, y, z}s) is constructive: Flatten /@ Catenate[Thread /@ data]. – Αλέξανδρος Ζεγγ Nov 22 '18 at 11:17

Still not quite sure about what you want. But if your data contain the information needed to provide the output for f[x,y] then you may make better use of your data by converting it to an Association:

assoc = AssociationThread[
data[[All, 1]],
data[[All, 2]] // Map@Function[list,
list[[All, 1]],
list[[All, 2]]
]
]
];


Now you can "lookup" the value for f[x,y] in your data simply by assoc[x,y]:

assoc[9/2,2]
(* 1 *)


Making this more comfortable:

f[ x_?NumericQ, y_?NumericQ, data_Association:assoc ] := Module[
{
result
},
result = data[ x, y ];
If[ MissingQ @ result,
\$Failed,
result
]
]


f @@@ { {9/2, 2}, {4, 1}, {3/2, 0} }