Update algebraic.py

some particular localization scenarios are addressed