A variational principle for a fractal nano/microelectromechanical system