To my knowledge, there is no such library or pre-trained model.
Imho there is an important issue in the task as defined in the question, more exactly in the example: these tags seem natural for a human in the sense that they represent the general topics of the sentence. But technically one could find many other tags which are semantically relevant, for example ellipse, surface, calculation, formula, sciences, knowledge, classes, exercise... The correct granularity (the level of specificity/genericity) of the tags is intuitive for a human, not for a machine.
So the task is possible: one can calculate all the semantically more general concepts, for instance with WordNet, but this would often return too many concepts like in my example. A standard method in this case would be too take the top N according to some measure of semantic similarity.
Notes: "classify" is not a good term for this, because classification is a supervised task where classes are known. And it's not really based on the "context" of the sentence ("context of X" usually means "information around X" in NLP), it's based on its content or meaning.