src/syndp/utils/functions.py
def calculate_gradient(two_points:tuple, dx=1):
    '''
    This function calculates the gradient of a two point.
    The precondition is that the dx of a given two points is 1. But this can be changed.
    two_points : (x_0, x_1) 
    '''
    if dx <= 0 : 
        raise ValueError('dx should be larger than 0')
    
    x0, x1 = two_points
    grad = (x1 - x0)/dx
    return grad

    This function calculates the gradient of a two point.
    The precondition is that the dx of a given two points is 1. But this can be changed.
    two_points : (x_0, x_1) 
    
This function calculates the gradient of a two point.
The precondition is that the dx of a given two points is 1. But this can be changed.
This function calculates the gradient of a two point . The precondition is that the dx of a given two points is 1 . But this can be changed .
def calculate_gradient(two_points:tuple, dx=1):
    if dx <= 0 : 
        raise ValueError('dx should be larger than 0')
    x0, x1 = two_points
    grad = (x1 - x0)/dx
    return grad
def calculate_gradient ( two_points : tuple , dx = 1 ) : if dx <= 0 : raise ValueError ( 'dx should be larger than 0' ) x0 , x1 = two_points grad = ( x1 - x0 ) / dx return grad
This function calculates the gradient of a two point.
This function calculates the gradient of a two point .
'''
    This function calculates the gradient of a two point.
    The precondition is that the dx of a given two points is 1. But this can be changed.
    two_points : (x_0, x_1) 
    '''
two_points
tuple
dx