wrote Canvas method for computing stress