Is there a way to change how numbers are displayed in the output from RecurrenceTable?
stepSize = .5; stepNum = 5; t0 = -1; y0 = -1; f[y_, t_] := y^2 - t;
Grid[Prepend[
RecurrenceTable[{k[n + 1] == k[n] + 1, t[n + 1] == t[n] + stepSize,
y[n + 1] == m[n]*stepSize + y[n], y[0] == y0, k[0] == 0, t[0] == t0,
m[0] == f[y[0], t[0]],
m[n + 1] == f[m[n]*stepSize + y[n], t[n] + stepSize]}, {k, t, y,
m}, {n, stepNum}], {"k", "t", "y[t]", "m"}], Frame -> All]
For example, in the output above RecurrenceTable changes the integer values in the first column, k, to floating point. I'd like for the k column (step number) to display as an integer. I've tried applying functions like Style, IntegerPart, etc. in RecurrenceTable as could be used in Table, but they generate errors.
Also, I used RecurrenceTable here instead of Table because one row element requires the results of a previous row's information in its calculation. This kind of table is fairly simple to create in Excel. Is there a simpler/easier way to emulate this kind of Excel table functionality in Mathematica? RecurrenceTable seems like overkill for this purpose.
stepsize = 1/2
rather than using machine precision numbers. That will generate exact results rather than approximate ones, including thek
step counters. $\endgroup$NDSolve[]
instead… $\endgroup$