Dynamic optimization of spur gears