I have the following function:
vt[ea_, v0_, cm_, b_] := ea + (v0 - cm)*b
ea is a set of lists and cm is also set of lists, b is a constant and for v0 the startvalue is 5000. After the first step the function should use the output of the expression vt[ea_, v0_, cm_, b_] for v0. It is a recursion function. For this I can use the following FoldList definition:
FoldList[vt[#2[[1]], #1, #2[[2]], b] &, v0, {eacm}]
For ea and cm, I have a set of lists a little bit more than in the example below.
ea = {{5, 6, 7}, {1, 2, 3}, {4, 8, 9}}
cm = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
Now I transposed this into a list of pairs with the following expression to use it in the FoldList command:
Transpose[{ea, cm}, {3, 1, 2}]
The output is the following multidimensional array:
eacm =
{{{5, 1}, {6, 2}, {7, 3}}, {{1, 4}, {2, 5}, {3, 6}}, {{4, 7}, {8, 8}, {9, 9}}}
But the FoldList expression above doesn´t work with this multidimensional array. It only works with one list. I think I have to change something in the #2[[1]], #2[[2]] arguments.
My first question is: what do I have to change in the FoldList expression above to get it to work? My second question is: can I transform the multidimensional array into a matrix or a set of lists with the form:
eacm =
{{5, 1}, {6, 2}, {7, 3}}, {{1, 4}, {2, 5}, {3, 6}}, {{4, 7}, {8, 8}, {9, 9}}
I think I am close to a solution of my problem. Hope someone can help me.
eacm[[i]]for{1,2,3}to make three seperate lists – Feyre Jul 17 '16 at 11:06