/// <summary> /// calculates the density of electrons in the conduction band for a given chemical potential /// </summary> double Perform_Integral(Func <double, double> function, double lower_limit, double upper_limit) { if (chem_pot != double.MaxValue) { throw new Exception("Error - Something isn't reseting the chemical potential... this is very unsafe"); } chem_pot = mu; // integrates the density for a given energy up to a given number of kB * T above the conduction band edge OneVariableFunction integrand = new OneVariableFunction(function); GaussKronrodIntegrator tmp = new GaussKronrodIntegrator(); double result = tmp.Integrate(integrand, lower_limit, upper_limit); // reset chem_pot chem_pot = double.MaxValue; return(result); }
/// <summary> /// calculates the density of electrons in the conduction band for a given chemical potential /// </summary> double Perform_Integral(Func<double, double> function, double lower_limit, double upper_limit) { if (chem_pot != double.MaxValue) throw new Exception("Error - Something isn't reseting the chemical potential... this is very unsafe"); chem_pot = mu; // integrates the density for a given energy up to a given number of kB * T above the conduction band edge OneVariableFunction integrand = new OneVariableFunction(function); GaussKronrodIntegrator tmp = new GaussKronrodIntegrator(); double result = tmp.Integrate(integrand, lower_limit, upper_limit); // reset chem_pot chem_pot = double.MaxValue; return result; }