Math algoritm in DisDoc