Boffins find mathematical formula for the wife that is perfect