Neukum 生产函数

Neukum production function

我正在尝试绘制一个看起来像这样的函数:。 其中,D范围为0.01至300km, N 是直径 > D 每千兆年 sq.km 的陨石坑数量, 系数值在代码中。

我的情节很空洞,显然我做错了一些我无法理解的事情。我正在分享我的代码。

'''

a_0 = -3.0876
a_1 = -3.557528
a_2 = 0.781027
a_3 = 1.021521
a_4 = -0.156012
a_5 = -0.444058
a_6 = 0.019977
a_7 = 0.086850
a_8 = -0.005874
a_9 = -0.006809
a_10 = 8.25*10**-4
a_11 = 5.54*10**-5
a_n = a_0 + a_1 + a_2 + a_3 + a_4 + a_5 + a_6 + a_7 + a_8 + a_9 + a_10 + a_11

for d in range(1, 200000):
    n = a_0 + np.multiply(a_1, np.log(d))
    + np.multiply(a_2, np.log(d)**2)
    + np.multiply(a_3, np.log(d)**3)
    + np.multiply(a_4, np.log(d)**4)
    + np.multiply(a_5, np.log(d)**5)
    + np.multiply(a_6, np.log(d)**6)
    + np.multiply(a_7, np.log(d)**7)
    + np.multiply(a_8, np.log(d)**8)
    + np.multiply(a_9, np.log(d)**9)
    + np.multiply(a_10, np.log(d)**10)
    + np.multiply(a_11, np.log(d)**11)
print(10**n)
plt.plot(10**n, color='green')
plt.show()

''' 图形曲线应该看起来像这样

我无法理解你的代码,但如果你想绘制你编写的函数,你可以试试这个:

import numpy as np
import matplotlib.pyplot as plt
a_0 = -3.0876
a_1 = -3.557528
a_2 = 0.781027
a_3 = 1.021521
a_4 = -0.156012
a_5 = -0.444058
a_6 = 0.019977
a_7 = 0.086850
a_8 = -0.005874
a_9 = -0.006809
a_10 = 8.25*10**(-4)
a_11 = 5.54*10**(-5)

N_POINTS = 100
a_coeff = np.array([a_0, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11])
distance = np.logspace(np.log10(0.01), np.log10(200), N_POINTS)

exponents = np.arange(12)
distance_matrix = distance[:, np.newaxis]*np.ones([N_POINTS, 12])
N = 10**np.sum(a_coeff * (np.log10(distance_matrix)**exponents), axis=1)

fig, ax = plt.subplots(1, figsize=(3, 8))
ax.scatter(distance, N)
ax.set(xscale='log', yscale='log', ylim=(1e-7, 1e4), xlim=(0.001, 300))