The Mathematics of Behavior