<commit_before>'use strict';

// MODULES //

var isnan = require( '@stdlib/math/base/utils/is-nan' );
var pow = require( '@stdlib/math/base/special/pow' );
var nan = require( './nan.js' );


// MAIN //

/**
* Returns a function for evaluating the moment-generating function (MGF) of a chi-squared distribution with degrees of freedom `k`.
*
* @param {NonNegativeNumber} k - degrees of freedom
* @returns {Function} MGF
*
* @example
* var mgf = factory( 1.0 );
*
* var y = mgf( 0.2 );
* // returns ~1.291
*
* y = mgf( 0.4 );
* // returns ~2.236
*/
function factory( k ) {
	if ( isnan( k ) || k < 0.0 ) {
		return nan;
	}
	return mgf;

	/**
	* Evaluates the moment-generating function (MGF) for a chi-squared distribution.
	*
	* @private
	* @param {number} t - input value
	* @returns {number} evaluated MGF
	*
	* @example
	* var y = mgf( 0.5 );
	* // returns <number>
	*/
	function mgf( t ) {
		if ( isnan( t ) || t >= 0.5 ) {
			return NaN;
		}
		return pow( 1 - (2*t), -k/2 );
	} // end FUNCTION mgf()
} // end FUNCTION factory()


// EXPORTS //

module.exports = factory;<commit_msg>Adjust spacing<commit_after>'use strict';

// MODULES //

var isnan = require( '@stdlib/math/base/utils/is-nan' );
var pow = require( '@stdlib/math/base/special/pow' );
var nan = require( './nan.js' );


// MAIN //

/**
* Returns a function for evaluating the moment-generating function (MGF) of a chi-squared distribution with degrees of freedom `k`.
*
* @param {NonNegativeNumber} k - degrees of freedom
* @returns {Function} MGF
*
* @example
* var mgf = factory( 1.0 );
*
* var y = mgf( 0.2 );
* // returns ~1.291
*
* y = mgf( 0.4 );
* // returns ~2.236
*/
function factory( k ) {
	if ( isnan( k ) || k < 0.0 ) {
		return nan;
	}
	return mgf;

	/**
	* Evaluates the moment-generating function (MGF) for a chi-squared distribution.
	*
	* @private
	* @param {number} t - input value
	* @returns {number} evaluated MGF
	*
	* @example
	* var y = mgf( 0.5 );
	* // returns <number>
	*/
	function mgf( t ) {
		if ( isnan( t ) || t >= 0.5 ) {
			return NaN;
		}
		return pow( 1-(2*t), -k/2 );
	} // end FUNCTION mgf()
} // end FUNCTION factory()


// EXPORTS //

module.exports = factory;
{'fraction_non_alphanumeric': 0.18072844628861226, 'fraction_numerical': 0.02120792992162287, 'mean_word_length': 2.7413793103448274, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5396686', 'n_tokens_mistral': 872, 'n_tokens_neox': 813, 'n_words': 241}