Updated material on Boltzmann Machines
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 37 KiB |
@@ -0,0 +1,100 @@
|
||||
1 5.59097
|
||||
2 5.38551
|
||||
3 5.14253
|
||||
4 4.92049
|
||||
5 4.80505
|
||||
6 4.62185
|
||||
7 4.48617
|
||||
8 4.40662
|
||||
9 4.2445
|
||||
10 4.17527
|
||||
11 4.09137
|
||||
12 4.0624
|
||||
13 3.96858
|
||||
14 3.92182
|
||||
15 3.85881
|
||||
16 3.82252
|
||||
17 3.76908
|
||||
18 3.73743
|
||||
19 3.69007
|
||||
20 3.62217
|
||||
21 3.63773
|
||||
22 3.58399
|
||||
23 3.57401
|
||||
24 3.53176
|
||||
25 3.51544
|
||||
26 3.48965
|
||||
27 3.4685
|
||||
28 3.45745
|
||||
29 3.44185
|
||||
30 3.43143
|
||||
31 3.40337
|
||||
32 3.38956
|
||||
34 3.37394
|
||||
35 3.35488
|
||||
36 3.29924
|
||||
37 3.2945
|
||||
38 3.2913
|
||||
39 3.29587
|
||||
40 3.28508
|
||||
41 3.27126
|
||||
42 3.25836
|
||||
43 3.24323
|
||||
44 3.24687
|
||||
45 3.21526
|
||||
46 3.2367
|
||||
47 3.23167
|
||||
48 3.21595
|
||||
49 3.21003
|
||||
50 3.18076
|
||||
51 3.18035
|
||||
52 3.18534
|
||||
53 3.15874
|
||||
54 3.17502
|
||||
55 3.14463
|
||||
56 3.17313
|
||||
57 3.16107
|
||||
58 3.13238
|
||||
59 3.1367
|
||||
60 3.15066
|
||||
61 3.11037
|
||||
62 3.11367
|
||||
63 3.10958
|
||||
64 3.10312
|
||||
65 3.09725
|
||||
66 3.09705
|
||||
67 3.09602
|
||||
68 3.08657
|
||||
69 3.09206
|
||||
70 3.0703
|
||||
71 3.07878
|
||||
72 3.10305
|
||||
73 3.06263
|
||||
74 3.06851
|
||||
75 3.09004
|
||||
76 3.0673
|
||||
77 3.05662
|
||||
78 3.047
|
||||
79 3.04692
|
||||
80 3.06387
|
||||
81 3.06418
|
||||
82 3.06383
|
||||
83 3.04044
|
||||
84 3.06274
|
||||
85 3.04205
|
||||
86 3.04167
|
||||
87 3.04238
|
||||
88 3.04487
|
||||
89 3.02483
|
||||
90 3.05472
|
||||
91 3.02654
|
||||
92 3.03249
|
||||
93 .04819
|
||||
94 3.03152
|
||||
95 3.03445
|
||||
96 3.03407
|
||||
97 3.02488
|
||||
98 3.00511
|
||||
99 3.01687
|
||||
100 3.03151
|
||||
1001 3.03374
|
||||
|
After Width: | Height: | Size: 268 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 60 KiB |
@@ -0,0 +1,14 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from IPython.display import display
|
||||
|
||||
data = np.loadtxt('RMBenergy.dat')
|
||||
x = data[:,0]
|
||||
y = data[:,1]
|
||||
plt.plot(x, y,'ro')
|
||||
plt.axis([0,101,3, 5.5])
|
||||
plt.xlabel(r'Iterations')
|
||||
plt.ylabel(r'Energy')
|
||||
plt.savefig('MLrbm.pdf')
|
||||
plt.show()
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
||||
|
||||
try:
|
||||
dataFileName = sys.argv[1]
|
||||
except IndexError:
|
||||
print("USAGE: python plotEnergies.py 'filename'")
|
||||
sys.exit(0)
|
||||
|
||||
HFEnergy3 = 3.161921401722216
|
||||
HFEnergy6 = 20.71924844033019
|
||||
|
||||
numParticles = \
|
||||
int(dataFileName[dataFileName.find('N')+1:dataFileName.find('E')-1])
|
||||
hfenergyFound = False
|
||||
if (numParticles == 2):
|
||||
HFEnergy = 3.161921401722216
|
||||
hfenergyFound = True
|
||||
elif (numParticles == 6):
|
||||
HFEnergy = 20.71924844033019
|
||||
hfenergyFound = True
|
||||
else:
|
||||
hfenergyFound = False
|
||||
|
||||
data = np.loadtxt(dataFileName, dtype=np.float64)
|
||||
data[:,1] = np.sqrt(data[:,1])
|
||||
|
||||
n = len(data[:,0])
|
||||
x = np.arange(0,n)
|
||||
|
||||
fig = plt.figure()
|
||||
|
||||
if (hfenergyFound):
|
||||
yline = np.zeros(n)
|
||||
yline.fill(HFEnergy)
|
||||
plt.plot(x, yline, 'r--', label="HF Energy")
|
||||
|
||||
msize = 1.0
|
||||
|
||||
ax = fig.add_subplot(111)
|
||||
plt.errorbar(x, data[:,0], yerr=data[:,1], fmt='bo', markersize=msize, label="VMC Energy")
|
||||
plt.fill_between(x, data[:,0]-data[:,1], data[:,0]+data[:,1])
|
||||
|
||||
plt.xlim(0,n)
|
||||
plt.xlabel('Iteration')
|
||||
plt.ylabel('$E_0[a.u]$')
|
||||
plt.legend(loc='best')
|
||||
|
||||
minSub = 80
|
||||
maxSub = 120
|
||||
inset_axes(ax, width="50%", height=1.0, loc='right')
|
||||
plt.errorbar(x[minSub:maxSub], data[minSub:maxSub,0],
|
||||
yerr=data[minSub:maxSub,1], fmt='bo', markersize=msize, label="VMC "
|
||||
"Energy")
|
||||
plt.plot(x[minSub:maxSub], yline[minSub:maxSub], 'r--', label="HF Energy")
|
||||
|
||||
plt.show()
|
||||
@@ -0,0 +1,177 @@
|
||||
3.8718410926477924 0.0000147059038380
|
||||
3.6953233621413557 0.0000102929382114
|
||||
3.6044928743975535 0.0000079081842488
|
||||
3.5128938682886837 0.0000065801975909
|
||||
3.4305256282797747 0.0000054245263200
|
||||
3.3288413622175166 0.0000049216555869
|
||||
3.2749958564532178 0.0000040637553139
|
||||
3.1479572957101820 0.0000038378828037
|
||||
3.1166899087959297 0.0000033396470865
|
||||
3.1104374796656726 0.0000031163210772
|
||||
3.0606069933639453 0.0000030060257254
|
||||
3.0731542020730780 0.0000027733456045
|
||||
3.0717634285517534 0.0000026805679201
|
||||
3.0611410467603375 0.0000025875489649
|
||||
3.0665725439213904 0.0000024893399112
|
||||
3.0633403772301970 0.0000024700907123
|
||||
3.0698475324707268 0.0000027151319575
|
||||
3.0595655087047806 0.0000024720813897
|
||||
3.0553873289853177 0.0000028477207669
|
||||
3.0482899477099306 0.0000023673705900
|
||||
3.0542896266235471 0.0000023862592235
|
||||
3.0540749874587165 0.0000025012906406
|
||||
3.0576543799651414 0.0000026345634664
|
||||
3.0573563182115611 0.0000025360265151
|
||||
3.0538285550369504 0.0000024987295204
|
||||
3.0612964387462811 0.0000024534453275
|
||||
3.0549113307526508 0.0000021701370858
|
||||
3.0497337277819891 0.0000023035159445
|
||||
3.0358832197758638 0.0000019074339292
|
||||
3.0526087579258752 0.0000020906726490
|
||||
3.0375404267896444 0.0000018193957347
|
||||
3.0296868013420966 0.0000016988150204
|
||||
3.0340171364975270 0.0000017070755647
|
||||
3.0270393868514955 0.0000015323958444
|
||||
3.0335664276765724 0.0000016777245585
|
||||
3.0295458263713861 0.0000016859761512
|
||||
3.0362600723382949 0.0000016968640028
|
||||
3.0299695102215471 0.0000016519869787
|
||||
3.0307958844793799 0.0000015856243614
|
||||
3.0327702873766618 0.0000017547162663
|
||||
3.0368048878658098 0.0000016123312494
|
||||
3.0327812834421524 0.0000016199176026
|
||||
3.0291993280375706 0.0000015252728930
|
||||
3.0243017589539227 0.0000014941086534
|
||||
3.0388257490049781 0.0000015966548859
|
||||
3.0288937431672065 0.0000015402788000
|
||||
3.0332840884145367 0.0000014852116533
|
||||
3.0305388790845895 0.0000014087857225
|
||||
3.0160492528984681 0.0000013413147555
|
||||
3.0228315043770833 0.0000013108364236
|
||||
3.0319159622546947 0.0000014942838085
|
||||
3.0245994503305611 0.0000012819874421
|
||||
3.0245406110342263 0.0000011617983732
|
||||
3.0221149417268545 0.0000011861898809
|
||||
3.0266309203103892 0.0000010971382379
|
||||
3.0213956659444619 0.0000009815865090
|
||||
3.0266044839647375 0.0000008475062073
|
||||
3.0171339022137031 0.0000009491125221
|
||||
3.0137137665587970 0.0000009047766596
|
||||
3.0204243038235696 0.0000009204940437
|
||||
3.0149550294803293 0.0000007241831125
|
||||
3.0184897306036023 0.0000007608046522
|
||||
3.0174560678287494 0.0000007444663449
|
||||
3.0117358405691466 0.0000006697194350
|
||||
3.0137686357569442 0.0000006493989681
|
||||
3.0197874903595676 0.0000006594837851
|
||||
3.0211393564928861 0.0000005273643816
|
||||
3.0088502364778984 0.0000006750242945
|
||||
3.0141869057980486 0.0000006604497524
|
||||
3.0084178966040751 0.0000006011783643
|
||||
3.0103703343473431 0.0000006332729341
|
||||
3.0114501225948129 0.0000006078075993
|
||||
3.0112868967213990 0.0000005130309910
|
||||
3.0133892246029368 0.0000004850027332
|
||||
3.0127600060080049 0.0000005121383448
|
||||
3.0132033058749772 0.0000005202670392
|
||||
3.0174838683532705 0.0000004511805009
|
||||
3.0074649653881833 0.0000004767011548
|
||||
3.0147189641940666 0.0000005026414881
|
||||
3.0031494490708743 0.0000004068197790
|
||||
3.0127269836701625 0.0000003517622533
|
||||
3.0117160632855131 0.0000004807107729
|
||||
3.0104068668466173 0.0000004340980291
|
||||
3.0095190754722245 0.0000004525035764
|
||||
3.0083426819236312 0.0000003442988162
|
||||
3.0096297561121181 0.0000003509484677
|
||||
3.0084950447655525 0.0000003426881327
|
||||
3.0000334241795148 0.0000002822486656
|
||||
3.0074200494698378 0.0000002470051234
|
||||
3.0045168865889322 0.0000002979026886
|
||||
3.0088303350153422 0.0000002777889961
|
||||
3.0092362767849465 0.0000002481732395
|
||||
3.0036101232401404 0.0000002217541772
|
||||
3.0130254319442749 0.0000002113227663
|
||||
3.0074375628933665 0.0000002051131924
|
||||
3.0039215527299699 0.0000001812862961
|
||||
3.0039203843331075 0.0000001726295733
|
||||
3.0035107386928650 0.0000001519175758
|
||||
3.0052148548142990 0.0000001558437889
|
||||
3.0032679964994404 0.0000001249104454
|
||||
3.0029150927912411 0.0000001429330469
|
||||
3.0050978211203274 0.0000001190355909
|
||||
3.0025941745527387 0.0000001221198387
|
||||
3.0040359658796429 0.0000001232553598
|
||||
3.0037708875467368 0.0000001072262769
|
||||
3.0019741648816156 0.0000001005884615
|
||||
3.0027048136174459 0.0000001048064246
|
||||
3.0056791179955855 0.0000001004795678
|
||||
3.0053973663716054 0.0000000983704665
|
||||
3.0034105594872620 0.0000000952215313
|
||||
3.0040453907229576 0.0000000992197959
|
||||
3.0027300002454198 0.0000000817973448
|
||||
3.0035048664440449 0.0000000831022963
|
||||
3.0052055251459708 0.0000000689818501
|
||||
3.0021717615084489 0.0000000714786128
|
||||
3.0022585367578407 0.0000000643697570
|
||||
2.9999596965540722 0.0000000612636068
|
||||
3.0036454745975694 0.0000000611764064
|
||||
3.0042537057862164 0.0000000684805862
|
||||
3.0026231380135662 0.0000000556670465
|
||||
3.0019023156210940 0.0000000587920986
|
||||
3.0018312332595007 0.0000000525268288
|
||||
3.0046803565066358 0.0000000495684146
|
||||
3.0039420051045256 0.0000000517348120
|
||||
3.0023661582808066 0.0000000450910055
|
||||
3.0016773040560589 0.0000000475849908
|
||||
2.9989155310696156 0.0000000428850687
|
||||
3.0011295769327293 0.0000000474088904
|
||||
3.0011467393513471 0.0000000434068403
|
||||
3.0036140942752185 0.0000000431096735
|
||||
3.0016422267899725 0.0000000434176414
|
||||
3.0011370281054712 0.0000000409363393
|
||||
3.0027556596025762 0.0000000366148094
|
||||
3.0011199939040312 0.0000000358161799
|
||||
3.0031129504788021 0.0000000314366619
|
||||
3.0006091557288341 0.0000000313214127
|
||||
3.0021039093404744 0.0000000295876655
|
||||
3.0004037527984964 0.0000000291098892
|
||||
3.0024899558606202 0.0000000298367581
|
||||
3.0005867340853629 0.0000000278588439
|
||||
3.0003237974577956 0.0000000288483374
|
||||
3.0015755779735982 0.0000000282119872
|
||||
2.9996426017446152 0.0000000314252808
|
||||
3.0015175332214015 0.0000000255734646
|
||||
3.0029559835366615 0.0000000441114480
|
||||
3.0017055489141331 0.0000000252613320
|
||||
3.0004657536104569 0.0000000238440008
|
||||
3.0007308805814197 0.0000000229698724
|
||||
3.0005829294800797 0.0000000215497569
|
||||
3.0009965426322509 0.0000000256788947
|
||||
3.0006178214036017 0.0000000239245629
|
||||
3.0022985255473720 0.0000000218002184
|
||||
3.0006775587653833 0.0000000224134054
|
||||
3.0009719234649288 0.0000000216724793
|
||||
3.0009062774589368 0.0000000221097629
|
||||
3.0015732615498312 0.0000000193518707
|
||||
2.9996780242140377 0.0000000194629075
|
||||
3.0018716176896825 0.0000000191384773
|
||||
3.0010978534898918 0.0000000175640263
|
||||
3.0007862430756465 0.0000000177714381
|
||||
3.0010368837079127 0.0000000171020312
|
||||
3.0015116855075781 0.0000000200078325
|
||||
2.9999734295894744 0.0000000165663988
|
||||
2.9998274689286517 0.0000000181649371
|
||||
3.0002407706284853 0.0000000173203622
|
||||
3.0012417709345547 0.0000000169858376
|
||||
3.0026874674355941 0.0000000169332722
|
||||
3.0015445555953710 0.0000000145238279
|
||||
3.0012754992208737 0.0000000140892091
|
||||
3.0018092612361542 0.0000000128526873
|
||||
3.0011082128468711 0.0000000112858644
|
||||
3.0010617580509251 0.0000000103830880
|
||||
3.0000913072497983 0.0000000105323196
|
||||
3.0002018295376280 0.0000000103056312
|
||||
3.0016440395541517 0.0000000106149625
|
||||
3.0003337702616162 0.0000000113166999
|
||||
2.9999434766407251 0.0000000122985347
|
||||
@@ -0,0 +1,164 @@
|
||||
26.3997295427311869 0.0000432234318622
|
||||
26.2385159782425141 0.0000438635333612
|
||||
22.3592885357977629 0.0000322373266503
|
||||
22.0244677358107417 0.0000263858363470
|
||||
21.9269310476547794 0.0000261200003468
|
||||
21.7144452787047122 0.0000248563043285
|
||||
21.3701604175061171 0.0000197056800652
|
||||
21.4787494084378210 0.0000203724059472
|
||||
21.3797187586678419 0.0000218583901955
|
||||
21.3246138745372207 0.0000131842522837
|
||||
21.0912701668367397 0.0000099065535238
|
||||
21.0119821084624938 0.0000133196077506
|
||||
21.1474890442610111 0.0000128070400784
|
||||
21.1233036931878431 0.0000121193291832
|
||||
20.9890540730367405 0.0000145890387069
|
||||
20.9761555691721604 0.0000151465441097
|
||||
20.8417860976805684 0.0000087264636813
|
||||
20.9350957491539447 0.0000103090474697
|
||||
20.9023936251027962 0.0000096787288490
|
||||
20.8319494237505687 0.0000081040741908
|
||||
20.8122652112419182 0.0000068364931517
|
||||
20.7704023573448886 0.0000059845585617
|
||||
20.7981112052692936 0.0000062674068241
|
||||
20.6419476231995098 0.0000053528692441
|
||||
20.6580103526388541 0.0000053238298005
|
||||
20.6520896222411814 0.0000057438491940
|
||||
20.6131109423281487 0.0000047682455278
|
||||
20.6544623892670423 0.0000065860795751
|
||||
20.6704139252605827 0.0000049330551523
|
||||
20.6346131185617203 0.0000047588540559
|
||||
20.5974811001915405 0.0000046113432124
|
||||
20.6229486203467758 0.0000044396925222
|
||||
20.6062468146155169 0.0000043703136466
|
||||
20.6148200900137475 0.0000040938622567
|
||||
20.5662287456182789 0.0000042234241009
|
||||
20.6114316677022487 0.0000035137276381
|
||||
20.6072329120355313 0.0000038647506648
|
||||
20.6210166040993137 0.0000042464577960
|
||||
20.6084269536897189 0.0000037357408530
|
||||
20.5752638954871649 0.0000037976090521
|
||||
20.5932650245921778 0.0000036239420656
|
||||
20.6067081280884459 0.0000037188745484
|
||||
21.0993654677212561 0.0000106878524495
|
||||
20.8026193126692078 0.0000074620982730
|
||||
20.6334950709818052 0.0000064732418627
|
||||
20.6853612089283594 0.0000068181326073
|
||||
20.5765440911259461 0.0000053864940205
|
||||
20.6122643088333071 0.0000062846246316
|
||||
20.6614753438880179 0.0000224939673674
|
||||
20.6175965199892985 0.0000057001323781
|
||||
20.6229701929922413 0.0000059517681708
|
||||
20.6146232259142899 0.0000053887117481
|
||||
20.5696458297736555 0.0000060004874845
|
||||
20.5946202339618587 0.0000057677261977
|
||||
20.6075008141421243 0.0000056070546714
|
||||
20.5829189176641663 0.0000064331033843
|
||||
20.5598253313843919 0.0000051962117495
|
||||
20.5550821424227195 0.0000062257775280
|
||||
20.6022472342768950 0.0000058265716231
|
||||
20.6004933121799034 0.0000055440389030
|
||||
20.6252361890981639 0.0000056473544815
|
||||
20.5561922547165032 0.0000066562438911
|
||||
21.2564436143909568 0.0000093659581145
|
||||
21.2399863198941539 0.0000093821903262
|
||||
21.1270071183716794 0.0000146940309869
|
||||
20.9857107263791427 0.0000112458549337
|
||||
20.7337913724704102 0.0000081536530550
|
||||
20.6619750735355225 0.0000062105770727
|
||||
20.6132756402740291 0.0000057985784831
|
||||
20.6133314363765479 0.0000048906485747
|
||||
20.6229830149404414 0.0000064571197197
|
||||
20.6159488288018196 0.0000050029211053
|
||||
20.6321315446391296 0.0000038519746625
|
||||
20.5762124469568128 0.0000038217569248
|
||||
20.5544932676653751 0.0000034541921715
|
||||
20.5677585574281601 0.0000042398557612
|
||||
20.5587696556494848 0.0000045083067127
|
||||
20.5382737230544130 0.0000031140849710
|
||||
20.5130839639107059 0.0000034759014745
|
||||
20.5371006423120619 0.0000035185936564
|
||||
20.5697692966231394 0.0000035847214896
|
||||
20.5741629862752511 0.0000036577053812
|
||||
20.5945859103316025 0.0000029491183283
|
||||
20.5750879016805754 0.0000032441567047
|
||||
20.5826087255368400 0.0000032788720747
|
||||
20.6141816588704856 0.0000031135335851
|
||||
20.5940682793037944 0.0000035973169533
|
||||
20.6210323256096153 0.0000030294005909
|
||||
20.6136564649873648 0.0000036305200322
|
||||
20.6053919341159641 0.0000034256261921
|
||||
20.6096732032146015 0.0000036157518351
|
||||
20.6046431292516345 0.0000047231934518
|
||||
20.6534729237593417 0.0000032264527930
|
||||
20.5968573790427918 0.0000025498884612
|
||||
20.6010537078066740 0.0000027953652814
|
||||
20.6296209353361988 0.0000033523977539
|
||||
20.6255158284164644 0.0000036537766466
|
||||
20.6117414296065924 0.0000031851026908
|
||||
20.6328648653271216 0.0000026694281725
|
||||
20.5588793626501634 0.0000027609851782
|
||||
20.5797653966173471 0.0000027935504847
|
||||
20.5740348746840063 0.0000028939972522
|
||||
20.5638785335988814 0.0000030962144476
|
||||
20.5642608753059477 0.0000029288281310
|
||||
20.5628008233625046 0.0000023714027674
|
||||
20.5367956985361850 0.0000025939719434
|
||||
20.5423169783295982 0.0000027501957673
|
||||
20.5455062233131081 0.0000029339440703
|
||||
20.5544437840613696 0.0000025895718660
|
||||
20.5545184112903421 0.0000025273486095
|
||||
20.5390997576117371 0.0000023601016132
|
||||
20.5449121020005521 0.0000023171332877
|
||||
20.5482014379555586 0.0000029098452243
|
||||
20.5458893550763406 0.0000023532957772
|
||||
20.5564278839372676 0.0000025821008989
|
||||
20.5405394158482970 0.0000034503967969
|
||||
20.5781084940649066 0.0000026378036663
|
||||
20.5620961581145920 0.0000024711566304
|
||||
20.5186335239220270 0.0000021890144216
|
||||
20.5779323788908854 0.0000027066770518
|
||||
20.5800468430124504 0.0000024226585928
|
||||
20.5697990124282306 0.0000028639734343
|
||||
21.7398048727299162 0.0000131946033440
|
||||
20.6982292363868083 0.0000065326814483
|
||||
20.6091911916732649 0.0000055382304768
|
||||
20.5834564036242895 0.0000045107353305
|
||||
20.5781003948228509 0.0000058091668757
|
||||
20.5659495070103162 0.0000048621584759
|
||||
20.5574168510810402 0.0000048395156425
|
||||
20.5382735167236490 0.0000042307200679
|
||||
20.5695976677201315 0.0000047019592801
|
||||
20.5992758321836824 0.0000057296171668
|
||||
20.5566263905080540 0.0000043802958160
|
||||
20.5942989619961843 0.0000050217297184
|
||||
20.5959440189899077 0.0000044689686265
|
||||
20.5931287019641331 0.0000042813489572
|
||||
20.5907194370727851 0.0000046975971827
|
||||
20.5586946014137339 0.0000049834716987
|
||||
20.5817563637642671 0.0000049879666945
|
||||
20.5643446819219413 0.0000044111101476
|
||||
20.5510734678465177 0.0000056017852816
|
||||
20.5973485546631139 0.0000046230146720
|
||||
20.5932253977651989 0.0000051582797571
|
||||
20.5779893368105640 0.0000055575343303
|
||||
20.6113993505314390 0.0000044383610056
|
||||
20.5987600829670221 0.0000048782939242
|
||||
20.5947873900366751 0.0000050856393350
|
||||
20.5588639054899929 0.0000050714799634
|
||||
20.5949536643329836 0.0000051099692616
|
||||
20.5704784711153508 0.0000042810288945
|
||||
20.5975137180971650 0.0000058391414790
|
||||
20.5452492022936930 0.0000046608725858
|
||||
20.5669439415781490 0.0000049830446496
|
||||
20.6335521716793480 0.0000046144492603
|
||||
20.5638810257340126 0.0000039096450386
|
||||
20.6051042593020171 0.0000050314968488
|
||||
20.5952826593208194 0.0000048466091870
|
||||
20.5840129254583317 0.0000049386436539
|
||||
20.5622424462287334 0.0000047054311204
|
||||
20.5364652378096295 0.0000054576819159
|
||||
20.6199917186743171 0.0000046400213180
|
||||
20.5850044296868262 0.0000045104364483
|
||||
20.6067500420065883 0.0000047907162541
|
||||
20.5942250212876736 0.0000045392646495
|
||||
@@ -0,0 +1,22 @@
|
||||
Year,Hares (x1000),Lynx (x1000)
|
||||
1900,30.0,4.0
|
||||
1901,47.2,6.1
|
||||
1902,70.2,9.8
|
||||
1903,77.4,35.2
|
||||
1904,36.3,59.4
|
||||
1905,20.6,41.7
|
||||
1906,18.1,19.0
|
||||
1907,21.4,13.0
|
||||
1908,22.0,8.3
|
||||
1909,25.4,9.1
|
||||
1910,27.1,7.4
|
||||
1911,40.3,8.0
|
||||
1912,57,12.3
|
||||
1913,76.6,19.5
|
||||
1914,52.3,45.7
|
||||
1915,19.5,51.1
|
||||
1916,11.2,29.7
|
||||
1917,7.6,15.8
|
||||
1918,14.6,9.7
|
||||
1919,16.2,10.1
|
||||
1920,24.7,8.6
|
||||
|
@@ -0,0 +1,43 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def solver(m, H0, L0, dt, a, b, c, d, t0):
|
||||
"""Solve the difference equations for H and L over m years
|
||||
with time step dt (measured in years."""
|
||||
|
||||
num_intervals = int(m/float(dt))
|
||||
t = np.linspace(t0, t0 + m, num_intervals+1)
|
||||
H = np.zeros(t.size)
|
||||
L = np.zeros(t.size)
|
||||
|
||||
print('Init:', H0, L0, dt)
|
||||
H[0] = H0
|
||||
L[0] = L0
|
||||
|
||||
for n in range(0, len(t)-1):
|
||||
H[n+1] = H[n] + a*dt*H[n] - b*dt*H[n]*L[n]
|
||||
L[n+1] = L[n] + d*dt*H[n]*L[n] - c*dt*L[n]
|
||||
return H, L, t
|
||||
|
||||
# Load in data file
|
||||
data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
|
||||
# Make arrays containing x-axis and hares and lynx populations
|
||||
t_e = data[:,0]
|
||||
H_e = data[:,1]
|
||||
L_e = data[:,2]
|
||||
|
||||
# Simulate using the model
|
||||
H, L, t = solver(m=20, H0=34.91, L0=3.857, dt=0.1,
|
||||
a=0.4807, b=0.02482, c=0.9272, d=0.02756,
|
||||
t0=1900)
|
||||
|
||||
# Visualize simulations and data
|
||||
plt.plot(t_e, H_e, 'b-+', t_e, L_e, 'r-o', t, H, 'm--', t, L, 'k--')
|
||||
plt.xlabel('Year')
|
||||
plt.ylabel('Numbers of hares and lynx')
|
||||
plt.axis([1900, 1920, 0, 140])
|
||||
plt.title(r'Population of hares and lynx 1900-1920 (x1000)')
|
||||
plt.legend(('H_e', 'L_e', 'H', 'L'), loc='upper left')
|
||||
plt.savefig('Hudson_Bay_sim.pdf')
|
||||
plt.savefig('Hudson_Bay_sim.png')
|
||||
plt.show()
|
||||
|
After Width: | Height: | Size: 66 KiB |