public void When_Solve_Integral_With_SimpsonEstimate() { VariableEntity x = "x"; var function = MathEntity.Sqrt(x); var estimate = new SimpsonEstimate(); var estimation = estimate.Estimate(function, x, 4, 0, 8); Assert.Equal(14.855493563580854, estimation); }
public double ComputeLowerCumulative(double tStat, double degreeOfFreedom) { VariableEntity x = _variableName; VariableEntity v = _degreeOfFreedomName; var betaFunction = new BetaFunction(); var betaResult = betaFunction.Evaluate(0.5, degreeOfFreedom / 2); var firstEntity = MathEntity.Pow(Number.Create(1) + (MathEntity.Pow(x, Number.Create(2)) / v), Number.Create(-1) * ((v + Number.Create(1)) / Number.Create(2))); var secondEntity = MathEntity.Sqrt(v) * Number.Create(betaResult); var result = (firstEntity / secondEntity); result.Assign(v, (NumberEntity)Number.Create(degreeOfFreedom)); var simpsonEstimate = new SimpsonEstimate(); return(simpsonEstimate.Estimate(result, x, _n, _a, tStat)); }
public double ComputeLowerCumulative(double average, double standardDeviation, double value) { VariableEntity µ = _avgVariableName; VariableEntity σ = _standardDeviationVariableName; VariableEntity x = _variableName; var exponent = Number.Create(-0.5) * MathEntity.Pow((x - µ) / σ, Number.Create(2)); var integralEquation = MathEntity.Pow(Number.Create(System.Math.E), exponent); integralEquation.Assign(µ, new NumberEntity(Number.Create(average))); integralEquation.Assign(σ, new NumberEntity(Number.Create(standardDeviation))); var estimate = new SimpsonEstimate(); var estimation = estimate.Estimate(integralEquation, x, _n, _a, value); var equation = (Number.Create(1) / (σ * MathEntity.Sqrt(Number.Create(2) * Number.Create(System.Math.PI)))) * Number.Create(estimation); equation.Assign(σ, new NumberEntity(Number.Create(standardDeviation))); return((equation.Eval() as NumberEntity).Number.Value); }