Class Calculatte
- Version:
- 0.2.0
- Author:
- Matthew Okashita, Joseph Benigno
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static double
Represents how far the x-value should be offset left and right to find the left and right derivatives.static double
Represents the largest difference between the left and right derivative before the derivative does not exist.static int
Represents common known cross-sections types.static double
Represents accuracy value for derivation calculations.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static int
Represents common known cross-sections types.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static double
Represents how far the x-value should be offset left and right to find the left and right limits.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static double
Represents the largest difference between the left and right limit before the limit does not exist.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static int
Represents accuracy value for integration calculations.static double
All values less than tonegativeInfinity
will be rounded down toDouble.NEGATIVE_INFINITY
byCalculatte.round()
.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static double
All values greater thanpositiveInfinity
will be rounded up toDouble.POSITIVE_INFINITY
byCalculatte.round()
.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static int
Represents common known cross-sections types.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too.static int
Represents common known cross-sections types.static int
Represents common known cross-sections types.static int
Represents how many decimal places this variable's respective calculation(s) should be rounded too. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
crossSection(double a, double b, Function integrand)
Finds the volume of a known cross-section for a custom made cross-section formula.double
crossSection(double a, double b, Function functionTop, Function functionBottom, int type)
Finds the volume of a known cross-section for any of the 5 common known cross-sections: square, equilateral triangle, isosceles triangle, right, triangle, and semicircle.double
Finds the derivate of the function at point, x.double
Integrates the function from a to b using Simpson's rule.double
leftDerivative(double x, Function function)
Finds the left derivate of the function at point, x.double
Finds the left limit offunction
at pointx
.double
leftRiemannSum(double a, double b, Function function, int n)
Finds the approximate area under the curve using the left Riemann sum rule withn
rectangles.double
Finds the limit offunction
at pointx
.double
midpointRule(double a, double b, Function function, int n)
Finds the approximate area under the curve using the midpoint rule withn
rectangles.double
Finds the area bounded by a polar function,r
of theta, between two radian measures.double
Finds the volume of revolution for the region bounded byfunctionTop
,functionBottom
, x =a
, and x =b
, about y =axis
.double
rightDerivative(double x, Function function)
Finds the right derivate of the function at point, x.double
rightLimit(double x, Function function)
Finds the right limit offunction
at pointx
.double
rightRiemannSum(double a, double b, Function function, int n)
Finds the approximate area under the curve using the right Riemann sum rule withn
rectangles.double
round(double x, int decimalPlaces)
Rounds doubles according to the IEEE 754 standard of rounding half to even.tangentLine(double x, Function function)
Finds the tangent line offunction
at point,x
.double
trapezoidalSum(double a, double b, Function function, int n)
Finds the approximate area under the curve using the trapezoidal sum rule withn
trapezoids.
-
Field Details
-
integrationRoundingDecimalPlaces
public static int integrationRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
derivationRoundingDecimalPlaces
public static int derivationRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
leftRiemannSumRoundingDecimalPlaces
public static int leftRiemannSumRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
rightRiemannSumRoundingDecimalPlaces
public static int rightRiemannSumRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
midpointRuleRoundingDecimalPlaces
public static int midpointRuleRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
trapezoidalSumRoundingDecimalPlaces
public static int trapezoidalSumRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
revolutionRoundingDecimalPlaces
public static int revolutionRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
crossSectionsRoundingDecimalPlaces
public static int crossSectionsRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
limitRoundingDecimalPlaces
public static int limitRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
leftLimitRoundingDecimalPlaces
public static int leftLimitRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
rightLimitRoundingDecimalPlaces
public static int rightLimitRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
polarAreaRoundingDecimalPlaces
public static int polarAreaRoundingDecimalPlacesRepresents how many decimal places this variable's respective calculation(s) should be rounded too. Only values returned by a method are rounded. Intermediate values within a method are never rounded, unless by another method; e.g., therevolve()
method's calculations get rounded when the integral is taken withintegrate()
and once more when the final value is returned.Note: Setting any of these values to -1 will prevent that group of calculations from being rounded. This can be useful if you would prefer to use your own rounding method or none at all.
-
positiveInfinity
public static double positiveInfinityAll values greater than
positiveInfinity
will be rounded up toDouble.POSITIVE_INFINITY
byCalculatte.round()
.Note: Setting
positiveInfinity
toDouble.MAX_VALUE
will prevent rounding values up toDouble.POSITIVE_INFINITY
.- See Also:
round(double, int)
-
negativeInfinity
public static double negativeInfinityAll values less than to
negativeInfinity
will be rounded down toDouble.NEGATIVE_INFINITY
byCalculatte.round()
.Note: Setting
negativeInfinity
toDouble.MIN_VALUE
will prevent rounding values down toDouble.NEGATIVE_INFINITY
.- See Also:
round(double, int)
-
n
public static int nRepresents accuracy value for integration calculations. The larger the more accurate.- See Also:
integrate(double, double, Function)
-
h
public static double hRepresents accuracy value for derivation calculations. The smaller the more accurate.- See Also:
derivate(double, Function)
-
derivativeTolerance
public static double derivativeToleranceRepresents the largest difference between the left and right derivative before the derivative does not exist.- See Also:
derivate(double, Function)
-
derivativeOffset
public static double derivativeOffsetRepresents how far the x-value should be offset left and right to find the left and right derivatives. -
limitTolerance
public static double limitToleranceRepresents the largest difference between the left and right limit before the limit does not exist.- See Also:
limit(double, Function)
-
limitOffset
public static double limitOffsetRepresents how far the x-value should be offset left and right to find the left and right limits. -
SQUARE
public static final int SQUARERepresents common known cross-sections types. -
EQUILATERAL_TRIANGLE
public static final int EQUILATERAL_TRIANGLERepresents common known cross-sections types. -
ISOSCELES_TRIANGLE
public static final int ISOSCELES_TRIANGLERepresents common known cross-sections types. -
RIGHT_TRIANGLE
public static final int RIGHT_TRIANGLERepresents common known cross-sections types. -
SEMICIRCLE
public static final int SEMICIRCLERepresents common known cross-sections types.
-
-
Constructor Details
-
Calculatte
public Calculatte()
-
-
Method Details
-
round
public double round(double x, int decimalPlaces)Rounds doubles according to the IEEE 754 standard of rounding half to even.Note: If
decimalPlaces
is set to-1
,x
will not be rounded.- Parameters:
x
- The value to be rounded.decimalPlaces
- The number of decimal places to round to.- Returns:
- The rounded value.
-
integrate
Integrates the function from a to b using Simpson's rule.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.function
- The function to integrate.- Returns:
- The area under the curve from a to b.
-
derivate
Finds the derivate of the function at point, x.- Parameters:
x
- The point on the function to find the derivative.function
- The function to find the derivative of.- Returns:
- The derivative of the function at point, x or
Double.Nan
if the derivative DNE.
-
leftDerivative
Finds the left derivate of the function at point, x.- Parameters:
x
- The point on the function to find the derivative.function
- The function to find the derivative of.- Returns:
- The derivative of the function at point, x.
-
rightDerivative
Finds the right derivate of the function at point, x.- Parameters:
x
- The point on the function to find the derivative.function
- The function to find the derivative of.- Returns:
- The derivative of the function at point, x.
-
tangentLine
Finds the tangent line offunction
at point,x
.- Parameters:
x
- The x-value at which to find the tangent line of.function
- The function to find the tangent line of.- Returns:
- The tangent line.
-
leftRiemannSum
Finds the approximate area under the curve using the left Riemann sum rule withn
rectangles.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.function
- The function being used to calculate the left Riemann sum.n
- The number of rectangles being used to estimate the area under the curve.- Returns:
- The approximate area under the curve by the left Riemann sum rule.
-
rightRiemannSum
Finds the approximate area under the curve using the right Riemann sum rule withn
rectangles.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.function
- The function being used to calculate the right Riemann sum.n
- The number of rectangles being used to estimate the area under the curve.- Returns:
- The approximate area under the curve by the right Riemann sum rule.
-
midpointRule
Finds the approximate area under the curve using the midpoint rule withn
rectangles.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.function
- The function being used to calculate the midpoint rule.n
- The number of rectangles being used to estimate the area under the curve.- Returns:
- The approximate area under the curve by the midpoint rule.
-
trapezoidalSum
Finds the approximate area under the curve using the trapezoidal sum rule withn
trapezoids.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.function
- The function being used to calculate the trapezoidal sum.n
- The number of trapezoids being used to estimate the area under the curve.- Returns:
- The approximate area under the curve by the trapezoidal sum rule.
-
revolve
public double revolve(double a, double b, double axis, Function functionTop, Function functionBottom)Finds the volume of revolution for the region bounded byfunctionTop
,functionBottom
, x =a
, and x =b
, about y =axis
.Note: Vertical revolutions can also be made with this function. Input your data as if the data was rotated 90 degrees and to be rotated horizontally. There should be no mathematical difference between the two problems.
- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.axis
- The y value of the axis of rotation, where 0 is about the x-axis.functionTop
- The top function defining the bounded region.functionBottom
- The bottom function defining the bounded region.- Returns:
- The volume of revolution.
-
crossSection
public double crossSection(double a, double b, Function functionTop, Function functionBottom, int type)Finds the volume of a known cross-section for any of the 5 common known cross-sections: square, equilateral triangle, isosceles triangle, right, triangle, and semicircle.Note: Constants have been defined in
Calculatte
for your ease of use when defining whattype
of cross-section you are solving for.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.functionTop
- The top function defining the bounded region.functionBottom
- The bottom function defining the bounded region.type
- The type of cross-section.- Returns:
- The volume of the known cross-section.
- See Also:
SQUARE
,EQUILATERAL_TRIANGLE
,ISOSCELES_TRIANGLE
,RIGHT_TRIANGLE
,SEMICIRCLE
-
crossSection
Finds the volume of a known cross-section for a custom made cross-section formula.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.integrand
- The integrand of the integral when taking the volume of a known cross-section.- Returns:
- The volume of the known cross-section.
- See Also:
crossSection(double, double, Function, Function, int)
-
limit
Finds the limit offunction
at pointx
. ReturnsDouble.NaN
if the limit does not exist.- Parameters:
x
- The x-value to find the limit at.function
- The function to find the limit of.- Returns:
- The value of the limit or
Double.Nan
if the limit DNE.
-
leftLimit
Finds the left limit offunction
at pointx
.- Parameters:
x
- The x-value to find the limit at.function
- The function to find the limit of.- Returns:
- The value of the left limit.
-
rightLimit
Finds the right limit offunction
at pointx
.- Parameters:
x
- The x-value to find the limit at.function
- The function to find the limit of.- Returns:
- The value of the right limit.
-
polarArea
Finds the area bounded by a polar function,r
of theta, between two radian measures.- Parameters:
a
- The lower limit of integration.b
- The upper limit of integration.r
- The polar function of theta bounding a specified area.- Returns:
- The area of the bounded region.
-