'use strict';

// MODULES //

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


// MAIN //

/**
* Returns a function for evaluating the moment-generating function (MGF) of a degenerate distribution centered at a provided mean value.
*
* @param {number} mu - value at which to center the distribution
* @returns {Function} MGF
*
* @example
* var mgf = factory( 2.0 );
* var y = mgf( 0.0 );
* // returns 1.0
* y = mgf( 2.0 );
* // returns ~54.598
*/
function factory( mu ) {
	if ( isnan( mu ) ) {
		return nan;
	}
	/**
	* Evaluates the moment-generating function (MGF) of a degenerate distribution.
	*
	* @private
	* @param {number} t - input value
	* @returns {number} evaluated MGF
	*
	* @example
	* var y = mgf( 10.0 );
	* // returns <number>
	*/
	return function mgf( t ) {
		if ( isnan( t ) ) {
			return NaN;
		}
		return exp( mu * t );
	}; // end FUNCTION mgf()
} // end FUNCTION factory()


// EXPORTS //

module.exports = factory;

'use strict';

// MODULES //

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


// MAIN //

/**
* Returns a function for evaluating the moment-generating function (MGF) of a degenerate distribution centered at a provided mean value.
*
* @param {number} mu - value at which to center the distribution
* @returns {Function} MGF
*
* @example
* var mgf = factory( 2.0 );
* var y = mgf( 0.0 );
* // returns 1.0
*
* y = mgf( 2.0 );
* // returns ~54.598
*/
function factory( mu ) {
	if ( isnan( mu ) ) {
		return nan;
	}
	/**
	* Evaluates the moment-generating function (MGF) of a degenerate distribution.
	*
	* @private
	* @param {number} t - input value
	* @returns {number} evaluated MGF
	*
	* @example
	* var y = mgf( 10.0 );
	* // returns <number>
	*/
	return function mgf( t ) {
		if ( isnan( t ) ) {
			return NaN;
		}
		return exp( mu * t );
	}; // end FUNCTION mgf()
} // end FUNCTION factory()


// EXPORTS //

module.exports = factory;

Add blank line as a separator
Add blank line as a separator
