を展開しようとしているときに、私は今のところうまく働いた.txtファイルを読み込み、プロットするには、この単純なコードとValueError:解凍するためにあまりにも多くの値、simple.txtファイル
import sys
import os
import numpy
import matplotlib.pyplot as plt
from pylab import *
exp_sum = 'exponential_sum.txt'
Term, Absolute_error, Relative_error= numpy.loadtxt(exp_sum, unpack =True)
plt.semilogy(Term,Absolute_error, 'm^-')
plt.semilogy(Term,Relative_error, 'g-')
xlabel('Number of terms N')
ylabel('Absolute and Relative approximation error')
legend(['Absolute error', 'relative error'], loc = 'upper right')
title('Testing convergence of exponential series with respect to error vs iteration terms')
show()
を持って、今それだけで提供します私はこの単純なテキストファイルをプロットしようとしている間、この奇妙なエラー。この値のエラーを解決する方法を教えてください、.txtファイルも添付されています。
#Term Exponential_sum Absolute_error Relative_error
0 1.0 1.71828182846 0.632120558829
1 2.0 0.718281828459 0.264241117657
2 2.5 0.218281828459 0.0803013970714
3 2.66666666667 0.0516151617924 0.0189881568762
4 2.70833333333 0.00994849512571 0.00365984682734
5 2.71666666667 0.00161516179238 0.000594184817582
6 2.71805555556 0.00022627290349 8.3241149288e-05
7 2.71825396825 2.78602050767e-05 1.02491966745e-05
8 2.71827876984 3.05861777505e-06 1.12520259784e-06
9 2.71828152557 3.02885852843e-07 1.11425478283e-07
10 2.71828180115 2.73126605776e-08 1.00477663102e-08
11 2.7182818262 2.26055218988e-09 8.31610676352e-10
12 2.71828182829 1.72876379878e-10 6.35976660213e-11
13 2.71828182845 1.22857279905e-11 4.51966674753e-12
14 2.71828182846 8.14903700075e-13 2.99786317792e-13
15 2.71828182846 5.01820807131e-14 1.84609558095e-14
16 2.71828182846 2.22044604925e-15 8.1685645175e-16
17 2.71828182846 4.4408920985e-16 1.6337129035e-16
18 2.71828182846 4.4408920985e-16 1.6337129035e-16
19 2.71828182846 4.4408920985e-16 1.6337129035e-16
テキストファイルには4列のデータが含まれており、3列のリストに解凍しようとしています。 – yole