Fitting a curve python
Question: I am trying to fit a curve in python with this function

    
    
    def func(x,a,c,d,e):
        return a*((x/45)**c)*((1+(x/45)**d)/2)**((e-c)/d)
    

but I get this error: TypeError: unsupported operand type(s) for /: 'list' and
'int'

What should I do?


Answer: You have to cast `x` as a numpy array.

    
    
    import numpy as np
    
    def func(x,a,c,d,e):
        x=np.array(x)
        return a*((x/45)**c)*((1+(x/45)**d)/2)**((e-c)/d)
    

