-
-
Notifications
You must be signed in to change notification settings - Fork 836
refactor: update stats/base/dists/triangular/mgf
implementation and test tolerances
#4768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
51e7260
f4234cc
078ba22
263cdaf
004d18c
ff1d644
aca10b4
01ce172
d47eda3
7267f00
8f01ad8
0937887
2d4f12d
659542c
d36338c
63bc5ad
874afd7
0e26b69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2025 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// MODULES // | ||
|
||
var expm1 = require( '@stdlib/math/base/special/expm1' ); | ||
|
||
|
||
// MAIN // | ||
|
||
/** | ||
* Helper function for repeated computation in the MGF formula. | ||
* | ||
* @private | ||
* @param {number} x - input value | ||
* @returns {number} evaluated result | ||
*/ | ||
function phi2( x ) { | ||
if ( x === 0.0 ) { | ||
return 1.0; | ||
} | ||
return ( 2.0 * ( expm1( x ) - x ) ) / ( x*x ); | ||
} | ||
|
||
|
||
// EXPORTS // | ||
|
||
module.exports = phi2; |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.