Is what I'm looking to do possible? I know that I can get it to work with a for loop, but a table would make things much neater.
What I need to do while calculation the table below is to reset the variable l
such that l = l - fretScale[y_]
. l
is initially set to 25.
l = 25 ;(* Nominal string length *)
fretScale[y_] := l*(1 - 1/2^(1/12)) // N;
Table[fretScale[y], {y, 1, 30, 1}]
What I did with the for loop (which works is this:
For[i = 1; y = 0, i < n + 1, i++,
y = l*(1 - 1/2^(1/12)) // N;
l = l - y
(Note, in the loop fretScale[y_]
is defined as y, not as a defined function)
The table function above calculates the correct first fret position of 1.403, but keeps l
fixed at 25 and I need to successively make l
range from 25, 23.597, 22.273,...
The output I get for the table is:
{1.40314, 1.40314, 1.40314, ...}
what I want (and get for the for loop is)
{1.40314, 2.72753, 3.97759, ...}
k[x_] := x - x*(1 - 1/2^(1/12)) // N; NestList[k, 25, 10]
$\endgroup$ – Dr. belisarius Oct 6 '15 at 20:27