私はグラフy = 5 * x - 300/xをプロットしようとしていますが、私のouptutは単なる直線であり、私はその理由を理解していません。誰も助けることができますか?ありがとうグラフが正しく表示されないのはなぜですか?
xvls= []
Rvls= []
for x in range(-100,100,1):
if x != 0:
def R(x):
f1 = 5*x
f2 = 300/x
f3 = f1+f2
return f3
error = 10
while error >= 1e-6:
error = R(x)-x
x = x -error
Rvls.append(R(x))
xvls.append(x)
else:
print 0
fig = plt.figure(figsize=(10,5))
xvls=np.linspace(-300,300, 25)
Rvls= np.linspace(-300,300, 25)
plt.subplot(1,2, 1)
plt.plot(xvls, Rvls, linestyle='-', marker='o', color='blue')
plt.xlabel('Distance from right hand pin')
plt.ylabel('Reaction force at left hand pin')
plt.title('The relationship between R(x) and x')
plt.rc('font', size=12)
plt.grid()