pencil.math.general =================== .. py:module:: pencil.math.general .. autoapi-nested-parse:: Contains the definitions various short mathematicl function. Functions --------- .. autoapisummary:: pencil.math.general.is_number pencil.math.general.is_int pencil.math.general.is_float pencil.math.general.is_iterable pencil.math.general.log_range pencil.math.general.round_next_magnitude pencil.math.general.natural_sort Module Contents --------------- .. py:function:: is_number(num_str) is_number(num_str) Checks if string s is a number. :param num_str: String containing the number to be checked. :type num_str: string .. py:function:: is_int(num_str) is_int(num_str) Checks if string num_str is an int. :param num_str: String containing the number to be checked. :type num_str: string .. py:function:: is_float(num_str) is_float(num_str) Checks if string num_str is a float. :param num_str: String containing the number to be checked. :type num_str: string .. py:function:: is_iterable(i) is_iterable(i) Checks if i is an iterable. :param i: Object to be checked. :type i: obj .. py:function:: log_range(a, b, include_ab=False, finer_factor=1) log_range(a, b, include_ab=False, finer_factor=1) Compute the logarithmic range between a and b. :param a: Start and end values. :type a: float :param b: Start and end values. :type b: float :param include_ab: Always include a and b in the interval. :type include_ab: bool :param finer_factor: Factor by which the range is being refined. :type finer_factor: float .. rubric:: Examples >>> log_range(4, 40) [4, 5, 6, 7, 8, 9, 10, 20, 30, 40] .. py:function:: round_next_magnitude(num) round_next_magnitude(num) Rounds a number up to the next multiple of 10, e.g. 4.56 will be rounded to 10. :param num: Number to be rounded. :type num: float .. py:function:: natural_sort(string_list, reverse=False) natural_sort(string_list, reverse=False) Sort a list of float numbers in strings in a natural way. :param string_list: Will be converted to float, then sorted. :type string_list: list of strings :param reverse: If true, list in reverse order. :type reverse: bool