<p>The angles(thetas) are passed through the sin() and cos() function so that the observations are in the range [-1,1]. This fixed range of [-1,1] helps in stabilising the training in the neural networks which has been explained well <a href="https://stackoverflow.com/questions/4674623/why-do-we-have-to-normalize-the-input-for-an-artificial-neural-network">here</a>.</p>

<p>You could even use one of the sin() or cos() as your observation. The reason(which I can think of) for using both sin() and cos() is probably to give more information about the state. Maybe using both sin() and cos() leads to a faster convergence.</p>

<p>But normalisation of the inputs is necessary. So, you cannot just use the angles as your state observations for training.</p>

<p>Edit: Answer to the comment by @CHEN TIANRONG
<a href="https://i.stack.imgur.com/EDpGO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EDpGO.png" alt="Plots "></a></p>

<p>I ran DDPG with just sin() and theta_dot in one experiment and with sin(), cos() and theta_dot in another experiment. Clearly the agent never learns the task in the first experiment.</p>

<p>The usage of both sin() and cos() is experimental I guess.</p>

<p>You can find the code I used for the experiments <a href="https://github.com/nsidn98/Stack-Overflow/tree/master/Pendulum_states" rel="nofollow noreferrer">here</a>.</p>

<p>Improving the rate of convergence of a neural network for RL agents is an active area of research. You could search for algorithms which are sample efficient. For example: <a href="https://arxiv.org/abs/1807.01675" rel="nofollow noreferrer">Sample-Efficient Reinforcement Learning with Stochastic Ensemble Value Expansion</a>, <a href="https://arxiv.org/abs/1611.01224" rel="nofollow noreferrer">Sample Efficient Actor-Critic with Experience Replay</a>, etc.</p>
Why the pendulum in openai gym has cos and sin feature? why not just use one of them?
<p>Why the pendulum has cos and sin feature? Can I just use 1 of them? Or can I use theta (the angle) instead? </p>

<p>I expect some explanation for this XD, intuitive or theoretical ones are all welcome.</p>