use function instead of numpy