Sometimes, you feel like you are in the zone, you are on the ball, and you are in the flow.

Scientists have come up with a mathematical formula that represents the state of flow, which could potentially be applied in everything from developing artificial intelligence in machines to personal coaching for humans.

David Melnikoff is a social psychologist from Northeastern University in Massachusetts.

The formula is a way of quantifying how informative a particular means is.

The means, the successful action achieved in the hopes of reaching a goal, E, and I are variables in this formula.

That looks like I(M;E). According to the researchers, when we know more about how our actions will affect our goals, our flow is maximized.

This is an example if you are completely lost at this point. If you want to lose weight, jogging is the way you want to do it, and the mutual information part is to do with how often you jog and how far you run.

If you have more information about how the means will affect the ends, you are more likely to be fully immersed and engaged in what you are doing.

Imagine having to hit a bullseye to win a darts game. You are more likely to be in the zone when the mutual information is highest, and less likely to be when it is lower.

The Peloton treadmills and exercise bikes give you information about means and ends. You get detailed readouts of your performance through the supplied software, as well as links to leaderboards that show how you are doing compared to everyone else who is online at the same time.

There are thousands of positions where a rider could finish and thousands of possible end states, and the rider's performance reveals which of these end states will occur, says psychologist Ryan Carlson.

That is a lot of information, far more than you would normally get from a workout. When did exercising allow you to rule out thousands of possible end states?

The team behind the formula says it could potentially enhance flow in any task, whether that is creating a work of art, playing a sport, or trying to get through a mountain of paperwork before the end of the working day.

Personal interest, talent, and skills are still important. A person who has no interest in gardening but has more information about the means and ends will not become a master gardener.

Bosses wanting to maximize employee performance or software developers looking to build machines that are as efficient as humans are some of the scenarios the researchers say their theory of flow might be helpful in.

The underlying flow principles are not random and work within a biological system that can be described in mathematical terms.

The research has been published.