Text this: Algorithm for Calculating Noise Immunity of Cognitive Dynamic Systems in the State Space