My question:
Is there a way to create a tree of values? Something like the output of the command TreeForm, but with values in the nodes?
Why do I want this?
I'm trying to do a complete program to analyse the output of my labs classes.
Each column of data as a symbol assigned. In general, each column is meaningful: it's not just a pile of diferent variables. What i want to say is that in general,calculations are done "column wise".My problem is when i need a to do a calculation that needs a more envolved "horziontal" structure : Assigning the variables to columns lacks "horizontal flexibility" . (In a way,this is the kind of problems that are solved in Excel with the $$
and array formulas)
let me ilustrate with an example:
y={1,2,3,4,5,6,7,8,9};
x={-1,-2,-3};
I want to associate the 1;;3, 4;;8, 9;;9 parts of y to each element of x. What i mean by associating is that for some calculation the input of the function will have as argument each of this sets.
I'm aware of functions like Map, Apply, Thread and MapThread. I've been using them to solve this kind of problems, but sometimes it gets a little confusing.
I'm also aware of Partition, wich would solve my problem if i wanted to separate y in subarrays of the same length.
As i say in my question, what i want is to construct something like a net/tree that "archives" the structure of the arguments in each step of my calculations. Something like in networking theorys, when each node as an associated list of it's connections to the rest of the network. Notice that this list should not contains the values but some kind of coordinates of the connected nodes
Example:
Calculate the mean and the mean square deviation of the irregular partition of lenghts n={3,2,5}
of the list
y={3,5,8,7,9,4,6,2,1,5};
My very conceptual aproach:
The first column of my Table/Tree will be the data y. To refer to some value on some column, I will use a pair of coordinates i,j: i stands for the column and j stands for the internal position. I will assign to y the coordinate i=1.
For the means calculation, what kind of "calculating conections" i have?
Yav=F1[y]=Mean[y]
The column of the means, Xav i=2, will have 3 elements. To each one I assign a list of conections to y:
(Conection of "" is rerpesent with a C"")
CYav[[1]]: {1,{1,2,3}}
CYav[[2]]: {1,{4,5}};
CYav[[3]]: {1,{6,7,8,9,10}}
The connection are written in the form {i,{j's of the elements of i}}
Now, let's calculate the mean squared deviation. That is ,
Ymsd=F2[y,Yav]=Mean[(y-Yav)^2]
This column as i=3
and also 3 elements.
For this calculation, i want to use the columns i=1,2. The calculating connections to y are the same that the ones used to calculate Yav. But now, i need to connect Ymsd to Yav.
CYmsd[[1]]: {{1,{1,2,3}},{2,1}}
CYmsd[[2]]: {{1,{4,5}},{2,2}}
CYmsd[[3]]: {{1,{6,7,8,9,10}},{2,3}}
Now the conections are a pair of conections of the former type, one to each column connected.
After assigning the conections, I would use a function that would fetch the correct values, guided by the map created, and apply the F1,F2.