double[,] mysine = new double[0, NumPoints];
should be
double[,] mysine = new double[1, NumPoints];
The numbers between the brackets define the size of your array and not the maximumindex.
So when using 0, you're actually defining an unusable array.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…