def error(a1, a2, a3, a4, a5, w = 1, xAxis = [], yAxis = []):
    """
    Error to be minimized.
    

    Equation 30 @ photonCS1994
    https://drive.google.com/file/d/1Rt2DqkhwJINQC1S469adqn5Whz9110ep
    
    """
    #a1, a2, a3, a4, a5 = param
    #yAxisTrue = func(xAxis, *param)
    
    x = xAxis
    A = 1 + a1*x**2 + a2 * x**3 + a3 * x**4
    B = 1 + a4*x**2 + a5 * x**4
    yAxisTrue = 1 - A/B**2
    return sum(w*(yAxisTrue - yAxis)**2)