static void Tanx_expansion ( int terms , int x ) {
  double sum = 0 ;
  for ( int i = 1 ;
  i <= terms ;
  i += 1 ) {
    double B = 0 ;
    int Bn = 2 * i ;
    for ( int k = 0 ;
    k <= Bn ;
    k ++ ) {
      double temp = 0 ;
      for ( int r = 0 ;
      r <= k ;
      r ++ ) temp = temp + Math . pow ( - 1 , r ) * fac ( k ) * Math . pow ( r , Bn ) / ( fac ( r ) * fac ( k - r ) ) ;
      B = B + temp / ( ( double ) ( k + 1 ) ) ;
    }
    sum = sum + Math . pow ( - 4 , i ) * ( 1 - Math . pow ( 4 , i ) ) * B * Math . pow ( x , 2 * i - 1 ) / fac ( 2 * i ) ;
  }
  System . out . printf ( "%.9f" , sum ) ;
}

static void Tanx_expansion ( int terms , int x ) { double sum = 0 ; for ( int i = 1 ; i <= terms ; i += 1 ) { double B = 0 ; int Bn = 2 * i ; for ( int k = 0 ; k <= Bn ; k ++ ) { double temp = 0 ; for ( int r = 0 ; r <= k ; r ++ ) temp = temp + Math . pow ( - 1 , r ) * fac ( k ) * Math . pow ( r , Bn ) / ( fac ( r ) * fac ( k - r ) ) ; B = B + temp / ( ( double ) ( k + 1 ) ) ; } sum = sum + Math . pow ( - 4 , i ) * ( 1 - Math . pow ( 4 , i ) ) * B * Math . pow ( x , 2 * i - 1 ) / fac ( 2 * i ) ; } System . out . printf ( " % .9f " , sum ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (identifier)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal)) (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))) right: (parenthesized_expression (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (cast_expression type: (floating_point_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal)) (identifier))) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))))) right: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (decimal_integer_literal))))) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (decimal_integer_literal) right: (identifier)))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal) (identifier))))))