adding root mean square function