Mathematical definition, mapping, and detection of (anti)fragility