iT邦幫忙

0

想要把 r 跟 T 做成Array 後輸出成txt檔 , 該怎麼做

from math import pi,exp
import numpy as np

R1 = np.loadtxt(fname = 'D:\研究所\XRD資料\LCMO\python data matrix test\lcmofakee.txt')
R2 = np.loadtxt(fname = 'D:\研究所\XRD資料\LCMO\python data matrix test\lcmofake.txt')
d = 200.0# nm

def func( r,r1,r2 ):
return exp(-pir1d/r)+exp(-pir2d/r)-1

Derivative of the above function

def derivFunc( r,r1,r2 ):
return ((pir1dexp(-pir1d/r)+pir2dexp(-pir2d/r))/(r*r))

Function to find the root

def newtonRaphson( r,r1,r2 ):
#if derivFunc(x) > 0:
h = func(r,r1,r2) / derivFunc(r,r1,r2)
while abs(h) >= 0.00001:
h = func(r,r1,r2)/derivFunc(r,r1,r2)

    # x(i+1) = x(i) - f(x) / f'(x) 
    r = r - h   
print("temperature =",T)  
print("The value of the root is : ", "%.10f"%r)
print("resistivity unit is ohm-cm :",r*10**-7)
np.savetxt('D:\研究所\XRD資料\LCMO\python data matrix test\lcmofakeresistivity1.txt',zip(r))

for i in range(0,len(R1)) :
r1 = R1[i,1]
r2 = R2[i,1]
T = R1[i,0]

Driver program to test above

r0 = r2*d # Initial values assumed
newtonRaphson(r0,r1,r2)

