for example, I define a function like that:
def trapezoid(x, a, b, c, d):
if x <= a:
return 0
if a < x <= b:
return (x - a)/(b - a)
if b < x <= c:
return 1
if c < x <= d:
return (d - x)/(d - c)
if d < x:
return 0
Now I can calculate the value of y according to input x, but if I know the value of y,how can I calculate x directly? Is there some way in numpy or other library?
for example:
print(trapezoid(12, 10, 30, 50, 90))
0.1
but if I know the result= 0.1, how to calculate the input x(12)? I know there may be a large number of x can get same y, but if I want to know the field of x?