//callulate the error of a hidden node based on the error of forward connected nodes
        public static double CalcHiddenError(double outA, double[] errorforward, double[] weightforward, NonLinear.nonlinPrime txprime)
        {
            double sum = 0;

            //might be the problem right here
            for (int i = 0; i < errorforward.Length; i++)
            {
                sum += errorforward[i] * weightforward[i];
            }

            return(txprime(outA) * sum);
        }
 //calculated the error of any exposed value or value with a target
 public static double CalcExposedError(double outB, double targetB, NonLinear.nonlinPrime txprime)
 {
     return(txprime(outB) * (targetB - outB));
 }