Is there a way in mathematica to do same operation on multiple files at once? And preferably have the output in a table or list form?
I want to do the following operation preferably in few non-labor intensive steps as possible. (As before this, I did it allll by hand, pluggging in each number for each file. AND IT WAS NO FUN;;-( )
I have files, a001, ... a100, which contains two field(column) of numerical data that look like the following
2 4
5 6
3 7
...
..
.
For each file, I need to import/use the data in a variable in an equation and locate the global maximum which boundaries.
f:= Beta[2+a,4+b]Beta[5+a,6+b]Beta[3+a,7+b]......../(Beta[a,b]^n)]
To make the problem more complicated n is the number of rows in each file.
Next I would use NMaximize function with ristriction on 100>a>0, 100>b>0 like the following
NMaximize[{Log[f], 100 > a > .1^10, 100 > b > .1^10}, {a, b},
Method -> "NelderMead", MaxIterations -> 10000]
And if possible I would like to get the results of all NMaximize methods.
NMaximize[{Log10[f], 100 > a > .1^10, 100 > b > .1^10}, {a, b},
Method -> "NelderMead", MaxIterations -> 10000]
NMaximize[{Log10[f], 100 > a > .1^10, 100 > b > .1^10}, {a, b},
Method -> "DifferentialEvolution", MaxIterations -> 10000]
NMaximize[{Log10[f], 100 > a > .1^10, 100 > b > .1^10}, {a, b},
Method -> "SimulatedAnnealing", MaxIterations -> 10000]
NMaximize[{Log10[f], 100 > a > .1^10, 100 > b > .1^10}, {a, b},
Method -> "RandomSearch", MaxIterations -> 10000]
The wanted result would look something like this : ( header not necessary ) ( Method name not necessary, but I want 4 results for each file. )
filename Method a b
f1 NM 1 4
f1 DE .2 .5
f1 SA .1 .5
f2 DE .2 .3
f2 NM 1 4
f2 DE 3 4
f2 SA .2 .1
f2 DE .5 .6
...
..
.
PLEASE HELP. IS THIS IN ANYWAY POSSIBLE?
EDIT: SampleData
Table[f[n],{n,listOfFileNames}]
$\endgroup$FileNames
. $\endgroup$List
. Oliver's solution builds you a list of functions, equivalent to thef
s in your code, capable of computing the values you want. These functions are then applied to the values you want to compute usingMap
. This is typical of the functional programming style mathematica supports. Does Oliver's solution not provide the values you want, if so, in which way ? As an asideTableForm
is just a formatting command to display a list nicely. $\endgroup$