(NEXSTAR) — Flying with a toddler can be a hassle, especially if tears start flowing and arms begin to flail mid-flight, drawing the stares of fellow airline passengers. 

To help parents out, a mathematician at Oxford University in the UK developed a formula aimed at preventing these mile-high tantrums.

The formula calculates the amount of time it might take for a child to throw a fit so parents can delay it from happening 35,000 feet in the air. 

Dr. Tom Crawford, an applied mathematics professor, teamed up with credit broker Asda Money to devise the formula, unveiled on Oct. 20.

“The formula comes as new research by Asda Money reveals children are most likely to have a tantrum 27 minutes and 48 seconds into a flight, with each tantrum lasting an average of 15 minutes and six seconds,” the company said on its website.

“To some, this can feel like a lifetime when trapped inside a plane with a screaming child and upwards of 200 people, with all eyes on you.”

(Getty Images)

Here’s the formula: T = 28 + 37 (S/10) + 31 (B/10) ^ 4/5 + 19 (H/10) ^1/3 + 14 (N/10) ^1/3.

Yes, it looks intense. Thankfully, you don’t have to crunch any numbers. Crawford did that for you. For the formula, the math whizz used some of the most common tantrum triggers as variables: sleepiness (S), boredom (B), hunger (H), and noise (N). 

He scored each from zero to 10, with zero indicating the issue is being ignored and 10 meaning it’s being handled successfully. 

Crawford explained that if the main causes of the tantrum are addressed, meaning they each score 10, then parents can have a tantrum-free journey for flights under 129 minutes. 

So, what does this all mean, and how can you prevent a mid-flight tantrum? Crawford said parents need to ensure their children are napping for 37 minutes to conquer sleepiness. 

To stave off boredom, parents will need to keep their tots entertained for 31 minutes — which can be done by drawing, watching movies, or playing with a tablet or cellphone. 

He suggested that parents set aside 19 minutes for snack time to prevent hunger and 14 minutes of reading or listening to music to handle the noise trigger. 

In theory, this could work. So, it might be worth trying out the next time you have to travel with the kids. But in reality, we know that every child — and flight, for that matter — is different.