Example usage for org.apache.commons.math4.util FastMath tan

List of usage examples for org.apache.commons.math4.util FastMath tan

Introduction

In this page you can find the example usage for org.apache.commons.math4.util FastMath tan.

Prototype

public static double tan(double x) 

Source Link

Document

Tangent function.

Usage

From source file:com.ericbarnhill.arrayMath.ArrayMath.java

/**
  * In-place element-wise {@code tan} of a {@code double[]}. Returns reference to first passed array.
  *//from   w ww  .ja v a2  s .  c  o m
  * @param f {@code double[]} array.
  * @return  {@code double[]} array.
  * 
  * @since 0.1
  */
public static double[] tan(double[] f) {
    final int fi = f.length;
    for (int i = 0; i < fi; i++) {
        f[i] = FastMath.tan(f[i]);
    }
    return f;
}

From source file:com.ericbarnhill.arrayMath.ArrayMath.java

/**
  * Element-wise {@code tan} of a {@code double[]}. Returns deep copy.
  *//from w  w w . ja va  2  s  .c  o  m
  * @param f {@code double[]} array.
  * @return  {@code double[]} array.
  * 
  * @since 0.1
  */
public static double[] tanC(double[] f) {
    final int fi = f.length;
    double[] h = new double[fi];
    for (int i = 0; i < fi; i++) {
        h[i] = FastMath.tan(f[i]);
    }
    return h;
}