I'm working on improving a modeling formula and have spreadsheets worth of data to use, but my work so far has been quite tedious. I'm essentially pulling 20 rows of data from each separate sheet of a spreadsheet to put through the new formula, and I'm having to do a cell evaluation for each row rather than a single evaluation per sheet. As I said, it's getting tedious.
These can be declared first:
a = 0;
m = 34;
sheet = 1; (* which sheet of the spreadsheet I'm pulling from *)
r = 2; (* the first row I pull from *)
w = 8;
d = 4;
ex = .591;
For each sheet, these values (except r) will be the same (as I'm having to change r twenty times for each sheet). I then have this:
gs = Import["filename", {"Data", sheet, {r}, {6}}] + a
ga = Import["filename", { "Data", sheet, {r}, {7}}]
Here I pull the data from the sheet and row declared earlier, from static columns 6 and 7. From here, it's just plugging this data into the components of the formula:
y = ((gs + ga)/m)^ex
k = Gamma[1 + 1/y]
gsa = (gs/m) + 0.5
gaa = (ga/m) + 0.5
new = m*((3*N[Sum[-((Exp[-((k (c + 1))/gsa)^y] - Exp[-((k* c)/gsa)^y]) (1 -
Exp[-((k* c)/gaa)^y])), {c, 0, w}], 40]) +
N[Sum[(Exp[-((k (c + 1))/gsa)^y] -
Exp[-((k* c)/gsa)^y]) (Exp[-((k (c + 1))/gaa)^y] -
Exp[-((k* c)/gaa)^y]), {c, 0, d}], 40])
final = Ceiling[new]
Redundant statements: as of right now, for every row I want to import, I have to manually adjust r for each evaluation. That's 20 tedious adjustments per sheet, and while it takes all of, like, ten seconds to then record the final value and increase r by 1, it's just not a feasible way of churning through volumes and volumes of data.
Is there a way to split this into two cells, with the first declaring everything before gs, and the second giving the value of final for each r from 2 to 21? This would, quite honestly, be a 20x time saver. I'm just too unfamiliar with Mathematica (still on the trial, licensing when it expires) to figure out the matrix or loop (?) to save me the time.
Any help would be so, so, so appreciated.