我试图找到两个函数之间的交集。 P_g现在是一个常数,但我希望它是灵活的,所以我可以改变它成为一个罪或线性增加。
import numpy as np
import matplotlib.pyplot as plt
d = 100. # price at 0 catch sales local market
b1 = 0.05 # slope of price curve for species1
p = 50. # # price for species1 global
P_g = p # constant for price species1 global
P_l = d * np.exp(-b1*x) # price species1 local market
在我看来,最合适的解决方案是:
P_g = ImplicitRegion[{y == p}, {x, y}]
P_l = ImplicitRegion[{y == d* np.exp(-b1*x)}, {x, y}]
solve[{k /[Element] P_g, k /[Element] P_l}, {k}]
这给了我:SyntaxError:语法无效
答案 0 :(得分:0)
您可以通过scipy.optimize.fsolve(lambda x : d * np.exp(-b1*x) -P_g,0)
或解析analyticalally:x=-np.log(P_g/d)/b1.
在这两种情况下,您都会找到:x=13.862943611198906