tweak: format
This commit is contained in:
parent
e1760dab2d
commit
bfc3b39b2b
|
@ -55,7 +55,6 @@ module Internals = {
|
||||||
|
|
||||||
// Integral helper functions
|
// Integral helper functions
|
||||||
|
|
||||||
|
|
||||||
let castFloatToInternalNumber = x => ReducerInterface_InternalExpressionValue.IEvNumber(x)
|
let castFloatToInternalNumber = x => ReducerInterface_InternalExpressionValue.IEvNumber(x)
|
||||||
let castArrayOfFloatsToInternalArrayOfInternals = xs => ReducerInterface_InternalExpressionValue.IEvArray(
|
let castArrayOfFloatsToInternalArrayOfInternals = xs => ReducerInterface_InternalExpressionValue.IEvArray(
|
||||||
Belt.Array.map(xs, x => castFloatToInternalNumber(x)),
|
Belt.Array.map(xs, x => castFloatToInternalNumber(x)),
|
||||||
|
@ -79,7 +78,7 @@ module Internals = {
|
||||||
// reason for existence: might be an useful template to have for calculating diminishing marginal returns later on
|
// reason for existence: might be an useful template to have for calculating diminishing marginal returns later on
|
||||||
applyFunctionAtPoint(aLambda, castFloatToInternalNumber(point), environment, reducer)
|
applyFunctionAtPoint(aLambda, castFloatToInternalNumber(point), environment, reducer)
|
||||||
// integrate function itself
|
// integrate function itself
|
||||||
*/
|
*/
|
||||||
let integrateFunctionBetweenWithNumIntegrationPoints = (
|
let integrateFunctionBetweenWithNumIntegrationPoints = (
|
||||||
aLambda,
|
aLambda,
|
||||||
min: float,
|
min: float,
|
||||||
|
@ -323,7 +322,7 @@ module Internals = {
|
||||||
let increment = funds /. numDivisions
|
let increment = funds /. numDivisions
|
||||||
let arrayOfIncrements = Belt.Array.makeBy(numDivisionsInt, _ => increment)
|
let arrayOfIncrements = Belt.Array.makeBy(numDivisionsInt, _ => increment)
|
||||||
let numLambdas = E.A.length(lambdas)
|
let numLambdas = E.A.length(lambdas)
|
||||||
|
|
||||||
let initAccumulator: diminishingReturnsAccumulator = Ok({
|
let initAccumulator: diminishingReturnsAccumulator = Ok({
|
||||||
optimalAllocations: Belt.Array.makeBy(numLambdas, _ => 0.0),
|
optimalAllocations: Belt.Array.makeBy(numLambdas, _ => 0.0),
|
||||||
currentMarginalReturns: E.A.fmap(
|
currentMarginalReturns: E.A.fmap(
|
||||||
|
@ -331,7 +330,7 @@ module Internals = {
|
||||||
lambdas,
|
lambdas,
|
||||||
)->E.A.R.firstErrorOrOpen,
|
)->E.A.R.firstErrorOrOpen,
|
||||||
})
|
})
|
||||||
|
|
||||||
let optimalAllocationEndAccumulator = E.A.reduce(arrayOfIncrements, initAccumulator, (
|
let optimalAllocationEndAccumulator = E.A.reduce(arrayOfIncrements, initAccumulator, (
|
||||||
acc,
|
acc,
|
||||||
newIncrement,
|
newIncrement,
|
||||||
|
@ -377,7 +376,7 @@ module Internals = {
|
||||||
| Ok(inner) => Ok(castArrayOfFloatsToInternalArrayOfInternals(inner.optimalAllocations))
|
| Ok(inner) => Ok(castArrayOfFloatsToInternalArrayOfInternals(inner.optimalAllocations))
|
||||||
| Error(b) => Error(b)
|
| Error(b) => Error(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
optimalAllocationResult
|
optimalAllocationResult
|
||||||
// let result = [0.0, 0.0]->castArrayOfFloatsToInternalArrayOfInternals->Ok
|
// let result = [0.0, 0.0]->castArrayOfFloatsToInternalArrayOfInternals->Ok
|
||||||
// result
|
// result
|
||||||
|
@ -477,7 +476,7 @@ let library = [
|
||||||
],
|
],
|
||||||
(),
|
(),
|
||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
// Integral in terms of function, min, max, num points
|
// Integral in terms of function, min, max, num points
|
||||||
// Note that execution time will be more predictable, because it
|
// Note that execution time will be more predictable, because it
|
||||||
// will only depend on num points and the complexity of the function
|
// will only depend on num points and the complexity of the function
|
||||||
|
|
Loading…
Reference in New Issue
Block a user