code: def hamming(M):
      if M <= 1:
          return ivy.ones([M], dtype=ivy.float64)
      n = ivy.arange(M)
      ret = 0.54 - 0.46 * ivy.cos(2.0 * ivy.pi * n / (M - 1))
      return ret
  
imports: import ivy
  from ivy.functional.frontends.jax.func_wrapper import to_ivy_arrays_and_back, handle_jax_dtype
  from ivy.functional.frontends.jax.numpy import promote_types_of_jax_inputs
label_desc: Use image node_id 22 for calling a global function with example usage: hamming(M) and returns: ret, ivy