code: public static ComplexNumber Tan(ComplexNumber z1) {
          ComplexNumber result = new ComplexNumber();
  
          if (z1.imaginary == 0.0) {
              result.real = Math.tan(z1.real);
              result.imaginary = 0.0;
          } else {
              double real2 = 2 * z1.real;
              double imag2 = 2 * z1.imaginary;
              double denom = Math.cos(real2) + Math.cosh(real2);
  
              result.real = Math.sin(real2) / denom;
              result.imaginary = Math.sinh(imag2) / denom;
          }
  
          return result;
      }
docs: Calculates Tangent value of the complex number.
  
  @param z1 A ComplexNumber instance.
  @return Returns new ComplexNumber instance containing the Tangent value of the specified complex number.