Applying a Common for() Statement to Multiple Formulas
Another useful application of the for() definition is using one loop to compute multiple formulas. The two examples below are functionally identical.
Ex1.
"for(t in 2..time)" : {
"coordX[t]" : {dimensions: ['time'], formula: "coordX[t-1] + Vx[t]" }
}
"for(t in 2..time)" : {
"coordY[t]": {dimensions: ['time'], formula: "coordY[t-1} + Vy[t]" }
}
Ex2.
"for(t in 2..time)" : {
"coordX[t]": {dimensions: ['time'], formula: "coordX[t-1] + Vx[t]" }
"coordY[t]": {dimensions: ['time'], formula: "coordY[t-1} + Vy[t]" }
}
Note: It is also possible to bind data to external sources using indexed array formulas. See the earlier topic, Using the Binding Property, for more information.
|