Modeling MEMS and NEMS