new KGV function in utilMath.php