Just adding one type of math equation you can do - a probability table. This may help it not be such a gut-guessing decision in case there are multiple scenarios going on inside your head.
Take @Sloans advice about Net Present Value, but do that calculation with more than one probability. For instance, if you think there is a 80% chance the business will end in 5 years and also a 20% chance it might gain new life and keep producing cash for 20 years... Then calculate NPV for the 80% case (where business winds down after 5 years) and multiply times .8. Then calc that NPV for the 20% case and multiply by .2. Then add those two numbers together.
What might be keeping you from selling in the back of your mind is that there is a probability that different things will happen.
Then you could do the same probability table for what you think you'd be doing if you sold. Like 35% change you'll make $X amount of money. 50% another sum of money, and 15% yet another sum. Try to compare them all taking time value of money into account.