Equation of motion of a simple pendulum 
Consider a simple pendulum of length $l$ moving in $(x,y)$ plane. Assume its point of attachment is being jiggled by external forces with prescribed acceleration $a(t)=(a_x(t),a_y(t))$. Let $\theta(t)$ be the angle of deflection from stable equilibrium. What are the kinetic and potential energies of the system?

P.S. If there is no external force then the potential energy is $P=mgl(1-\cos{\theta})$ and the kinetic energy is $K=\frac{ml^2}{2} \dot{\theta}^2$. How these change in the above case?  
 A: The problem is that the motion of your pendulum is no longer "simple harmonic motion". And the expression for potential energy (essentially height above instantaneous equilibrium position) and kinetic energy (due to velocity of rod) have to change - because the velocity of the bob is now the velocity due to angular motion PLUS the velocity of the support point. Similarly the definition of potential energy may need adjusting because the pivot is no longer at its original position.
The work done when accelerating the pivot point is a function of the angle of the pendulum at the time of the motion - for instance, moving the support point to the right while the pendulum has swung to the right will take less energy than doing so while the pendulum is to the left of the pivot (draw a force diagram to convince yourself)
There is not really a simple general formula. Are you sure you want the complicated one?
A: Your potential and kinetic energies are both still the same. What changes are the functions $\theta$ and its time derivatives, which you have in your KE equation already.
