<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cartesian(n, states):
 """ This function computes cartesians coordinates from the states returned by the simulate function. :param int n: number of particules suspended to the top one :param numpy.array states: list of the positions and speeds at a certain time. """

    length = 1. / n  # arm_length
    pos_x = hstack((states[0], zeros(n)))
    pos_y = zeros(n + 1)
    for j in arange(1, n + 1):
        pos_x[j] = pos_x[j - 1] + length * cos(states[j])
        pos_y[j] = pos_y[j - 1] + length * sin(states[j])
    pos = hstack((pos_x, pos_y))
    return pos