human
Define a custom gate with a parameter."""
class RotationGate(cirq.Gate):
    def __init__(self, theta):
        super(RotationGate, self)
        self.theta = theta
        
    def _num_qubits_(self):
        return 1
    
    def _unitary_(self):
        return np.array([
            [np.cos(self.theta), np.sin(self.theta)],
            [np.sin(self.theta), -np.cos(self.theta)]
        ]) / np.sqrt(2)
    
    def _circuit_diagram_info_(self, args):
        return f"R({self.theta})"
Given the above code, generate some markdown instructions for it.
 What is a code to define a custom gate with a parameter?
assistant
#Here is code to define a custom gate with a parameter.

As above, this circuit can also be simulated in the expected way.
With parameters
Custom gates can be defined and used with parameters. For example, to define the gate
$$ R(\theta) = \left[ \begin{matrix} \cos \theta & \sin \theta \ \sin \theta & - \cos \theta \end{matrix} \right], $$
we can do the following.