Text this: Theory of optimal experiments