format
This commit is contained in:
parent
edce22050a
commit
4903319073
|
@ -8,8 +8,7 @@ let requiresNamespace = true
|
|||
|
||||
module Combinatorics = {
|
||||
module Helpers = {
|
||||
let laplace = ((successes, trials)) =>
|
||||
(successes +. 1.0) /. (trials +. 2.0)
|
||||
let laplace = ((successes, trials)) => (successes +. 1.0) /. (trials +. 2.0)
|
||||
let factorial = Stdlib.Math.factorial
|
||||
let choose = ((n, k)) => factorial(n) /. (factorial(n -. k) *. factorial(k))
|
||||
let pow = (base, exp) => Js.Math.pow_float(~base, ~exp)
|
||||
|
@ -22,9 +21,7 @@ module Combinatorics = {
|
|||
~requiresNamespace,
|
||||
~output=EvtNumber,
|
||||
~examples=[`Danger.laplace(1, 20)`],
|
||||
~definitions=[
|
||||
DefineFn.Numbers.twoToOne("laplace", laplace),
|
||||
],
|
||||
~definitions=[DefineFn.Numbers.twoToOne("laplace", laplace)],
|
||||
(),
|
||||
)
|
||||
let factorial = Function.make(
|
||||
|
@ -173,7 +170,12 @@ module Integration = {
|
|||
let result = switch inputs {
|
||||
| [_, _, _, IEvNumber(0.0)] =>
|
||||
Error("Integration error 4 in Danger.integrate: Increment can't be 0.")
|
||||
| [IEvLambda(aLambda), IEvNumber(min), IEvNumber(max), IEvNumber(numIntegrationPoints)] =>
|
||||
| [
|
||||
IEvLambda(aLambda),
|
||||
IEvNumber(min),
|
||||
IEvNumber(max),
|
||||
IEvNumber(numIntegrationPoints),
|
||||
] =>
|
||||
Helpers.integrateFunctionBetweenWithNumIntegrationPoints(
|
||||
aLambda,
|
||||
min,
|
||||
|
@ -246,7 +248,6 @@ module Internals = {
|
|||
->Belt.Array.map(FunctionRegistry_Helpers.Wrappers.evNumber)
|
||||
->FunctionRegistry_Helpers.Wrappers.evArray
|
||||
|
||||
|
||||
// Diminishing returns
|
||||
// Helpers
|
||||
type diminishingReturnsAccumulatorInner = {
|
||||
|
@ -359,14 +360,11 @@ module Internals = {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
let library = [
|
||||
Combinatorics.Lib.laplace,
|
||||
Combinatorics.Lib.factorial,
|
||||
Combinatorics.Lib.choose,
|
||||
Combinatorics.Lib.binomial,
|
||||
|
||||
// Diminishing marginal return functions
|
||||
// There are functions diminishingMarginalReturnsForFunctions2 through diminishingMarginalReturnsForFunctions7
|
||||
// Because of this bug: <https://github.com/quantified-uncertainty/squiggle/issues/1090>
|
||||
|
|
Loading…
Reference in New Issue
Block a user