com.graphbuilder.math.func.CoshFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of curvesapi Show documentation
Show all versions of curvesapi Show documentation
Implementation of various mathematical curves that define themselves over a set of control points. The API is written in Java. The curves supported are: Bezier, B-Spline, Cardinal Spline, Catmull-Rom Spline, Lagrange, Natural Cubic Spline, and NURBS.
package com.graphbuilder.math.func;
/**
The hyperbolic cosine function.
*/
public class CoshFunction implements Function {
public CoshFunction() {}
/**
Returns the value of (ex + e-x)/2, where x is the value
at index location 0 and e is the base of natural logarithms.
*/
public double of(double[] d, int numParam) {
return (Math.pow(Math.E, d[0]) + Math.pow(Math.E, -d[0])) / 2;
}
/**
Returns true only for 1 parameter, false otherwise.
*/
public boolean acceptNumParam(int numParam) {
return numParam == 1;
}
public String toString() {
return "cosh(x)";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy