I know there are lots of external packages on linear algebra but my question is really when do I use f# and when c#? I make a simple example and while I did this I realized maybe it is too simple. but lets say I want to do element by element division of two arrays:
Imperative c#:
static double[] elementdivideimp (double[] arr1, double[] arr2)
{
var res = new double[arr1.Length];
for (int i = 0; i < arr1.Length; i++)
{
res[i] = arr2[i]/arr1[i];
}
return res;
}
LINQ c#:
static double[] elementdivideL(double[] arr1, double[] arr2)
{
return arr1.Zip(arr2, (a, b) => b/a).ToArray();
}
f#:
let elementdividefunc a b = Array.map2 (fun i j -> (j / i)) a b
As said maybe this is too simple but I m really struggling to decide which language to go for when I face a programming challenge. SO when do I use which?