Package io.bhagat.math.calculus
Class Calculus
- java.lang.Object
-
- io.bhagat.math.calculus.Calculus
-
public class Calculus extends java.lang.ObjectA class containing many of the calculus operations- Author:
- Bhagat
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_DXDefault infinitely small numberstatic intDEFAULT_NUMBER_OF_ITERATIONSDefault number of iterations for integrals
-
Constructor Summary
Constructors Constructor Description Calculus()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleaverageValue(Function<java.lang.Double,java.lang.Double> function, double lowerBound, double upperBound)finds the average value of a function in an interval using the mean value theorem for integralsstatic doubleaverageValue(Function<java.lang.Double,java.lang.Double> function, Interval interval)finds the average value of a function in an interval using the mean value theorem for integralsstatic Function<java.lang.Double,java.lang.Double>derivative(Function<java.lang.Double,java.lang.Double> function)Takes the derivative of a function using a default dxstatic Function<java.lang.Double,java.lang.Double>derivative(Function<java.lang.Double,java.lang.Double> function, double limitNumber)Takes the derivative of a double function using a non default dxstatic Function<java.lang.Float,java.lang.Float>derivative(Function<java.lang.Float,java.lang.Float> function, float limitNumber)Takes the derivative of a float function using a non default dxstatic Function<java.lang.Double,java.lang.Double>higherOrderDerivative(Function<java.lang.Double,java.lang.Double> function, int order)takes multiple derivatives on a double functionstatic Function<java.lang.Double[],java.lang.Double>integral(Function<java.lang.Double,java.lang.Double> function)takes the integral on a functionstatic Function<java.lang.Double[],java.lang.Double>integral(Function<java.lang.Double,java.lang.Double> function, int n)takes the integral on a functionstatic Function<Interval,java.lang.Double>integralWithInterval(Function<java.lang.Double,java.lang.Double> function)takes the integral on a functionstatic Function<Interval,java.lang.Double>integralWithInterval(Function<java.lang.Double,java.lang.Double> function, int n)takes the integral on a function
-
-
-
Field Detail
-
DEFAULT_NUMBER_OF_ITERATIONS
public static final int DEFAULT_NUMBER_OF_ITERATIONS
Default number of iterations for integrals- See Also:
- Constant Field Values
-
DEFAULT_DX
public static final double DEFAULT_DX
Default infinitely small number- See Also:
- Constant Field Values
-
-
Method Detail
-
derivative
public static Function<java.lang.Double,java.lang.Double> derivative(Function<java.lang.Double,java.lang.Double> function, double limitNumber)
Takes the derivative of a double function using a non default dx- Parameters:
function- the functionlimitNumber- the dx- Returns:
- a function for the derivative of the input function
-
derivative
public static Function<java.lang.Float,java.lang.Float> derivative(Function<java.lang.Float,java.lang.Float> function, float limitNumber)
Takes the derivative of a float function using a non default dx- Parameters:
function- the functionlimitNumber- the dx- Returns:
- a function for the derivative of the input function
-
derivative
public static Function<java.lang.Double,java.lang.Double> derivative(Function<java.lang.Double,java.lang.Double> function)
Takes the derivative of a function using a default dx- Parameters:
function- the function- Returns:
- a function for the derivative of the input function
-
higherOrderDerivative
public static Function<java.lang.Double,java.lang.Double> higherOrderDerivative(Function<java.lang.Double,java.lang.Double> function, int order)
takes multiple derivatives on a double function- Parameters:
function- the functionorder- the order of the derivative you want to take- Returns:
- the function after multiple derivatives
-
integral
public static Function<java.lang.Double[],java.lang.Double> integral(Function<java.lang.Double,java.lang.Double> function, int n)
takes the integral on a function- Parameters:
function- the function to take the integral ofn- the number of iterations- Returns:
- a function for the definite integral
-
integralWithInterval
public static Function<Interval,java.lang.Double> integralWithInterval(Function<java.lang.Double,java.lang.Double> function, int n)
takes the integral on a function- Parameters:
function- the function to take the integral ofn- the number of iterations- Returns:
- a function for the definite integral
-
averageValue
public static double averageValue(Function<java.lang.Double,java.lang.Double> function, Interval interval)
finds the average value of a function in an interval using the mean value theorem for integrals- Parameters:
function- the functioninterval- the interval- Returns:
- the mean value
-
averageValue
public static double averageValue(Function<java.lang.Double,java.lang.Double> function, double lowerBound, double upperBound)
finds the average value of a function in an interval using the mean value theorem for integrals- Parameters:
function- the functionlowerBound- the lower bound of the intervalupperBound- the upper bound of the interval- Returns:
- the mean value
-
integral
public static Function<java.lang.Double[],java.lang.Double> integral(Function<java.lang.Double,java.lang.Double> function)
takes the integral on a function- Parameters:
function- the function to integrate- Returns:
- a function for the definite integral
-
-