I'm currently working on a genetic algorithm, and want to convert my "population" into binary from decimal, so I can do crossovers more easily.
I have an array of 70x71 array of numbers (a population of 70; each population member has 71 variables).
Is there a way I can map BaseForm[] onto each element, whilst keeping the array format?
I tried doing this:
population=RandomReal[1,{70,71}];
binaryPopulation = {};
For[i = 1, i <= 70, i++,
For[j = 1, j <= 71, j++,
AppendTo[binaryPopulation, BaseForm[population[[i, j]], 2]]
];
];
But this generates one large array (ie. not separated into 70 different members, it's just one long array).
Any help would be much appreciated!
Thanks




Map[BaseForm[#, 2] &, population, {2}]– Rohit Namjoshi Apr 04 '22 at 13:47