本文整理匯總了Java中org.apache.commons.math3.util.FastMath.tan方法的典型用法代碼示例。如果您正苦於以下問題:Java FastMath.tan方法的具體用法?Java FastMath.tan怎麽用?Java FastMath.tan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.math3.util.FastMath
的用法示例。
在下文中一共展示了FastMath.tan方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getIncidence
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
* Calculate the incidence angle
*/
public double getIncidence(int position) {
double incidenceangle = 0.0;
try{
// estimation of incidence angle based on near and range distance values
double nearincidence = FastMath.toRadians(getIncidenceNear().doubleValue());
double sataltitude=getSatelliteAltitude();
double distancerange = sataltitude * FastMath.tan(nearincidence) + position * this.getPixelsize()[0];
incidenceangle = FastMath.atan(distancerange / sataltitude);
}catch(Exception e){
logger.warn("Error calculatiing incidence angle:"+e.getMessage());
}
return incidenceangle;
}
示例2: earthRadiusFromLatitude
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
*
* @param latitude
* @param ellipseMin
* @param ellipseMaj
* @return calculate the heart radius for a latitude
*/
public static double earthRadiusFromLatitude(double latitude, double ellipseMin,double ellipseMaj ){
double tan=FastMath.tan(latitude*FastMath.PI/180);
double ellipseRapp=(ellipseMin/ellipseMaj)*(ellipseMin/ellipseMaj);
double d=tan*tan;//FastMath.pow(FastMath.tan(latitude*FastMath.PI/180),2);
double reEarth=ellipseMin*FastMath.sqrt((1+d)/((ellipseRapp*ellipseRapp)+d));
return reEarth;
}
示例3: inverseCumulativeProbability
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*
* Returns {@code Double.NEGATIVE_INFINITY} when {@code p == 0}
* and {@code Double.POSITIVE_INFINITY} when {@code p == 1}.
*/
@Override
public double inverseCumulativeProbability(double p) throws OutOfRangeException {
double ret;
if (p < 0 || p > 1) {
throw new OutOfRangeException(p, 0, 1);
} else if (p == 0) {
ret = Double.NEGATIVE_INFINITY;
} else if (p == 1) {
ret = Double.POSITIVE_INFINITY;
} else {
ret = median + scale * FastMath.tan(FastMath.PI * (p - .5));
}
return ret;
}
示例4: StableRandomGenerator
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
* Create a new generator.
*
* @param generator underlying random generator to use
* @param alpha Stability parameter. Must be in range (0, 2]
* @param beta Skewness parameter. Must be in range [-1, 1]
* @throws NullArgumentException if generator is null
* @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2}
* or {@code beta < -1} or {@code beta > 1}
*/
public StableRandomGenerator(final RandomGenerator generator,
final double alpha, final double beta)
throws NullArgumentException, OutOfRangeException {
if (generator == null) {
throw new NullArgumentException();
}
if (!(alpha > 0d && alpha <= 2d)) {
throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
alpha, 0, 2);
}
if (!(beta >= -1d && beta <= 1d)) {
throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
beta, -1, 1);
}
this.generator = generator;
this.alpha = alpha;
this.beta = beta;
if (alpha < 2d && beta != 0d) {
zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
} else {
zeta = 0d;
}
}
示例5: derivative
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public UnivariateFunction derivative() {
return new UnivariateFunction() {
/** {@inheritDoc} */
public double value(double x) {
final double tanX = FastMath.tan(x);
return 1 + tanX * tanX;
}
};
}
示例6: value
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public double value(double x) {
return FastMath.tan(x);
}
示例7: tan
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** {@inheritDoc} */
public SparseGradient tan() {
final double t = FastMath.tan(value);
return new SparseGradient(t, 1 + t * t, derivatives);
}
示例8: tan
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/** Compute tangent of a derivative structure.
* @param operand array holding the operand
* @param operandOffset offset of the operand in its array
* @param result array where result must be stored (for
* tangent the result array <em>cannot</em> be the input
* array)
* @param resultOffset offset of the result in its array
*/
public void tan(final double[] operand, final int operandOffset,
final double[] result, final int resultOffset) {
// create the function value and derivatives
final double[] function = new double[1 + order];
final double t = FastMath.tan(operand[operandOffset]);
function[0] = t;
if (order > 0) {
// the nth order derivative of tan has the form:
// dn(tan(x)/dxn = P_n(tan(x))
// where P_n(t) is a degree n+1 polynomial with same parity as n+1
// P_0(t) = t, P_1(t) = 1 + t^2, P_2(t) = 2 t (1 + t^2) ...
// the general recurrence relation for P_n is:
// P_n(x) = (1+t^2) P_(n-1)'(t)
// as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
final double[] p = new double[order + 2];
p[1] = 1;
final double t2 = t * t;
for (int n = 1; n <= order; ++n) {
// update and evaluate polynomial P_n(t)
double v = 0;
p[n + 1] = n * p[n];
for (int k = n + 1; k >= 0; k -= 2) {
v = v * t2 + p[k];
if (k > 2) {
p[k - 2] = (k - 1) * p[k - 1] + (k - 3) * p[k - 3];
} else if (k == 2) {
p[0] = p[1];
}
}
if ((n & 0x1) == 0) {
v *= t;
}
function[n] = v;
}
}
// apply function composition
compose(operand, operandOffset, function, result, resultOffset);
}
示例9: nextNormalizedDouble
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
* Generate a random scalar with zero location and unit scale.
*
* @return a random scalar with zero location and unit scale
*/
public double nextNormalizedDouble() {
// we need 2 uniform random numbers to calculate omega and phi
double omega = -FastMath.log(generator.nextDouble());
double phi = FastMath.PI * (generator.nextDouble() - 0.5);
// Normal distribution case (Box-Muller algorithm)
if (alpha == 2d) {
return FastMath.sqrt(2d * omega) * FastMath.sin(phi);
}
double x;
// when beta = 0, zeta is zero as well
// Thus we can exclude it from the formula
if (beta == 0d) {
// Cauchy distribution case
if (alpha == 1d) {
x = FastMath.tan(phi);
} else {
x = FastMath.pow(omega * FastMath.cos((1 - alpha) * phi),
1d / alpha - 1d) *
FastMath.sin(alpha * phi) /
FastMath.pow(FastMath.cos(phi), 1d / alpha);
}
} else {
// Generic stable distribution
double cosPhi = FastMath.cos(phi);
// to avoid rounding errors around alpha = 1
if (FastMath.abs(alpha - 1d) > 1e-8) {
double alphaPhi = alpha * phi;
double invAlphaPhi = phi - alphaPhi;
x = (FastMath.sin(alphaPhi) + zeta * FastMath.cos(alphaPhi)) / cosPhi *
(FastMath.cos(invAlphaPhi) + zeta * FastMath.sin(invAlphaPhi)) /
FastMath.pow(omega * cosPhi, (1 - alpha) / alpha);
} else {
double betaPhi = FastMath.PI / 2 + beta * phi;
x = 2d / FastMath.PI * (betaPhi * FastMath.tan(phi) - beta *
FastMath.log(FastMath.PI / 2d * omega * cosPhi / betaPhi));
if (alpha != 1d) {
x += beta * FastMath.tan(FastMath.PI * alpha / 2);
}
}
}
return x;
}
示例10: gcpGrdGeoCorrectionMeters
import org.apache.commons.math3.util.FastMath; //導入方法依賴的package包/類
/**
*
* @param incidenceAngle
* @param dheight geoid height-geodeticTerrainHeight
* @param gcp
* @return horizontal shift
*/
public static double gcpGrdGeoCorrectionMeters(double incidenceAngle,double height,double geoidHeight){
double dx=(height-geoidHeight)/FastMath.tan(incidenceAngle);
return dx;
}