I am working with a curve with two parameters (α,β), in addition to the independent (x between 0 and 1) and dependent (y) variables. I have a function which takes a value for the independent variable and the two parameters function(x,α,β) and returns the slope and y-intercept ([m,b]) for the tangent of the curve at the given x.

I need to find values of x with the same tangent line, i.e. [m,b] for x[0] = [m,b] for x[n]. Is there a solver I can use for this?

For reference/experimentation, here is the function:

def tan_Gmix_van_Laar(x,α,β):
    if x>1 or x<0:
        print("for tan_Gmix_van_Laar: x out of bounds")
    G = (x-x**2)*α*β/(β+(α-β)*x) + x*np.log(x)+(1-x)*np.log(1-x)
    m = α*β/(β+(α-β)*x)*(1-2*x) - α*β*(α-β)/((α-β)*x+β)**2*(x-x**2) + np.log(x/(1-x))
    b = G-m*x
    tanparams = np.array([m,b])
    return tanparams
  • Generally not a good idea to use non-ASCII UTF characters as identifiers, probably want to use alpha and beta there instead. Or a and b if you don't like the length. – Grismar Mar 27 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.