If you spend your workday at a desk, you know that familiar and dreaded feeling: the midafternoon slump. E-mails take a bit longer to compose, documents take longer to read. It’s expected, given that you spend most of your time in a chair. To combat your mental fatigue, you reach for artificial stimulation in the form of caffeine, sugar or energy drinks. But all you need to sharpen your mental acuity is something you already own: your legs.

This should come as little surprise. Mental fatigue sets in after you’ve been sitting for an extended period of time, and walking around is an easy way to temporarily increase your alertness. But a few types of extended physical activity can have measurable impact on your mental acuity.

According to recent research, a single workout can immediately boost higher-order thinking skills, making you more productive and efficient as you slog through your workday. When you exercise your legs, you also exercise your brain; this means that a lunchtime workout can improve your cognitive performance, thanks to blood flow and brain food. Brain-derived neurotrophic factor, or BDNF, is a protein that facilitates the growth of neurons and nourishes existing ones. It improves executive function, a type of higher-order thinking that allows people to formulate arguments, develop strategies, creatively solve problems and synthesize information. BDNF sits idly at the synapses of your brain neurons and crosses the synapses only with the increased blood flow that comes with exercise.

Writers have long used exercise to unleash their creative powers. William Wordsworth composed his poems while walking. According to Adam Sisman, author of “The Friendship: Wordsworth & Coleridge,” Wordsworth composed the 159-line “Tintern Abbey” in his head while on one of his walks: “The whole poem was carried in his mind; not a word of it was written down before they reached Bristol, and not a line altered afterwards.”

Novelist Susan Henderson often goes hiking for two or three hours. “For my first draft, I’ll go into the woods,” she says. “I’ll go with a specific question or dilemma, and talk it out into the voice recorder on my phone.”

Craig Finn of the band the Hold Steady uses running as a way to gather song ideas: “Long runs are a very meditative time. My mind gets to a crazy, unique place once I get above 10 miles. It’s a time for some very clear thinking. I don’t know that it’s conscious, but I always feel inspired to write after I run.”

Fortunately, you don’t have to run 10 miles to boost your executive function. Several studies have shown that a short aerobic workout gives your brain an immediate boost. According to Charles Hillman, professor of kinesiology and community health at the University of Illinois, as little as 20 minutes of aerobic exercise at 60 to 70 percent of your maximum heart rate is enough.

Your choice of exercise also makes a difference. A calm mind is key. The less you pay attention to external stimuli — like a book or your environment — the greater the benefit later, because any activity that requires extended concentration involves the same higher-order thinking skills you need after the run. In other words, the more rested your mind during exercise, the better your post-workout problem-solving skills.

This is bad news if you like to read while exercising. But it’s even worse for people who combine their gaming fix with exercise: Hillman said that in a recent study, treadmill runners fared better on post-exercise tests than those who played Wii Fit. “With Wii Fit, you’re exercising, but you’re also cognitively responding to, and accounting for, things in your environment, he says. “This is much like the urban environment, where you have to stop for traffic and pedestrians. You have a busy mind to go along with that busy body.”

The concept of the calm mind is why you might not even need to elevate your heart rate to reap the benefits. All you have to do is head for the hills, or at least the trail, and get away from the concrete jungle. According to a 2008 study from the University of Michigan, nature stokes creativity and strengthens cognitive powers better than urban environments. This is the idea behind Attention Restoration Theory, which posits that a strong mind always needs time to be refreshed. In an urban environment, your mind is never at ease. You have to pay attention to all sorts of external stimuli, such as cars in crosswalks and people on sidewalks. It’s survival mode.

What you need is a workout that involves involuntary attention. This type of attention requires no extra work on your brain’s part. You use it when you notice the cherry blossoms or the beauty of Rock Creek Park. It doesn’t take any extra effort to notice the pretty things; you just do it. According to the researchers at University of Michigan, natural environments are much better than urban environments at restoring and improving cognitive functioning. A natural environment gives the directed-attention part of your brain some vacation time, allowing it to replenish. “Simple and brief interactions with nature can produce marked increase in cognitive control,” according to the researchers. The best part? The participants in the study were walkers, not runners. For most people, walking is a more practical option.

Don’t like to run, or even walk? No problem. You can be flexible in your workout routine. Literally. Yoga may also improve cognitive functioning, according to a recent study. One of the authors, Neha Gothe, an assistant professor of education at Wayne State University, said that when you practice yoga, you’re not only moving, you’re in touch with your body movements. “This awareness might be the reason why you keep distracting parts away and focus on the task at hand,” she says. So while yoga involves focus, it’s a different kind: It requires a mind-body connection, not a connection to external stimuli. In this way, yoga allows your mind time to rest by keeping external thoughts like workplace stress at bay.

No matter your workout, most researchers agree that the cognitive benefits last for at least an hour after exercise. So the next time you need to give your brain a boost, skip the energy drink and grab your workout gear.

To give your brain an immediate boost, try one of the following:

●A 20-minute aerobic workout at 60-70 percent max heart rate

●A walk in a natural environment

●A yoga session

Remember, a clear mind is key. Your brain needs time to recharge, so keep clear of tasks that require voluntary attention.

Opipari is a former track coach and founder of Persuasive Matters, a legal writing consulting company. You can reach him at ben@persuasivematters.com.