While it is helpful to think of stories as equations there is one very important caveat.
Unlike a mathematical equation where the result is absolute (1 plus 2 can only be 3), results are never absolute with stories. There are any number of possible results – some more credible than others, but none an absolute.
As well, every result is an element in another equation. The equation is never completed; all that is completed is a step in the overall equation. (The overall equation is also known as life.)
And so we often see successful books and movies with sequels. The first story lends itself to another story, the ending (or result) being an element in the next story. This is why we’re always asking, “What happens next?”
All sequels aren’t successful. Quite often, they’re dreadful. But that is a problem of storytelling, not of story.
As an example, think of the movie The Truman Show. It ends with Truman choosing to leave his manufactured life and go out into the real world. The end. But it’s not the end. We know that there is another story after it, the story of Truman discovering the real world.
No one has made a movie of that story and we should probably be grateful for that. Still, it would be a good story in the hands of an adept storyteller.
There can never be an end to the story equation until there is an end to all humanity. Even then, that is part of the premise of the next story. (A dull one, I would imagine, at least for us.)