2017-01-20 63 views
2

私は2つの関数の間の交点を見つけようとしています。今のところP_gは定数ですが、私はこれを柔軟にして罪や線形の増加に変えることができます。2つの関数のPython交点

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

'solve'の呼び出しは、構文エラーを発生させます。あなたはあなたが解決しようとしていることを明確にすることができますか? –

+0

これはMathematicaでタグ付けされるべきではないでしょうか? –

答えて

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

関連する問題