Calculation of electrostatic forces and torques in MEMS using path-independent integrals