Topological derivatives represent the sensitivity of a given design-dependent cost function with respect to the insertion of small inclusions of different materials. The concept has proven useful in a large number of applications, ranging from design optimization of structures to inverse problems and applications in mathematical imaging. While closed-form formulas can be given for many relevant PDE-constrained topology optimization problems, this is not the case when the inclusion shape is non-standard or when the underlying PDE is quasilinear. We illustrate a way to numerically approximate the topological derivative also in these cases and apply this technique to the (multi-material) design optimization of electric machines and the task of corner detection in mathematical imaging.