看更多先前的討論...收起先前的討論...
小魚 iT邦好手 1 級 ‧ 2018-10-13 07:56:49 檢舉
array的輸出應該是要自己用迴圈跑吧...
應該不能直接丟進去輸出...
通常程式語言都沒有定義array怎麼輸出,
輸出的都會是跟array有關的看不懂的文字...
wendyduke iT邦新手 5 級 ‧ 2018-10-13 09:23:20 檢舉
那如果我想要上面解出的r 跟原本就有的T, 輸出成txt檔要怎麼做呢,他們分別為電阻率跟溫度
dansnow iT邦新手 5 級 ‧ 2018-10-13 09:40:05 檢舉
```python
with open("filename.txt", "w") as f:
f.write("{} {} {}\n".format(r1, r2, T))
```
大概會是這樣,上面這是 python3 的
我不知道你是 python 幾,不過 python 的 array 應該也可以用 join 串成文字吧
dansnow iT邦新手 5 級 ‧ 2018-10-13 09:44:19 檢舉
如果可以的話請你把上面的程式碼整理一下到我可以直接複製貼上
像上面一樣用 ```python 跟 ``` 包起來就會有顏色跟保留縮排了
然後資料看能不能提供個一筆 能直接跑的話我就可以在我的電腦上跑來測試了
wendyduke iT邦新手 5 級 ‧ 2018-10-13 09:51:39 檢舉
我是python 3,照大大那樣做可以得到第一組數據組~可是不能得到其他組,請問該怎麼做呢
wendyduke iT邦新手 5 級 ‧ 2018-10-13 09:54:24 檢舉
''''
from math import pi,exp
import numpy as np

R1 = np.loadtxt(fname = 'D:\研究所\XRD資料\LCMO\python data matrix test\lcmofakee.txt')
R2 = np.loadtxt(fname = 'D:\研究所\XRD資料\LCMO\python data matrix test\lcmofake.txt')
d = 200.0# nm

def func( r,r1,r2 ):
return exp(-pi*r1*d/r)+exp(-pi*r2*d/r)-1

# Derivative of the above function
def derivFunc( r,r1,r2 ):
return ((pi*r1*d*exp(-pi*r1*d/r)+pi*r2*d*exp(-pi*r2*d/r))/(r*r))

# Function to find the root
def newtonRaphson( r,r1,r2 ):
#if derivFunc(x) > 0:
h = func(r,r1,r2) / derivFunc(r,r1,r2)
while abs(h) >= 0.00001:
h = func(r,r1,r2)/derivFunc(r,r1,r2)

# x(i+1) = x(i) - f(x) / f'(x)
r = r - h
resistivity = r*10**-7
print("temperature =",T)
print("The value of the root is : ", "%.10f"%r)
print("resistivity unit is ohm-cm :",r*10**-7)
with open("D:\研究所\XRD資料\LCMO\python data matrix test\lcmofakeresistivity1.txt", "w") as f:
f.write("{} {} {} {}\n".format(T,r1, r2,resistivity))
for i in range(0,len(R1)) :
r1 = R1[i,1]
r2 = R2[i,1]
T = R1[i,0]
# Driver program to test above
r0 = r2*d # Initial values assumed
newtonRaphson(r0,r1,r2)
wendyduke iT邦新手 5 級 ‧ 2018-10-13 09:55:19 檢舉
數據
150.21 14236.2
150.37 14305
150.51 14494.58
150.62 14608.07
150.78 14765.65
150.93 14923.47
151.07 15227.23
151.18 15287.19
151.34 15544.1
151.48 15586.16
151.65 15822.04
151.79 16044.11
151.9 16156.07
152.04 16201.33
152.21 16533.71
152.35 16638.8
152.52 16778.41
152.62 16955.19
152.76 17104.36
152.93 17405.23
153.08 17388.24
153.18 17730.87
153.32 17767.78
153.49 17974.53
153.63 18257.25
153.8 18272.4
153.88 18448.92
154.05 18680.81
154.19 18936.06
154.36 19172.37
154.5 19293.59
154.6 19406.53
154.77 19695.45
154.91 19743.64
155.06 20051.69
155.18 20202.27
155.33 20288.41
155.47 20514.66
155.64 20707.62
155.78 21021.8
155.89 21101.87
156.03 21407.47
156.19 21510.47
156.34 21690.67
156.5 21974.93
156.61 22142.5
156.75 22268.44
156.9 22474.16
157.06 22736.83
157.14 23003.54
157.31 22982.58
157.45 23343.28
157.62 23584.13
157.76 23729.39
157.87 23781.44
158.01 24062.38
158.18 24348.41
158.32 24494.28
158.48 24664.31
158.59 24887.98
158.73 25090.31
158.88 25290.69
159.04 25419.76
159.15 25710.7
159.29 25999.79
159.44 26103.23
159.6 26254.79
159.77 26698.47
159.85 26829.25
160.01 27032.5
160.16 27159.73
160.3 27484.64
160.47 27700.28
160.57 27905.81
160.74 27919.42
160.88 28388.41
161.03 28426.12
161.13 28706.2
161.3 28848.69
161.44 29150.55
161.61 29359.26
161.75 29491.76
161.85 29776.75
162 30096.5
162.14 30198.29
162.31 30418.28
162.45 30456.85
162.55 30649.99
162.72 31155.28
162.87 31174.16
163.01 31465.16
163.11 31609.25
163.28 31892.89
163.42 31899.82
163.59 32244.34
163.73 32628.78
163.84 32852.95
163.98 32867.3
164.15 33061.05
164.29 33296.12
164.44 33517.1
164.54 33823.98
164.7 33907.36
164.85 34263.85
164.99 34225.9
165.09 34398.37
165.23 34605.68
165.4 34846.95
165.54 35261.93
165.7 35469.22
165.8 35562.55
165.94 35881.68
166.08 36092.92
166.22 36048.28
166.38 36271.04
166.48 36483.43
166.62 36660.69
166.78 36981.54
166.93 37059.54
167 37508.23
167.17 37688.99
167.31 37667.16
167.47 37861.47
167.61 38048.22
167.71 38365.65
167.85 38826.13
168.01 38839.86
168.15 39064.83
168.25 39135.89
168.39 39502.36
168.53 39400.4
168.7 39834.88
168.84 40157.87
168.94 40369.35
169.08 40265.67
169.24 40615.28
169.38 40770.22
169.52 41102.18
169.62 41326.59
169.76 41344.37
169.9 41287.66
170.06 41611.51
170.21 41623.53
170.31 42006.32
170.45 42261.82
170.61 42284.19
170.75 42438.77
170.83 42751.96
170.99 42790.53
171.13 43099.98
171.27 43059.76
171.41 43417.58
171.53 43780.82
171.67 43527.95
171.81 44100.01
171.95 44015.77
172.1 44320.93
172.2 44429.39
172.36 44461.46
172.5 44773.62
172.64 44661.78
172.74 44810.83
172.88 45029.05
173.04 45574.26
173.18 45596.89
173.32 45867.22
173.45 45919.83
173.59 45897.03
173.75 46337.57
173.91 46166.43
174.01 46628.26
174.15 46632
174.31 46780.99
174.45 46903.86
174.61 46927.65
174.71 46986.7
174.87 47194.62
175.04 47372.74
175.18 47591.14
175.4 47756.69
175.5 47988.58
175.66 47996.49
175.72 48173.5
175.86 48083.43
175.96 48525.94
176.2 48635.75
176.22 48469.58
176.44 48579.58
176.52 48678.12
176.62 48809.94
176.83 48916.57
176.94 49025.89
177.05 49289.6
177.19 49258.15
177.35 49331.24
177.43 49289.24
177.41 49386.72
177.81 49790.24
178.07 49620.76
178.07 50220.05
177.83 50014.46
178.22 50249.85
178.36 50005.94
178.42 50082.28
178.54 50478.55
178.66 50423.55
178.8 50524.11
178.92 50622.58
179.02 50835.15
179.16 50955.33
179.3 50814.49
179.44 51256.87
179.54 51007.51
179.68 51240.19
179.85 51352.22
180 51235.35
180.23 51478.77
180.49 51531.07
180.39 51266.31
180.65 51332.48
180.57 51755.05
180.73 51627.33
180.65 51679.39
181.35 51757.81
181.05 51954.5
181.35 52017.23
181.78 52086.64
181.92 51799.26
182.06 51985.72
182.22 52403.02
182.1 52308.66
181.92 52465.26
182.38 52330.55
182.5 52398.85
182.68 52467.22
182.84 52533.5
182.7 52273.03
182.92 52839.82
183.17 52757.48
183.2 52767.29
183.31 52875.08
183.31 52477.51
183.45 52741.97
183.59 52616.02
183.73 52796.1
183.81 52610.38
183.95 52821.3
184.09 52790.46
184.23 52531.9
184.33 52889.42
184.45 53045.23
184.62 52938.17
184.73 52769.98
184.88 52801.38
184.98 52907.08
185.12 52752.51
185.26 52554.29
185.38 52565.57
185.48 52950.44
185.62 52950.62
185.74 52592.24
185.88 52990.35
186.02 52778.87
186.12 52811.25
186.26 52811.31
186.41 52762.01
186.52 53080.24
186.66 52609.71
186.75 52605.36
186.89 52777.71
187.03 52781.27
187.17 52977.78
187.31 52691.5
187.39 53038.54
187.53 52870.73
187.67 52707.08
187.81 52810.58
187.9 52634.79
188.04 52730.13
188.18 52525.15
188.3 52866.86
188.44 52839.7
188.52 52629.64
188.66 52801.75
188.8 52755.94
188.94 52541.22
189.02 52561.52
189.16 52540
189.3 52484.26
189.43 52112.26
189.57 52566.55
189.67 52507.31
189.79 52356.72
189.93 52087.74
190.07 52098.16
190.19 52223.86
190.29 52003.31
190.43 52176.46
190.55 52102.33
190.69 51568.17
190.77 51565.03
190.91 51660.63
191.05 51816
191.18 51609.68
191.32 51604.28
191.4 51704.53
191.54 51316.35
191.68 51398.26
191.8 51193.35
191.88 51134.55
192.02 51397.04
192.16 51231.8
192.28 51113.52
192.42 51089.54
192.52 51187.47
192.64 51122.47
192.78 51000.21
192.91 50663.16
193.05 51074.89
193.13 50696.95
193.27 50803.58
193.41 50689.29
193.53 50640.36
193.61 50380.87
193.75 50487.75
193.89 50471.8
194.01 50380.69
194.15 50149.48
194.24 50081.29
194.38 50003.24
194.49 50086.81
194.64 49643.39
194.72 49774.54
194.86 49883.99
194.98 49614.5
195.12 49694.71
195.24 49487.71
195.33 49355.51
195.45 49507.03
195.59 49089.72
195.71 49114
195.83 49237.92
195.92 49157.66
196.04 48928.96
196.18 48995.42
196.3 48936.25
196.38 48840.41
196.51 48957.28
196.63 48346.16
196.77 48406.56
196.89 48169.15
196.97 48541.2
197.1 48310.6
197.22 48219
197.36 48135.36
197.48 47996.06
197.58 47941.06
197.7 47562.75
197.81 47467.71
197.95 47838.29
198.03 47484.14
198.15 47360.78
198.27 47271.39
198.41 47040.42
198.52 46960.71
198.6 46962.54
198.72 47099.27
198.86 46939.36
198.97 46773.64
199.06 46662.53
199.17 46730.71
199.31 46609.13
199.43 46295.26
199.55 46125.3
199.65 46445.85
199.76 46105.61
199.88 46012.48
200.02 46000.96
200.14 46078.88
200.22 45990.1
200.33 45449.61
200.47 45379.58
200.59 45259.96
200.67 45556.91
200.81 45371.85
200.93 45255.79
201.04 45202.93
201.16 45030.65
201.24 44855.22
201.38 44592.24
201.5 44642.46
201.62 44278.57
201.73 44408.61
201.83 44537.01
201.95 44295.92
202.07 44462.94
202.19 44200.33
202.27 44130
202.38 44028.65
202.52 43797.24
202.64 43766.46
202.76 43532.73
202.84 43622.63
202.95 43268.53
203.07 43132.85
203.21 43455.42
203.27 43345.3
203.39 43046.46
203.53 42889.36
203.64 42841.97
203.76 42788.02
203.84 42756.68
203.96 42639.02
204.08 42315.47
204.19 42329.5
204.31 42179.6
204.41 42248.57
204.53 41973.64
204.65 41916.49
204.76 41825.5
204.85 41991.85
204.96 41722
205.08 41493.49
205.2 41560.08
205.31 41153.19
205.41 41165.39
205.53 41130.01
205.65 41026.64
205.77 41035.22
205.83 40804.99
205.96 40739.62
206.08 40585.48
206.2 40618.04
206.32 40292.95
206.4 40214.29
206.52 40099.2
206.64 40015.51
206.76 39970.93
206.87 40207.91
206.95 39875.16
207.07 39888.21
207.19 39614.27
207.31 39733.09
207.38 39641.36
207.5 39510.77
207.62 39389.24
207.74 39056.61
207.86 38921.35
207.93 38992.42
208.05 38890.08
208.17 38797.37
208.29 38833.67
208.37 38765.98
208.47 38523.24
208.58 38558.31
208.7 38454.01
208.84 38097.78
208.9 38028.06
209.02 37871.83
209.13 38164.24
209.25 37832.71
209.37 37785.68
209.45 37708.85
209.57 37692.67
209.69 37323.92
209.81 37260.1
209.87 37524.18
209.98 37099.57
210.1 36970.57
210.22 36992.03
210.34 37064.5
210.42 36708.69
210.53 36888.16
210.65 36650.63
210.75 36560.62
210.83 36321.93
210.95 36495.62
211.07 36441.49
211.19 36287.1
211.3 35921.79
211.38 36069.19
211.5 35894.93
211.6 35936.57
211.72 35878.74
211.84 35739.26
211.89 35796.58
212.03 35554.4
212.13 35594.07
212.25 35199.32
212.33 35394.06
212.45 35100.85
212.56 35225.08
212.66 34806.9
212.78 34710.96
212.86 34960.56
212.98 34778.65
213.07 34770.25
213.19 34535.04
213.27 34404.63
213.39 34393.22
213.49 34285.93
213.61 34235.46
213.72 34268.33
213.8 33968.32
213.9 33882.17
214.02 33674.93
214.12 33700.31
214.24 33609.01
214.31 33528.69
214.43 33473.57
214.53 33484.92
214.65 33418.08
214.73 33061.79
214.82 33100.11
214.95 32961.84
215.06 32824.19
215.18 32921.43
215.24 32775.75
215.36 32766.43
215.47 32724.49
215.57 32474.58
215.69 32482.8
215.77 32535.47
215.87 32479.29
215.99 32291.68
216.11 32110.67
216.17 32045.26
216.28 32056.53
216.38 31960.89
216.5 31788.41
216.62 31799.94
216.68 31623.05
216.79 31652.6
216.89 31664.62
217.01 31493
217.13 31220.82
217.19 31130.08
217.31 31265.95
217.41 31181.88
217.53 30999.36
217.6 31007.57
217.7 30856.25
217.82 30867.66
217.92 30770.78
218.04 30507.37
218.12 30443.61
218.21 30649.01
218.33 30563.54
218.43 30286.09
218.51 30407.98
218.61 30236.36
218.73 30210.67
218.83 29899.75
218.94 29914.95
219 30023.78
219.12 29896.19
219.24 29918.99
219.35 29818.45
219.41 29731.13
219.53 29571.65
219.65 29399.06
219.77 29338.04
219.87 29283.85
219.95 29287.71
220.03 29261.9
220.12 29030.37
220.22 29042.15
220.32 29003.76
220.4 28706.38
220.48 28946.74
220.6 28681.68
220.7 28710.19
220.77 28449.05
220.87 28631.83
220.99 28462.36
221.09 28324.59
221.19 28251.5
221.26 28187.24
221.36 28118.56
221.48 28153.7
221.58 27897.28
221.68 27906.91
221.76 27926.9
221.86 27867.98
221.97 27769.01
222.07 27737.81
222.13 27642.7
222.25 27493.52
222.35 27598.99
222.47 27530.99
222.56 27384.7
222.64 27312.96
222.74 27147.72
222.86 27100.01
222.96 27047.28
223.04 27041.33
223.14 26994.68
223.23 26921.41
223.33 26670.76
223.45 26620.9
223.53 26559.78
223.65 26702.4
223.73 26433.77
223.82 26610.6
223.92 26381.72
223.98 26262.4
224.1 26367.98
224.2 26163.07
224.3 26234.32
224.38 26070.43
224.47 26059.33
224.59 25873.24
224.69 26029.89
224.79 25816.64
224.85 25746.62
224.97 25685.24
225.07 25707.44
225.17 25719.15
225.24 25403.69
225.34 25440.24
225.44 25394.86
225.56 25418.04
225.66 25247.59
225.75 25303.51
225.93 25191.79
225.99 25140.23
226.09 25181.31
226.21 25046.17
227.23 24935.81
226.33 24934.4
226.43 24936.78
226.52 24875.41
226.58 24592.26
226.7 24685.4
226.8 24649.16
226.86 24637.27
226.95 24418.74
227.01 24405.01
227.11 24401.76
227.21 24196.3
227.33 24134.19
227.39 24061.95
227.49 24254.05
227.59 24055.58
227.69 24148.47
227.8 24094.03
227.86 23947.17
227.96 23833.49
228.08 23853.12
228.18 23722.57
228.25 23643.85
228.39 23678.62
228.49 23486.94
228.59 23496.15
228.67 23526.13
228.75 23408.9
228.85 23501.85
228.95 23395.52
229.06 23293.07
229.16 23275.65
229.24 23066.03
229.34 22978.35
229.46 23164.56
229.56 22985.46
229.61 22928.5
229.69 22885.51
229.81 22888.65
229.91 22746.2
230.03 22714.31
230.01 22795.2
230.08 22539.94
230.16 22482.98
230.28 22584.46
230.34 22597.77
230.43 22333.5
230.53 22494.2
230.64 22317.37
230.84 22259.85
230.85 22281.19
230.88 22246.25
231.01 22047.96
231.05 21967.88
231.2 21928.89
231.34 22098.97
231.44 21894.55
231.63 21917.97
231.49 21867.51
231.59 21826.73
231.74 21776.08
231.76 21595.82
231.92 21538.87
231.98 21562.35
232.05 21462.47
232.15 21478.35
232.24 21362.77
232.38 21380.06
232.61 21340.88
232.57 21285.88
232.61 21385.33
232.75 21204.83
232.75 21204.15
232.8 21110.46
232.92 20998.75
232.99 20932.59
233.07 21026.77
233.17 21003.1
233.23 20802.11
233.32 20829.83
233.42 20949.27
233.52 20799.72
233.58 20702.53
233.67 20653.24
233.76 20618.41
233.88 20567.95
234 20530.37
234.09 20601.85
234.13 20514.36
234.21 20468.19
234.29 20452.92
234.36 20231.45
234.44 20220.42
234.54 20370.28
234.63 20298.23
234.73 20206.38
234.79 20157.7
234.86 20124.59
234.96 20083.26
235.06 19922.37
235.13 19935.24
235.21 19944.76
235.31 19972.16
235.39 19732.48
235.48 19706.42
235.54 19651.12
235.64 19748.55
235.71 19763.69
235.81 19576.32
235.91 19687.85
235.95 19590.72
236.04 19469.94
236.14 19434.31
236.22 19385.08
236.29 19399.55
236.37 19445.22
236.46 19229.34
236.56 19305.74
236.66 19317.38
236.72 19274.47
236.83 19176.12
236.95 19149.45
237.26 19086.42
237.14 18920.01
237.2 18967.65
237.26 19048.89
237.31 18949.68
237.39 18912.4
237.45 18932.38
237.55 18904.55
237.62 18870.27
237.7 18763.96
237.8 18774.69
237.85 18550.58
237.95 18543.34
238.03 18629.67
238.12 18643.53
238.18 18461.37
238.26 18547.52
238.36 18445.11
238.45 18389.08
238.53 18353.4
238.59 18330.65
238.68 18300.48
238.76 18220.71
238.86 18246.83
238.92 18117.33
238.99 18110.9
239.09 18033.46
239.16 18042.04
239.26 18081.96
239.32 18097.59
239.42 18063.86
239.51 17965.58
239.59 17897.83
239.65 17849.33
239.74 17827.62
239.86 17739.21
239.96 17721.8
240.05 17819.84
240.11 17749.51
240.3 17693.83
240.34 17617.74
240.4 17688.99
240.53 17609.65
240.05 17520.81
240.44 17467.15
240.76 17498.42
240.76 17367.21
240.86 17491.07
240.88 17351.4
240.94 17312.22
241.02 17395.54
241.19 17238.88
241.23 17282.48
241.29 17184.37
241.36 17156.42
241.42 17226.26
241.48 17152.25
241.56 17114.35
241.63 17149.06
241.71 16953.34
241.79 17091.12
241.85 16999.39
241.92 16962.54
242 16872.84
242.09 16830.71
242.15 16814.22
242.23 16841.32
242.31 16749.53
242.4 16782.95
242.48 16740.09
242.54 16609.92
242.62 16576.08
242.69 16601.28
242.79 16623.9
242.87 16539.23
242.92 16608.45
243 16438.85
243.08 16564.12
243.16 16450.01
243.21 16452.22
243.31 16312.11
243.39 16396.3
243.46 16349.03
243.54 16332.35
243.6 16293.72
243.67 16278.08
243.77 16146.57
243.85 16168.46
243.93 16176.98
244 16036.2
244.08 16016.22
244.16 16094.58
244.26 16004.87
244.31 16002.6
244.39 16011.8
244.49 15992.8
244.56 15961.03
244.62 15878.81
244.68 15895.92
244.74 15770.34
244.82 15748.21
244.89 15821.24
244.95 15749.37
245.03 15708.36
245.1 15740.73
245.18 15675.18
245.26 15738.28
245.32 15608.29
245.39 15681.32
245.47 15607.8
245.54 15575.36
245.6 15558.14
245.68 15524.79
245.76 15498.66
245.83 15515.58
245.91 15340.23
245.97 15320.48
246.04 15349.85
246.12 15321.22
246.22 15297.37
246.3 15319.51
246.34 15294.73
246.41 15224.16
246.49 15145.43
246.57 15127.65
246.63 15153.52
246.7 15117.53
246.78 15049.41
246.86 15057.02
246.93 15091.17
246.99 15070.39
247.07 15089.02
247.14 15011.03
247.22 15045.67
247.28 14919.43
247.36 14937.08
247.43 14886.63
247.49 14808.75
247.59 14811.02
247.63 14870.92
247.7 14828.19
247.78 14727.64
247.86 14680.48
247.92 14682.87
247.99 14646.4
248.07 14617.52
248.15 14685.64
248.23 14665.83
248.26 14597.65
248.34 14622.91
248.42 14634.26
248.5 14480.1
248.57 14450.43
248.63 14476.61
248.69 14511.44
248.77 14516.16
248.84 14454.48
248.9 14392.62
248.98 14392.85
249.03 14388.08
249.11 14351.84
249.19 14260.6
249.25 14233.87
249.33 14265.01
249.4 14229.82
249.48 14274.7
249.51 14271.7
249.59 14117.01
249.67 14094.87
249.75 14087.57
249.83 14059.12
249.86 14164.1
249.94 14142.14
250.02 14031.29
250.1 14100.76
250.16 13989.66
250.21 14027.12
250.29 13950.41
250.37 13981.57
250.42 13839.93
250.48 13946.68
250.54 13925.1
250.61 13935.46
250.69 13824.29
250.77 13887.75
250.83 13828.83
250.88 13855.38
250.96 13746.73
251.04 13731.22
251.08 13738.82
251.16 13653.29
251.23 13627.35
251.31 13638.76
251.37 13661.62
251.43 13645.43
251.48 13595.84
251.56 13562.48
251.64 13631.83
251.71 13478.42
251.75 13463.95
251.83 13430.47
251.89 13462.17
251.97 13405.58
252.02 13482.83
252.08 13490.86
252.16 13381.17
252.24 13341.81
252.29 13308.64
252.35 13290.73
252.43 13347.94
252.48 13369.65
252.56 13242.05
252.6 13346.11
252.68 13234.39
252.76 13230.47
252.81 13199.2
252.89 13179.63
252.95 13216.98
253.01 13185.76
253.08 13080.92
253.14 13188.59
253.22 13088.65
253.26 13102.93
253.33 13090.73
253.39 12980.48
253.47 13007.83
253.51 13088.89
253.58 12978.03
253.66 13013.1
253.72 12957.19
253.8 12930.64
253.84 12908.68
253.91 12899.49
253.97 12895.07
254.05 12903.36
254.08 12799.98
254.16 12780.54
254.22 12874.05
254.3 12825.11
254.37 12765.83
254.41 12709.29
254.47 12693.17
254.55 12711.5
254.61 12646.81
254.67 12629.53
254.72 12690.16
254.8 12680.59
254.85 12665.57
254.93 12699.24
254.97 12680.84
255.05 12569.5
255.11 12599.05
255.17 12580.77
255.24 12575.57
255.28 12473.78
255.36 12434.91
255.41 12440.19
255.49 12426.7
255.53 12431.05
255.61 12471.15
255.67 12462.38
255.72 12394.69
255.8 12407.62
255.84 12409.53
255.92 12381.63
255.97 12317.99
256.05 12276.23
256.09 12259.8
256.15 12249.25
256.23 12236.07
256.28 12215.1
256.36 12311.36
256.4 12267.52
256.46 12213.99
256.54 12229.02
256.59 12167.21
256.63 12196.71
256.71 12144.9
256.77 12202.9
256.82 12072.06
256.9 12098.78
256.94 12079.96
257 12066.53
257.07 12093.69
257.13 12070.52
257.17 12028.89
257.23 12010.43
257.31 11986.22
257.36 12052.43
257.42 11995.96
257.48 11898.53
257.54 11911.83
257.6 11959.05
257.67 11938.64
257.73 11887.12
257.77 11867.14
257.84 11892.27
257.9 11833.97
257.96 11824.1
258 11783.27
258.08 11761.68
258.14 11826.8
258.19 11809.38
258.27 11751.56
258.31 11755.25
258.37 11759.1
258.42 11750.76
258.5 11651.37
258.54 11651.99
258.6 11745.99
258.65 11679.64
258.73 11652.85
258.79 11669.7
258.83 11625.14
258.88 11634.03
258.96 11535.86
259.02 11550.33
259.08 11606.92
259.12 11580.31
259.18 11553.52
259.23 11528.38
259.29 11510.85
259.35 11497.05
259.41 11522.8
259.47 11429.42
259.52 11427.21
259.58 11394.84
259.62 11393.24
259.69 11382.08
259.74 11370.61
259.81 11461.67
259.85 11383.37
259.91 11359.34
259.97 11381.41
260.02 11382.08
260.1 11369.58
260.14 11387.36
260.2 11262.77
260.25 11366.94
260.31 11276.32
260.35 11268.59
260.41 11247.13
260.47 11229.78
260.52 11224.5
260.6 11212.18
260.64 11196.6
260.7 11148.91
260.75 11172.94
260.81 11226.34
260.85 11189.86
260.91 11131.74
260.97 11167.85
261.02 11143.44
261.08 11131.86
261.12 11153.45
261.18 11065.21
261.26 11069.32
261.31 11080.17
261.35 10993.48
261.41 10984.28
261.47 10973.91
261.53 11040.5
261.58 11058.53
261.62 11054.24
261.68 11008.19
261.74 10986.54
261.79 10971.7
261.85 10930.32
261.89 10869.68
261.95 10957.85
262.01 10903.22
262.07 10909.84
262.11 10869.01
262.16 10858.46
262.22 10872.56
262.28 10872.13
262.34 10794.08
262.38 10773.17
262.43 10802.42
262.49 10852.14
262.55 10742.02
262.59 10823.82
262.65 10822.96
262.7 10775.07
262.76 10758.77
262.82 10720.5
262.86 10713.64
262.92 10725.96
262.97 10660.47
263.01 10635.46
263.09 10695.6
263.11 10719.95
263.16 10674.03
263.22 10636.32
263.28 10623.57
263.32 10612.04
263.38 10626.02
263.44 10621.61
263.49 10612.96
263.55 10631.78
263.59 10528.1
263.63 10500.51
263.69 10524.48
263.74 10544.53
263.78 10571.01
263.84 10571.14
263.9 10523.5
263.96 10503.76
264.01 10471.94
264.05 10495.67
264.09 10417.06
264.15 10465.93
264.21 10455.08
264.25 10473.9
264.3 10467.28
264.36 10427.73
264.42 10388.61
264.46 10376.78
264.49 10412.27
264.55 10315.15
264.61 10410.5
264.67 10370.03
264.71 10358.69
264.75 10349
264.81 10312.21
264.86 10295.66
264.92 10314.3
264.96 10273.27
265 10294.18
265.05 10294.37
265.11 10307.98
265.15 10196.76
265.21 10225.76
265.25 10239.92
265.31 10268.25
265.36 10263.72
265.4 10213.93
265.46 10208.95
265.5 10156.53
265.56 10183.02
265.59 10176.4
265.65 10135.14
265.69 10135.2
265.75 10142.61
265.81 10073.94
265.85 10063.34
265.88 10088.29
265.94 10083.57
266 10043.35
266.06 10027.28
266.08 10018.2
266.15 10012.69
266.19 10094.67
266.25 10022.57
266.27 10018.33
266.33 10005.03
266.39 10029.49
266.42 10049.61
266.48 10011.83
266.52 10027.28
266.58 9961.065
266.62 9944.995
266.68 9948.43
266.71 9933.1
266.77 9883.38
266.81 9907.475
266.87 9878.9
266.91 9868.905
266.95 9945.49
267 9878.715
267.04 9931.265
267.1 9890.55
267.13 9885.705
267.18 9869.58
267.23 9867.13
267.29 9796.805
267.33 9879.7
267.37 9829.605
267.43 9760.63
267.46 9776.26
267.52 9841.745
267.58 9830.895
267.6 9764.92
267.66 9754.19
267.72 9805.755
267.75 9740.945
267.79 9757.93
267.83 9758.665
267.89 9685.21
267.95 9677.975
267.99 9667.43
268.02 9656.085
268.06 9647.32
268.12 9724.33
268.18 9698.21
268.22 9643.33
268.25 9676.38
268.29 9647.38
268.35 9625.675
268.41 9614.15
268.43 9644.62
268.49 9660.19
268.52 9626.59
268.58 9589.13
268.6 9580.975
268.66 9575.395
268.7 9622.61
268.76 9555.47
268.82 9590.055
268.83 9574.6
268.89 9589.805
268.93 9555.1
268.99 9517.15
269.01 9570.8
269.06 9478.705
269.1 9493.85
269.16 9547.5
269.2 9545.84
269.24 9463.56
269.28 9503.54
269.33 9460.005
269.38 9454.12
269.41 9456.265
269.45 9426.035
269.51 9458.47
269.55 9451.725
269.6 9431.985
269.62 9374.655
269.68 9454.18
269.72 9415.61
269.78 9377.23
269.8 9372.14
269.86 9398.75
269.89 9412.545
269.93 9378.52
269.99 9411.075
270.03 9359.51
270.07 9350.555
270.1 9353.625
270.16 9350.19
270.2 9363.555
270.24 9284.585
270.28 9352.03
270.34 9342.16
270.38 9303.04
270.42 9265.88
270.45 9260.18
270.49 9281.765
270.55 9273.79
270.59 9207.88
270.63 9290.285
270.66 9255.64
270.7 9236.39
270.76 9273.425
270.78 9240.19
270.84 9226.58
270.88 9245.095
270.92 9175.08
270.97 9209.965
270.99 9193.655
271.05 9158.15
271.09 9190.1
271.13 9172.99
271.16 9150.305
271.2 9128.355
271.26 9166.92
271.3 9145.765
271.34 9169.3
271.38 9140.495
271.42 9129.14
271.46 9138.95
271.51 9062.685
271.53 9040.175
271.59 9041.525
271.63 9028.955
271.67 9017.49
271.7 9106.945
271.75 9070.77
271.78 9037.965
271.84 9028.65
271.88 9021.9
271.9 9013.81
271.96 8982.97
271.99 8974.935
272.03 9020.985
272.07 9049.435
272.11 9010.315
272.15 9007.74
272.19 8957.955
272.25 9015.71
272.26 8945.015
272.3 8965.925
272.36 8904.305
272.4 8942.19
272.44 8907.74
272.46 8924.535
272.52 8886.645
272.55 8970.705
272.59 8960.71
272.63 8899.515
272.67 8894.8
272.71 8882.29
272.77 8906.45
272.8 8870.455
272.82 8896.21
272.86 8826.19
272.9 8852.86
272.96 8870.335
273 8864.385
273.02 8828.945
273.07 8856.475
273.11 8848.565
273.15 8869.965
273.17 8780.57
273.23 8864.14
273.27 8859.97
273.3 8828.58
273.35 8815.585
273.36 8773.46
273.42 8776.34
273.46 8796.575
273.5 8734.095
273.54 8751.015
273.57 8797
273.62 8791.24
273.65 8762.36
273.69 8778.73
273.71 8746.91
273.75 8742.985
273.81 8735.015
273.85 8683.2
273.86 8674.25
273.9 8690.07
273.94 8662.295
273.98 8655.425
274.04 8733.785
274.06 8728.265
274.1 8726.25
274.13 8686.39
274.17 8654.265
274.21 8651.505
274.25 8700.125
274.29 8690.99
274.33 8660.58
274.37 8680.75
274.39 8621.58
274.44 8617.29
274.48 8613.06
274.52 8600.675
274.54 8562.415
274.58 8559.285
274.62 8576.27
274.66 8641.875
274.71 8608.035
274.73 8596.685
274.77 8528.51
274.81 8534.21
274.85 8550.705
274.87 8580.13
274.9 8541.69
274.96 8536.725
275 8535.13
275.04 8548.31
275.06 8554.255
275.1 8538.62
275.14 8478.905
275.17 8481.11
275.22 8467.44
275.23 8466.825
275.27 8466.025
275.31 8478.045
275.37 8470.995
275.39 8519.065
275.43 8479.09
275.46 8505.515
275.5 8420.105
275.54 8512.81
275.56 8444.75
275.6 8490.74
275.64 8428.195
275.68 8445.06
275.7 8422.37
275.73 8446.035
275.77 8462.965
275.81 8380.86
275.85 8380.925
275.89 8399.075
275.93 8362.655
275.97 8439.905
276 8405.82
276.02 8425.99
276.06 8350.21
276.1 8420.9
276.14 8360.14
276.18 8375.775
276.2 8379.205
276.24 8325.435
276.27 8310.475
276.31 8332.3
276.35 8309.92
276.37 8348.545
276.41 8324.33
276.45 8349.775
276.49 8320.04
276.5 8273.01
276.54 8347.45
276.58 8315.375
276.62 8318.08
276.66 8260.5
276.68 8336.595
276.72 8279.265
276.76 8324.885
276.8 8270.805
276.82 8263.505
276.85 8276.685
276.89 8277.3
276.93 8220.465
276.97 8268.23
276.99 8241.68
277.03 8255.6
277.04 8252.595
277.09 8284.29
277.12 8216.725
277.16 8210.53
277.18 8209.855
277.22 8205.505
277.26 8193.605
277.28 8223.285
277.32 8205.195
277.36 8213.165
277.39 8177.055
277.41 8176.255
277.45 8150.015
277.49 8167.305
277.53 8131.125
277.54 8184.66
277.59 8148.665
277.62 8176.93
277.64 8117.455
277.68 8118.315
277.7 8126.775
277.74 8117.7
277.78 8112.915
277.82 8137.32
277.86 8126.775
277.87 8116.23
277.91 8122.485
277.93 8138.545
277.97 8105.99
278.01 8120.4
278.03 8146.825
278.07 8077.295
278.1 8081.585
278.14 8127.94
278.16 8094.215
278.2 8068.71
278.22 8084.47
278.26 8086.125
278.28 8082.565
278.32 8022.725
278.36 8018.31
278.4 8022.605
278.43 8013.59
278.45 8006.355
278.49 8005.745
278.51 8048.91
278.55 8046.695
278.57 8042.225
278.61 8010.095
278.64 8034.805
278.69 8027.08
278.7 7970.485
278.72 7971.65
278.76 8014.57
278.8 8013.465
278.84 8007.885
278.88 8005.8
278.9 7975.45
278.93 7966.19
278.96 7993.845
278.99 7939.645
279.01 7928.485
279.05 7926.77
279.07 7921.8
279.11 7920.27
279.15 7960.12
279.17 7955.4
279.2 7931.245
279.24 7949.58
279.26 7950.315
279.28 7923.705
279.32 7941.3
279.36 7896.17
279.38 7877.415
279.41 7950.375
279.44 7928.735
279.47 7896.97
279.51 7924.195
279.53 7887.1
279.55 7911.135
279.59 7902.49
279.63 7920.025
279.65 7847.98
279.69 7893.78
279.71 7892.925
279.74 7890.29
279.78 7883.42
279.8 7881.275
279.84 7874.955
279.86 7822.35
279.9 7813.46
279.92 7890.535
279.96 7850.865
279.97 7824.435
280.01 7830.565
280.03 7866.195
280.07 7842.83
280.11 7809.72
280.13 7810.03
280.15 7830.63
280.19 7853.74
280.22 7794.33
280.24 7798.99
280.26 7816.955
280.3 7838.475
280.34 7810.275
280.36 7812.11
280.37 7827.93
280.41 7768.76
280.45 7770.235
280.47 7769.25
280.49 7756.5
280.53 7801.195
280.55 7725.29
280.58 7721.55
280.6 7746.075
280.64 7723.94
280.66 7766.185
280.7 7783.48
280.72 7735.47
280.75 7738.045
280.78 7723.82
280.81 7694.63
280.83 7690.405
280.87 7738.225
280.89 7736.755
280.91 7753.555
280.95 7749.51
280.98 7752.205
281 7716.095
281.02 7725.9
281.06 7711.865
281.08 7683.105
281.12 7701.99
281.13 7683.105
281.17 7698.435
281.19 7694.755
281.23 7665.755
281.23 7692.425
281.27 7684.7
281.31 7697.33
281.32 7653.37
281.34 7653.8
281.38 7648.83
281.4 7644.17
281.44 7684.025
281.48 7689.79
281.48 7643.93
281.51 7636.755
281.53 7651.165
281.57 7625.105
281.59 7600.085
281.63 7618.235
281.65 7590.15
281.68 7584.45
281.7 7654.47
281.72 7609.9
281.76 7594.57
281.78 7588.065
281.82 7560.17
281.84 7567.28
281.85 7569.43
281.9 7549.38
281.91 7620.995
281.95 7571.755
281.97 7573.595
281.99 7601.68
282.03 7541.65
282.04 7570.1
282.07 7566.24
282.1 7586.535
282.12 7575.135
282.14 7594.505
282.18 7566.24
282.2 7566.18
282.21 7562.44
282.26 7544.045
282.27 7559.25
282.29 7555.63
282.33 7507.13
282.37 7571.575
282.39 7522.215
282.41 7517.925
282.43 7538.16
282.46 7552.2
282.48 7531.84
282.5 7502.35
282.52 7549.995
282.56 7519.765
282.58 7540.06
282.62 7520.19
282.63 7457.345
282.65 7461.64
282.69 7476.23
282.71 7456.305
282.73 7524.425
282.77 7521.91
282.79 7467.65
282.8 7465.69
282.84 7490.58
282.86 7491.44
282.88 7433.19
282.9 7425.035
282.94 7496.155
282.96 7495.055
282.99 7469.915
282.99 7443.67
283.03 7441.22
283.05 7456.675
283.09 7438.275
283.11 7431.105
283.13 7432.15
283.15 7448.085
283.18 7418.355
283.2 7465.75
283.22 7439.625
283.26 7437.175
283.28 7413.69
283.3 7405.6
283.32 7406.455
283.35 7433.99
283.38 7444.535
283.39 7396.095
283.43 7421.845
283.45 7384.015
283.47 7429.445
283.49 7429.57
283.52 7400.45
283.55 7395.605
283.56 7398.67
283.58 7392.965
283.62 7385.365
283.64 7380.335
283.66 7341.585
283.68 7358.935
283.72 7335.025
283.74 7380.58
283.75 7368.565
283.77 7373.47
283.81 7391.62
283.83 7366.725
283.85 7360.655
283.87 7356.365
283.89 7332.875
283.92 7356.24
283.94 7304.555
283.96 7302.095
283.98 7352.315
284.02 7345.94
284.04 7347.655
284.06 7289.895
284.1 7305.045
284.11 7281.745
284.13 7278.065
284.15 7297.745
284.17 7325.705
284.19 7297.13
284.23 7318.47
284.25 7265.065
284.27 7289.16
284.3 7330
284.3 7326.32
284.34 7301.425
284.36 7294.56
284.38 7296.765
284.4 7248.755
284.42 7264.64
284.46 7266.965
284.47 7305.655
284.5 7287.755
284.51 7281.44
284.53 7282.785
284.57 7275.67
284.59 7292.29
284.61 7227.11
284.63 7270.09
284.64 7242.195
284.69 7237.78
284.7 7221.715
284.72 7241.46
284.74 7231.895
284.76 7238.025
284.8 7255.995
284.82 7271.565
284.84 7269.235
284.86 7228.71
284.87 7247.165
284.89 7192.715
284.91 7208.96
284.95 7206.02
284.97 7249.86
284.99 7201.605
285.01 7205.165
285.03 7215.22
285.04 7214.85
285.08 7221.345
285.1 7190.015
285.12 7160.955
285.14 7230.055
285.16 7205.345
285.18 7201.73
285.2 7211.905
285.22 7226.87
285.23 7150.895
285.27 7219.02
285.29 7192.165
285.31 7166.84
285.33 7175.795
285.35 7182.535
285.37 7187.99
285.4 7134.16
285.4 7133.425
285.44 7177.385
285.46 7195.655
285.48 7195.475
285.5 7168.435
285.52 7140.41
285.54 7159.36
285.56 7162.545
285.59 7158.5
285.59 7109.7
285.63 7113.56
285.65 7102.03
285.67 7103.565
285.69 7125.085
285.71 7145.5
285.73 7141.76
285.75 7118.095
285.78 7133.42
285.78 7113.805
285.81 7121.285
285.84 7135.995
285.86 7077.325
285.88 7149.67
285.9 7119.565
285.92 7073.46
285.94 7073.15
285.95 7073.52
285.98 7138.33
285.99 7132.01
286.01 7088.97
286.03 7110.55
286.07 7128.275
286.07 7088.725
286.09 7080.14
286.12 7097.06
286.15 7045.255
286.15 7047.46
286.18 7049.915
286.2 7042.8
286.22 7062.73
286.24 7087.87
286.26 7059.355
286.28 7101.17
286.3 7031.395
286.32 7050.525
286.34 7074.135
286.35 7093.88
286.37 7068.74
286.39 7050.895
286.41 7060.275
286.43 7013.86
286.45 7012.265
286.47 7036.545
286.51 7055.25
286.51 7018.52
286.54 7031.03
286.56 7067.265
286.58 7045.93
286.6 7047.4
286.62 7041.635
286.64 7046.42
286.66 7013.74
286.68 7038.57
286.7 7008.095
286.71 7038.205
286.73 7004.05
286.75 7003.56
286.77 6983.815
286.79 7042.74
286.81 6995.285
286.83 6996.57
286.85 6989.15
286.87 6987.805
286.89 7033.055
286.9 7010.86
286.93 7009.81
286.94 7022.935
286.96 6961.99
286.98 6977.625
287 6974.68
287.02 6946.17
287.04 6976.03
287.06 7000.805
287.07 6984.98
287.1 6971.245
287.11 6983.02
287.13 6982.655
287.15 6973.825
287.17 6936.54
287.19 6933.11
287.21 6949.545
287.23 6942.615
287.25 6992.835
287.27 6919.865
287.29 6967.875
287.29 6961.435
287.32 6985.84
287.34 6963.335
287.36 6939.73
287.38 6939.735
287.38 6957.145
287.4 6912.2
287.42 6911.71
287.44 6906.315
287.46 6905.275
287.47 6950.77
287.49 6967.875
287.51 6964.135
287.53 6925.875
287.55 6920.785
287.57 6895.52
287.59 6910.115
287.61 6886.575
287.63 6889.515
287.65 6903.25
287.66 6883.995
287.68 6904.54
287.7 6923.73
287.7 6874.25
287.74 6877.255
287.76 6871.92
287.78 6868.73
287.78 6915.76
287.8 6915.145
287.82 6887.245
287.83 6930.225
287.85 6859.23
287.87 6903.435
287.89 6881.605
287.91 6876.58
287.93 6901.535
287.95 6854.685
287.97 6869.83
287.99 6872.775
288.01 6893.44
288.01 6864.315
288.02 6883.325
288.04 6857.69
288.06 6885.285
288.08 6836.475
288.1 6885.715
288.12 6872.53
288.14 6851.38
288.16 6857.755
288.18 6852.545
288.19 6825.38
288.19 6843.895
288.21 6871.855
288.24 6882.65
288.25 6884.92
288.27 6841.75
288.29 6839.18
288.31 6829.305
288.33 6835.56
288.35 6810.48
288.35 6829.43
288.37 6858.06
288.38 6866.95
288.41 6849.05
288.42 6841.015
288.44 6819.985
288.46 6842.06
288.48 6844.33
288.5 6855.61
288.5 6795.89
288.52 6795.95
288.54 6860.695
288.55 6821.33
288.58 6801.71
288.6 6784.305
288.61 6859.045
288.63 6836.54
288.65 6826.485
288.65 6802.82
288.67 6788.78
288.69 6803.31
288.71 6791.84
288.73 6779.09
288.75 6783.505
288.77 6808.825
288.77 6806.37
288.78 6754.565
288.8 6768.85
288.82 6796.5
288.84 6800.365
288.86 6786.26
288.86 6808.21
288.88 6787.245
288.9 6744.57
288.92 6773.205
288.94 6750.58
288.96 6741.44
288.96 6759.165
288.97 6799.81
288.99 6787.245
289.01 6762.595
289.03 6802.575
289.05 6776.945
289.07 6730.955
289.09 6731.2
289.09 6747.755
289.11 6728.44
289.13 6791.165
289.14 6744.935
289.14 6765.235
289.16 6765.11
289.18 6768.235
289.2 6713.725
289.22 6721.635
289.22 6714.77
289.24 6758.425
289.26 6736.415
289.28 6756.52
289.3 6728.935
289.31 6750.145
289.33 6722.865
289.33 6727.16
289.36 6721.39
289.37 6767.07
289.39 6759.465
289.41 6737.025
289.43 6737.275
289.43 6698.83
289.45 6693.62
289.47 6712.195
289.49 6684.97
289.5 6728.135
289.5 6734.695
289.53 6726.48
289.54 6725.56
289.56 6727.465
289.56 6724.21
289.58 6744.755
289.6 6695.76
289.62 6717.53
289.64 6740.46
289.64 6673.135
289.66 6693.925
289.67 6712.26
289.7 6712.56
289.72 6735.555
289.72 6706.185
289.73 6685.4
289.75 6704.47
289.77 6703.245
289.77 6661.24
289.79 6703.185
289.81 6677.8
289.83 6672.83
289.85 6674.735
289.85 6696.99
289.87 6692.575
289.89 6686.075
289.9 6662.96
289.92 6691.53
289.92 6691.1
289.94 6659.895
289.96 6661.73
289.98 6703.06
289.98 6660.57
290 6682.395
290.02 6679.085

1 個回答

0
dansnow
iT邦新手 5 級 ‧ 2018-10-13 21:31:08
最佳解答

底下是節錄部份的程式碼:

with open("檔名", "w") as f:
    for i in range(0,len(R1)) :
        r1 = R1[i,1]
        r2 = R2[i,1]
        T = R1[i,0]
        # Driver program to test above
        r0 = r2*d # Initial values assumed 
        newtonRaphson(r0,r1,r2)
        f.write("{} {} {} {}\n".format(T,r1, r2,resistivity))

這樣應該就能寫檔了,你要把 write 的部份放到迴圈去才會把每一筆都輸出

wendyduke iT邦新手 5 級 ‧ 2018-10-13 22:22:05 檢舉

temperature = 150.21
The value of the root is : 12904717.0902160592
resistivity unit is ohm-cm : 1.2904717090216058
Traceback (most recent call last):
File "C:\Python35-32\van der puaw main program", line 38, in
f.write("{} {} {} {}\n".format(T,r1, r2,resistivity))
NameError: name 'resistivity' is not defined

resistivity這東西要在

Function to find the root

def newtonRaphson( r,r1,r2 ):
#if derivFunc(x) > 0:
h = func(r,r1,r2) / derivFunc(r,r1,r2)
while abs(h) >= 0.00001:
h = func(r,r1,r2)/derivFunc(r,r1,r2)
下面才找的到

wendyduke iT邦新手 5 級 ‧ 2018-10-13 22:29:48 檢舉

好囉感激您

我要發表回答

立即登入回答