commit cc1c1a9130432fb964df0fcc805ef199230244dc Author: Michael Bradley Date: Sat Oct 7 16:52:20 2023 -0400 Basic working implementation diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d33777d --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.idea/ +__pycache__/ +venv/ +env/ +.venv/ +.env/ diff --git a/data.py b/data.py new file mode 100644 index 0000000..2355115 --- /dev/null +++ b/data.py @@ -0,0 +1,62 @@ +import matplotlib.animation as animation +import matplotlib.cm as cm +import matplotlib.pyplot as plt +import numpy as np + +from physics import n_body + + +def parse_csv(filename: str): + with open(filename, 'r') as file: + lines = file.read().strip().splitlines() + pos = np.zeros((len(lines), 2)) + vel = np.zeros((len(lines), 2)) + rad = np.zeros((len(lines),)) + for i, [x, y, vx, vy, r] in enumerate(map(lambda l: map(float, l.split(',')), lines)): + pos[i] = [x, y] + vel[i] = [vx, vy] + rad[i] = r + return pos, vel, rad + + +class Animator: + def __init__(self, pos: np.ndarray, vel: np.ndarray, rad: np.ndarray): + self.pos = pos + self.vel = vel + self.rad = rad + self.mass = np.pi * 4 / 3 * rad ** 3 + + self.scat = None + self.colours = cm.rainbow( + np.random.random( + (len(self.rad),) + ) + ) + + self.fig, self.ax = plt.subplots() + self.ani = animation.FuncAnimation( + self.fig, + self.update, + interval=1000/120, + init_func=self.setup_plot, + blit=True, + cache_frame_data=False + ) + + def setup_plot(self): + self.scat = self.ax.scatter( + self.pos[:, 0], + self.pos[:, 1], + c=self.colours, + s=self.rad * 10 + ) + self.ax.axis([-950, 950, -500, 500]) + return self.scat, + + def update(self, *_args, **_kwargs): + n_body(self.pos, self.vel, self.mass) + self.scat.set_offsets(self.pos) + return self.scat, + + def show(self): + plt.show() diff --git a/data/many.csv b/data/many.csv new file mode 100644 index 0000000..e1ce39c --- /dev/null +++ b/data/many.csv @@ -0,0 +1,701 @@ +0,0,0,0,10 +-144,-180,2.721283507566846,1.6983172406283744,0.6974150898132044 +-388,272,1.1681442229833778,0.9618586043441009,0.6774241440457135 +226,-182,1.317066490947259,2.3057208752585145,0.10081293943058078 +245,-290,1.5378073422819836,2.846933224732987,0.10384190556003337 +180,18,2.580954797712914,2.3353462701407866,0.750913050157302 +-127,-105,1.3203701968900767,0.9377952184862997,0.18735990778348022 +71,149,2.108904535768226,2.479941745040329,0.488214596240956 +-100,144,1.2169614125107748,1.1757737589995598,0.3821532328537882 +272,-132,1.2765463514952948,2.8586546040746734,0.12055179811580707 +112,-217,1.5074027808404904,1.394474041847111,0.8108585019055262 +-201,-203,1.672028010548228,0.5725342820201352,0.6721646513870266 +-7,-31,0.9225962897448765,0.8101999757201279,0.39745826548004215 +286,133,0.9365254972449035,2.1093022969795387,0.2881137126113388 +70,300,2.9190977931240867,1.8203738957281321,0.3044957951593915 +-369,-55,0.8622722368060238,0.5691791090536188,0.40278271060053095 +51,-2,1.6689523038632885,1.989148892076607,0.3639296414798262 +4,-319,1.0482017895390814,2.704895067256099,0.9012104494599806 +381,287,2.3395116134543845,2.2330209761522974,0.4350178699888295 +-360,54,1.1929925268329504,2.326875768931954,0.46303326431214686 +217,-91,0.8615499058579046,1.638359909209492,0.567811515476953 +86,-48,2.7132172693707157,1.0900261369667437,0.7898897351107592 +53,110,2.4880043358333293,2.8501085456833977,0.4375151017411245 +-280,-207,2.0300891412104485,0.3947303069397836,0.7116089832199072 +-36,-252,2.604748972559562,0.061896551335278716,0.8896754279927123 +-45,-111,1.0593578120769729,2.0450236052516733,0.36391519217742974 +382,-101,0.39309102702810617,0.9313374036408972,0.5644441399383621 +241,322,1.3166480991836889,1.6561256840155185,0.11645753330419062 +400,54,2.3057208497260704,2.3282744912656197,0.887257964515414 +282,-123,1.3974798939648985,1.2409374125408195,0.8955534225094758 +-105,378,1.3626835406581552,1.6252282362259733,0.6014558749293805 +29,214,0.20743924711599093,1.522676921003086,0.02043307384832016 +-196,-86,2.9441687638326908,0.30154046763028086,0.42168605414708893 +-108,-313,1.8764612258044735,2.132984565034416,0.6189740865585365 +-128,160,0.7056208626491115,0.9390296349999362,0.6604744233897689 +-328,-10,1.8703640233136554,1.9912655090598896,0.5221955402460047 +340,-75,2.39148948442215,1.1994910990823566,0.6369522845562021 +-263,279,2.327961572530379,1.6885694417318318,0.8414983794604883 +153,70,0.952592267270906,0.938864504674974,0.11638396325633649 +-75,178,0.4505122450591823,2.3429323129867026,0.15872954038707165 +201,-56,1.0005299054072285,1.6571822029407617,0.28822537800367 +100,-238,0.6747707460987439,2.2857962316297034,0.45156820915138496 +278,125,1.0103322322695885,1.4134195606075932,0.2554651207715877 +186,255,1.2493433181340767,0.4710375322660788,0.7465363603864056 +-258,232,1.7622596809993796,0.4548832191326848,0.8994483929662337 +-68,39,0.615707198044844,1.0607507331828099,0.4761677915076723 +242,244,2.226503921761368,0.7684291498512688,0.15635590173751945 +-241,-289,1.9567973013871431,0.07484433271545177,0.1615673204081829 +-191,180,2.6362600187342675,2.4113362477921823,0.6607275428377386 +331,-360,0.5316910029056952,0.7544995492285567,0.8706233833754571 +328,-181,1.4637978923517454,1.9686846941185103,0.3960729150980131 +294,-379,2.6372533269049505,0.9981941278233594,0.3686419436434779 +180,-148,2.7120018850078247,2.8264800988784087,0.6619955268905747 +18,259,2.2255584558208477,1.118056967447345,0.5924656659229673 +-155,-294,0.44899999682288594,1.7889553138194705,0.43731809979850034 +-136,-366,1.0600891479470294,1.4773452232943107,0.6548605098697213 +335,-121,1.9495995393168541,0.7635702283386866,0.3820328234708804 +-388,-368,1.4279856582756674,2.402643473101087,0.03612278964729909 +-354,175,1.7228847111263805,2.2964329150897633,0.07334840514564878 +296,364,2.734917102960474,1.7066422284795402,0.9135605924225192 +369,-194,2.365792492707322,2.8735590448247716,0.1835917050559187 +-146,-369,0.8103459539033943,2.730448062248254,0.21479953571555555 +-95,-208,1.4708649453247644,2.6927215181746345,0.1314332571728799 +115,4,0.921270400877194,1.7021931215763928,0.6082925218387042 +272,108,2.298282534210704,0.42352045244180114,0.9939970880603273 +253,50,0.8479442388399295,2.8278900561771296,0.649627546970449 +39,176,0.2012895513499956,1.273369257968365,0.16761274562460715 +-13,173,2.1716202228786647,0.8968026516448125,0.08482543076549831 +53,156,1.1356125805553896,0.6120796821315072,0.3739495480524595 +-257,371,0.11636322002795252,0.6245749906075672,0.7751107586292227 +19,84,1.4911217645022643,0.5696575750688554,0.8272167024920772 +-59,199,0.02588850752363525,0.7482728215678597,0.8355549326202749 +16,-49,1.5311954811505293,0.22311540434506694,0.7508848601782211 +157,113,2.393510302700972,1.0642542576997338,0.5370425654394041 +-102,-305,2.723497200604345,1.5329353649119075,0.6096517209407472 +-127,82,1.7487005910264997,1.969094866701198,0.8272804890605199 +-242,-5,1.896993400754495,0.9922962038458213,0.23800981588636339 +-150,-250,2.4284962383745983,2.724954957999252,0.7911456163282632 +9,176,0.5968019696588892,0.24784364522579516,0.35571928676321785 +-389,361,0.702241260149063,0.6376606845872866,0.9366240619102396 +216,-311,0.6923235956767468,0.11102365492018307,0.7055349436890465 +-126,101,1.2309462719153794,1.5311878348834638,0.8762927661511918 +298,291,1.5878354825947447,2.005857522530539,0.48454588707430324 +193,-176,0.547890996428036,1.132283434121794,0.25059946347842355 +354,-158,1.0125791705407066,1.7578425549028247,0.4058140105364163 +66,-127,2.5065951479214346,0.264065351850147,0.8908352386996957 +-277,-157,2.688569382991684,2.3536929288744757,0.16647838897862244 +-338,-390,0.7003205314962097,0.20655954702328183,0.13832906734482597 +297,398,0.08690003255825385,1.1183912591548695,0.65732786224406 +344,267,2.3639972453342994,2.825931146904616,0.7532722621629512 +172,-108,0.2535986489529981,0.8531353322238799,0.39108652390339327 +-49,342,1.8050092696142563,2.6951788885214185,0.14725947204385148 +360,41,1.8852628535342166,1.3453311266293175,0.10787577841406881 +-135,-53,2.7986165507630387,1.5859359304082126,0.6537243658667802 +-67,-292,2.596135145136319,0.5029078729163364,0.6213747789512856 +76,369,0.43525946647470015,1.4981691331685676,0.8186221901379319 +-246,148,1.2681343546075978,0.4856560566249597,0.36290047793819913 +277,-225,2.9278664561898786,2.715213348238155,0.8563605379527339 +-207,271,1.987162788504087,1.0919512882880915,0.2374004516847118 +-182,279,0.5894487364803848,2.284183583419227,0.07145859411692157 +52,77,0.5616943207132242,1.7101501640871195,0.47743267652864485 +154,122,0.40679022629996253,1.854698858122409,0.006724908896830861 +-262,-297,1.9873201236165554,1.4836677264089744,0.8360644492350092 +280,-38,1.00747083056471,2.7509221541177986,0.23762681246768969 +208,190,2.9097540400022375,1.9336075428052455,0.3847744546996308 +24,364,1.8212673798280004,0.2556592868884947,0.9399670515706717 +182,-190,2.3760167195189075,2.4615343028586985,0.5601105951747428 +-72,365,2.480073345237644,0.40301143444750975,0.7339594253217717 +-327,-207,0.5298434164625977,0.7181040955189122,0.529533808364483 +250,-91,0.48360114694604217,1.741824064297897,0.08337625954316596 +208,-2,1.4840964117243678,2.9165940694836947,0.1407080593032235 +75,138,1.0443794116381042,1.5252541068508028,0.2045858398546755 +297,183,1.9268022111745702,0.8083837294729472,0.2455275475022497 +-343,-65,0.8931652370271815,0.15221826126994809,0.9187986976576528 +-400,211,1.1906356821219026,1.094946884952742,0.3289636957734453 +-391,-214,2.857974387017572,0.8264944742293695,0.09824491318787054 +-172,14,1.4536529689603956,1.1014747287352566,0.2915336990730908 +-208,149,1.0433054742183034,0.435122140040061,0.6768200534803052 +-113,233,0.03655401498895894,1.5037459242644147,0.6981509330153206 +-197,231,2.303390961308632,0.7742499740586349,0.11452063785687083 +-362,-355,0.14632418275965497,1.7838318296341478,0.22010064950836805 +-147,138,2.4994088338153286,2.4473753395232105,0.20508506798970694 +-63,118,2.0102000613608686,1.6571155475907071,0.8372754175496556 +-378,151,2.4255452151488806,1.5720576241876463,0.4137172776548077 +377,-94,2.9035442883802753,0.14494447862107263,0.500802194767635 +-42,-291,0.7818381271055705,1.7736650945814079,0.24812223306399883 +-352,243,2.2956685174305433,2.912624346223665,0.577063518823208 +-214,-33,1.3397015903035716,0.7651018699310733,0.08112442378797036 +246,-194,2.811192481355835,1.2018555158489308,0.5690581971965829 +315,299,2.3146592905727954,1.5991886834735725,0.16952233568151365 +-242,-240,1.5493379686563933,1.7447498142099593,0.9144576383773395 +-352,-210,0.5020228464592398,0.1932539839045313,0.4616120663191876 +6,243,2.027678650319439,2.458913971243983,0.6452514447813137 +198,-6,1.9501832452809655,0.2100210645630084,0.43888291076106023 +99,-77,1.3030447053921925,0.2993635821720747,0.5861689218265839 +242,97,0.08855320596882466,0.05482794853078665,0.3165493054138745 +-183,-83,0.7266960410082618,2.0545435110876835,0.19710448810484404 +-142,71,2.368435509335895,1.9976524385265249,0.03262226937726809 +-292,186,1.503559533507217,1.7238803240914236,0.3732314895640867 +-71,-38,1.6782051676152134,0.8519244158637602,0.09067871037806496 +-343,-344,0.6039081431146031,2.1337976270062122,0.037644025889108756 +360,-322,1.2892297377450723,1.7931456241327184,0.04414492720670793 +250,-379,2.469413038394103,2.5652737303475703,0.40311447024898417 +340,-219,1.944023856761522,2.3298713782109965,0.6795740638172775 +-322,128,0.19693195043650513,1.6882713389958734,0.24618260819865967 +321,370,0.9637113011691633,1.413436052574745,0.29125594571380764 +146,-197,2.936369679708576,1.209608212783451,0.732597691381215 +10,-92,0.5596485962782598,0.4537640414910299,0.40364112326539137 +389,-328,2.5017875862136667,2.1021742716240017,0.2470653415863585 +98,-268,0.15209365607129854,0.3479190697791694,0.5321994409109284 +-279,-44,1.2769357555182415,0.6449180900862502,0.637290654872168 +252,34,2.271275486568376,1.8964058454024404,0.10657200431018166 +49,180,0.6303338180326145,2.5530699220423356,0.3591680923880629 +234,-138,0.3996330083947218,2.076265627327659,0.28936323227115224 +30,335,1.723490946344016,1.4481143874537548,0.015260688040780845 +-246,-137,2.118758338141573,0.8626820118451066,0.4776511816202089 +83,-180,0.925523229148105,1.0240523020051226,0.5163154948360218 +-22,125,1.3727380406020837,0.9474419047717265,0.37612502652689705 +-68,-8,1.7392080138888586,2.5460278968509003,0.6497411823289364 +-311,40,1.1323074277897978,0.15403116842165565,0.12556899412690925 +-285,159,0.42898008396610066,2.7525808754232255,0.7404237732728357 +157,338,0.33058355260375194,1.825917822268626,0.7257863340720678 +307,313,1.021736847023998,1.7566271029079297,0.2571287947567594 +198,-111,2.5584681460770518,0.13511929984752924,0.581942606205608 +25,249,0.4459410133243299,1.4049539649150404,0.3524135673705209 +269,-247,0.006590238609652577,2.8770276507228387,0.3356032050266117 +168,-223,2.8199609708505755,1.284480668259775,0.0902299153972177 +-199,-19,0.09428831418059114,1.514757332964798,0.1800812825082686 +197,119,2.0786297364907425,0.5411765693387944,0.816913270760099 +396,-56,0.862487781167218,2.05141012776207,0.3879912955034396 +266,-338,2.6815216548045275,1.0051412015614711,0.11602333031773748 +-115,-202,0.5100521428523277,1.4200213556904786,0.9918060578418505 +293,-325,2.8812480572968453,0.008174683124680615,0.8443762598969495 +115,155,0.30547788114481456,1.2157412790946125,0.563529096103388 +55,-217,1.4821408666329643,1.2181411342579653,0.7337921602221189 +112,-19,1.9539886595990632,2.3811872638525537,0.24041278064504246 +45,203,0.2319948751768829,2.3405818135851515,0.04535910806370358 +-346,70,0.6261493193011174,1.463265531301114,0.31217253761214114 +199,-205,2.9762354441519046,1.039721605396433,0.9314497898020876 +111,-58,1.0768291354255037,0.17456673749664076,0.07077018239678412 +105,97,0.9861942521894788,1.8068785907729277,0.4565571721112479 +-291,135,1.355463087122653,2.97952187077136,0.7743726704046962 +-83,-248,1.07907207137451,1.7692773065950154,0.9315030724232406 +370,374,2.185322299224013,1.1069191684391253,0.6428361459175675 +67,92,1.9236272009179074,0.20908762366043343,0.36048075167176596 +309,-176,1.744866892902399,1.6719578249990819,0.3540160385879437 +-101,131,2.661934100011247,2.6139884999085132,0.5445562209386097 +312,-254,1.5674555150641183,0.2370391952633475,0.9309677305941005 +-260,219,1.476055407515667,1.7500665137411426,0.30796883777628625 +-328,47,0.5682163996641664,2.440331555097597,0.787928244315439 +141,344,1.6678914032319279,0.20927646116004972,0.3650222182273538 +167,20,1.797988907022078,2.7783420381789226,0.1345087027988523 +315,281,0.05541740889107161,1.686139668739442,0.8598673978289737 +-91,381,1.9465439218921021,0.04121789759534289,0.9915872196715267 +24,-272,0.014943113839003597,2.0857817989567127,0.28045040932203036 +-36,295,2.5839229375005366,1.5323506601548882,0.6682776082524141 +308,-372,0.5154612458981845,2.6948000453014567,0.7685370641122817 +-329,174,1.3345983037581053,0.7890798524587883,0.2820355968297552 +-343,395,2.426689523707547,0.5259182432506075,0.7562629555406288 +176,-165,2.5287609004219416,1.9912760481944056,0.31255587364048487 +162,-28,0.9517321934875745,0.42718177729756324,0.5964304160881626 +130,3,1.3081400804397578,0.183306962407503,0.2251804339572212 +56,-192,0.8797019654295335,1.1490659895752222,0.4614984591919933 +128,190,2.164554883978047,1.3420217913644832,0.5645341242493938 +-10,-15,2.0874223244618344,0.4619645648598546,0.717705113745865 +291,333,0.731193547329262,1.3697515830616198,0.634801044202139 +-383,-129,2.721775464223013,2.039979941685985,0.40770074513906396 +153,266,2.1919689354930885,2.0166111920682765,0.1645807438186423 +227,-377,0.24368558191206857,2.4060214230443493,0.3535874206637175 +262,-227,0.3919215895851601,2.1564436365315887,0.9982936842542046 +-58,114,2.538165053291921,2.6885863245019688,0.45889564386718706 +69,217,0.5329659366085607,1.078248483126354,0.17845593567622986 +-70,364,2.5259811443903946,0.08929980749976307,0.8560569482781181 +-152,-247,1.2304079275728954,2.308279137440699,0.8923638022536654 +211,324,0.4451836146665412,2.76605163668078,0.05390077213785227 +71,33,0.09962536383119436,0.5007666148893212,0.7535805112390732 +155,-175,2.5950483599053094,2.2392403374284156,0.7842154687934688 +-294,-106,1.31371074284616,1.6242770460000409,0.15416472831781092 +-370,27,0.7339137152105231,2.0968396889261918,0.5823896204466537 +-350,247,2.6881131796580284,1.7295221834889611,0.9481735058359503 +279,-361,1.4158840384860696,1.1906284907896105,0.5932591064632695 +-234,101,2.475845008774023,0.7606346907241115,0.8326037357902216 +-97,166,2.4466020340464887,1.7861685867105368,0.6186610979763386 +280,-122,0.3099247187412687,2.421676649970471,0.5151905071062843 +343,-275,2.422427328344556,1.083049006112885,0.016460639075757677 +-189,-393,2.5823263190373926,2.4343529667356494,0.44965630122616573 +-283,-148,2.3404261652007294,2.2097390881277352,0.6468773991992633 +-386,-264,1.5222576587827303,1.3573550940240056,0.5562101116620661 +-283,-178,2.0663265797437873,0.986061802761245,0.03967347432382029 +391,-22,2.3853934741329095,1.2016083939858633,0.3513295566307386 +5,246,1.099909086445696,1.9145283634263524,0.14685648900779602 +-343,261,1.4353986622902006,2.29377849098657,0.3239316461580296 +369,140,2.630210027276933,0.4704232168085878,0.008864276969742124 +-53,354,1.5211070608396038,1.2342106337902083,0.25618931070262296 +-2,-332,0.4256023366984152,1.9461594691195283,0.030921988364520647 +382,268,1.2060929469154944,1.5117342841218382,0.3096695336734011 +60,-305,1.0980123277987603,1.2530060403717034,0.7363471987057443 +-155,364,1.810120390927463,1.4123488139253557,0.08540192994751894 +9,325,0.9953499824011679,1.334006575840533,0.8153517643053263 +324,-22,2.4621088846428365,0.6370258671606449,0.6497653458126702 +-84,-276,2.607421652867452,2.0320778160382007,0.3622912853144171 +153,3,0.32389759294682186,1.9992497901051938,0.5937012317514024 +-336,237,1.3683899463171074,0.2499580626060286,0.4398838988497994 +-375,350,1.8501818007708666,0.08419589790600823,0.34692990545435176 +-92,-205,0.588205675395221,1.789030680455748,0.6498527841532142 +67,205,2.403493353598051,2.80382495220654,0.18932436956368182 +208,-229,1.0016602771494427,2.8030147909431884,0.15096443563245743 +10,12,0.8346174864673148,1.6436841622620855,0.5532180034079748 +-131,203,2.9469185636354265,0.1180263803827809,0.26307069672004446 +87,306,2.2150634677395447,2.108293236506469,0.7054739201624336 +33,-10,0.616123274347141,2.9495385154647895,0.7095694606215871 +-45,-247,2.4734636724571017,2.537337910453645,0.015575431778362514 +190,-303,2.9048035727999713,0.24922258721920387,0.08434619014575606 +-89,202,1.9727949335858683,1.9821985466911425,0.2912673218640284 +-71,-303,0.39229873616705846,0.47154520636673236,0.04919949887498276 +342,136,2.118209787304507,2.221783483832255,0.2414241825795166 +368,-203,1.4764011859360715,1.4256581386607676,0.2147664047459339 +97,75,1.2136150482397345,1.3158216315877054,0.5723061901001114 +368,43,0.09969027227001848,2.252551774631295,0.8802713592966148 +-382,311,2.816591613408037,0.768966407083562,0.1915945967291509 +-225,-26,0.5740075323051084,1.288662584965217,0.19132349818024885 +159,378,1.3805042061626063,2.17696569857136,0.9939611917294149 +154,-92,2.8891974568915293,0.407394281347769,0.1875262267017045 +-277,-285,1.6781545093305563,1.3376200112292609,0.5111486036179881 +-178,57,2.1003026834093514,1.609061307964918,0.2840369012302053 +-85,393,2.8298304271832033,2.358331533592083,0.30676824376290934 +354,-308,1.266273849998492,2.1460639288814676,0.06828685524511247 +-370,-18,1.1755702698298842,2.5933189243140298,0.7803608965747985 +-308,-144,2.1627261653790146,0.2588533708839471,0.6110500823602047 +-119,-26,2.724218045334564,0.7806972670254876,0.30115094573575574 +400,-276,2.31778046193123,0.36283649878304325,0.19312115602465874 +-6,14,0.08128323737528975,2.6365224107550183,0.8461621552946186 +-349,-314,2.4375217372652176,2.2949944808723415,0.7935606289949754 +-191,-320,2.9713959139620183,1.1042341108174816,0.5804077397135108 +-300,167,1.9018552545292444,1.9857521006030157,0.15613304542409123 +-159,-218,2.2354015995019543,2.145699954130308,0.9658100476158219 +-240,275,0.567761556140001,2.368746235147049,0.5970483908969676 +-299,-302,0.8570987973307677,0.3643807948471651,0.311099403225074 +-107,-378,1.362979790806938,1.1618172954690857,0.9725859798946552 +-129,159,1.9902718305369451,2.2142639446051553,0.26536780429042883 +303,-209,1.9166140503751734,1.3536420060572967,0.06635915449657126 +-170,-78,2.6622746613184587,1.9561087248091016,0.69428067534435 +279,362,0.3276631773945474,0.8010207355450407,0.9575895693841194 +195,4,2.09427828403994,0.14997034842353962,0.41059955268072645 +-232,-296,0.8018155631925067,1.4688341828866118,0.13257391340218727 +383,-189,0.08712141829241404,0.8655872340241901,0.14013673012840977 +364,96,0.978774269178876,2.329032485247997,0.17801480398398117 +-6,248,2.314035642810113,1.9002189450429765,0.17216047352085273 +104,148,2.772970077333531,2.637997381828103,0.5240949369965582 +103,172,1.2788262522479432,1.4151367043699394,0.21219330023557537 +332,-74,2.6732980602645475,1.3893133184814728,0.4294298029385172 +-71,132,0.32450327550284885,1.0984276434818834,0.7947101833231648 +384,-32,2.507771235929088,1.8362357548373591,0.6134646516946995 +216,184,0.11432028018774254,0.17129433138791872,0.8640457859803511 +278,-218,0.7150401700519263,2.163486963001838,0.12540977408645015 +55,22,0.09559809065924962,2.7079701805769902,0.33396096403151654 +-121,-197,0.2813939847601281,2.200215808692848,0.7717476190268419 +-16,-222,1.2162759481156113,1.5503441692039641,0.1564865062509334 +297,17,2.3394467195196507,0.248629250055036,0.30563028536856596 +-239,-371,2.6507455053109714,2.6719828905416003,0.5037593718927458 +368,261,0.0040172319788996935,1.6488701252031812,0.9701935138042821 +-280,-124,2.8003981746429956,2.265112980984115,0.38086694558806644 +85,-209,2.203782162025545,1.6334573746182128,0.1966624366065306 +-30,-218,2.0430982981979344,2.5439973958973616,0.655538061881947 +180,211,2.4207617827380097,0.34093678383545567,0.13692423884622074 +-315,231,1.5378773064119566,0.14254939264892186,0.19334771774832082 +106,357,0.8782471937190786,2.4456594456733365,0.5857771415123159 +63,-301,1.0891671330177966,1.7956808353116176,0.6969203552635589 +-290,-336,0.7195251735412179,2.450347863387066,0.9466590296720764 +308,-187,0.6445346809683341,0.3058288072795131,0.1321680629121862 +-352,83,1.371771151146565,1.6240177798797486,0.09907777308164911 +-47,364,0.16754357343979787,0.27237240952298425,0.31976275942422416 +233,282,0.6110726192264648,0.08595517779614603,0.11135345700429489 +306,-314,0.061540650979726275,2.0760786381742804,0.9476972338923012 +-100,-214,0.9489646386627021,0.8246364864941351,0.4892886257321609 +-238,288,2.933557884509834,1.32085904520724,0.9168796898108874 +-233,255,2.218581719471511,1.4455668813342941,0.008252764884050245 +90,-41,2.439752721912629,2.2353337595708567,0.0671456612747191 +35,343,2.6152516733597144,0.8318197722539038,0.5197540295174446 +-143,-219,2.8158307978553645,1.134703964268573,0.009690550152325339 +204,173,1.5006991347321386,1.3373337345029346,0.8234540877611696 +325,-86,1.3706000078638818,1.8491393957915254,0.21713079008027392 +319,300,2.4204923553124087,2.2019040676848225,0.2009903772226549 +45,-385,2.8792472869938996,1.7634427712704492,0.29994094443614905 +391,252,2.193033203882178,1.473458177460638,0.5732280394414122 +-189,392,2.459151007394802,2.9065751874416934,0.7432949188112533 +186,236,1.9811134974833806,2.0971236800160162,0.18097946008125188 +-373,-246,1.920157332984124,1.2190047406570415,0.24185214773886066 +362,-138,1.968553468145009,2.3566724409972846,0.45174576396677324 +90,-201,2.9543666490076843,1.1507655610543361,0.5689905772221102 +-26,-151,2.9238154924159656,0.6772578013259273,0.44132044658644776 +118,71,1.7805699711554441,2.4950015023321375,0.7899524741754509 +83,-310,0.8554990419658177,1.674746873257161,0.07837493071928969 +-234,146,0.5335528820243517,1.4554915269076805,0.5862946233020055 +359,-181,0.07040503221058714,2.540583419256155,0.8487139263985777 +73,-289,0.4895967375883792,2.3193047196824494,0.5772694754337482 +73,239,1.0494478037543167,1.5380872215558463,0.41988311845663095 +251,84,1.4527882197504352,0.19556539251241545,0.55687214036581 +-137,-344,0.9850448225885722,1.4440449643585267,0.41506130668090424 +314,400,2.5558013316378476,0.36976585227637015,0.897824544782275 +-377,-117,0.12265008813046441,1.8567716190335792,0.779596244738233 +376,345,1.2492772352986377,2.9078070964593334,0.9589747346252262 +-69,305,1.1500207627585284,1.6962601090440188,0.3749644955263516 +246,400,1.570238341746382,0.8626350943588016,0.750357269970973 +-269,-112,1.810726080415403,1.2819854762986191,0.9094041448010709 +-240,132,1.061832032154082,2.5586403052831646,0.5932711654449473 +159,205,0.1958212812690041,1.796744667858029,0.26594223188893873 +281,-77,0.07765282933933193,1.4939082419310492,0.29266618399745636 +-305,79,2.387627709968429,1.5995871480420596,0.4865164934419456 +-384,-243,0.04264782376031251,0.9574507377491416,0.47598102323342817 +344,350,1.739106058848522,0.1597529877020365,0.30613048515577834 +-219,361,1.8395873345369702,0.8275299933692034,0.48240913207165825 +395,383,1.0823129089877201,1.5001382515530794,0.45097643801557064 +153,-32,0.027073771661920598,0.9332230062960297,0.5161365487354591 +312,368,0.2821760389065102,2.6234153964061484,0.5554313930123966 +56,400,0.5420518518460518,2.0718494837979686,0.18897496593740426 +-321,-64,1.5280383114677059,0.8224946921569499,0.5439961942272687 +377,296,1.8445887102759044,2.0669979400180525,0.3556652943577786 +-313,354,1.041772234896793,1.6112276047334029,0.12254444463132275 +-155,-231,2.8339135266147193,1.1933908885774,0.23681340347587476 +38,391,0.47656517718710056,0.98068643518537,0.2934941030722178 +202,18,2.167162614297273,0.5741282271690196,0.5706890017394477 +-38,-343,2.156093820805345,1.6270171015204582,0.8177802365317564 +-368,382,1.6086055631007512,2.3204623909786717,0.8872834061619279 +92,-147,2.0436348896967127,1.2242013524448314,0.8928009729469174 +-76,351,0.734920132839344,1.4159264645286727,0.7977083807461993 +-146,-213,2.5723281095228407,2.882475365059062,0.010493450474534871 +-181,118,2.7131249885340134,2.8406073436549635,0.6846694765659569 +-27,143,1.11623340355691,2.7192030380270538,0.5190958123110712 +-32,-20,2.394114208549004,0.3795944671182164,0.2320430834639462 +-14,155,1.6068462725861412,0.776178439231708,0.6065852897817673 +302,192,1.708180317968126,1.243426101735362,0.4653385907894392 +-2,-218,2.1081513534880534,1.4214995004839481,0.33324808870574607 +-175,274,0.025110273890272428,1.182095546159821,0.5946596959517364 +-342,390,0.32680763712879035,2.8388018626034075,0.8324975954087264 +181,396,2.864425191556098,1.3024892974125626,0.7303057094579712 +-210,-77,2.1764447046854403,0.9032397334000832,0.6061373184815048 +-133,224,0.28049318063779816,0.8373872631850716,0.24836735463088566 +-122,360,2.8359320720008534,2.1217963931772323,0.9052440120351483 +-351,-216,2.372093615375572,2.7049490619540166,0.3420376080069629 +-4,38,0.19168797385094694,2.795391740309171,0.21200544735993632 +-238,328,2.3978705987029905,1.1195242060871715,0.06181055416301662 +24,-199,0.1325856041821989,1.4920784535696776,0.3583413264029891 +-218,209,0.01704592279109063,1.9000356583774114,0.14751089656878869 +-212,25,0.6084163552237642,2.202730869834795,0.8454728328701485 +351,357,1.77393719744841,0.26400180219193325,0.812605581815981 +-185,-51,2.3089149107529154,0.32957150458341233,0.3388528485857436 +344,-306,1.776543799525212,1.4658026139704619,0.06354580610524663 +233,45,1.880472708683598,1.196523252244406,0.8489366238166437 +197,-226,0.42202783155395496,2.5936590796212515,0.9996986896572667 +32,282,1.3525661587811313,0.12629998671704767,0.5077018017523939 +-275,-342,0.9623198318159194,1.502773872540344,0.18502473602932 +268,-287,1.5612432202428703,1.6731172208621232,0.2507703916577686 +-228,-86,2.0168803640770445,0.9223277514532724,0.5338033916567044 +367,239,2.328103453853357,2.2850188522566075,0.7268930508852731 +-234,-93,1.1488363758891629,0.012166948464955807,0.4764625997341302 +96,279,1.2487328215784537,2.8816298336192063,0.0866416046316183 +-326,271,2.696437618292536,2.5841635099742417,0.40301559237261486 +-86,-12,2.2741400325876127,2.669325878196233,0.9534779681650773 +178,-333,2.835282149266075,0.7641370000307137,0.7625934257126213 +290,-217,2.405410878201815,1.6328218973486097,0.960862404568837 +-145,28,1.613986038980026,0.27378239418595385,0.08217549175273131 +-211,85,1.850362712687707,0.6984425440120043,0.5279944683467755 +-170,35,2.548913874625392,2.188063682479549,0.08545241690076466 +342,191,0.7204434194560958,1.9932851317320668,0.7447108654508042 +283,191,0.6754643163081439,2.1803427088200684,0.733773226023372 +378,-147,1.9266821001565615,1.3702440933870497,0.09265759658956185 +34,-199,0.5259635695955792,0.3051343102303006,0.8822768729804047 +-210,44,1.2291478598674457,1.847903870085803,0.006653370087304711 +-119,268,2.8833143954409493,0.5470196856994566,0.5020455678432549 +348,392,2.51301118006735,1.5533875777159838,0.3648420837322116 +-73,-13,1.320330223496954,2.0788767040133944,0.4614044740950909 +224,229,1.7440205937047777,0.6181533003520469,0.3651850082959235 +-293,-207,0.590227949728748,2.1045329665211407,0.7619599282000287 +-321,136,0.4199399763024457,0.7058640228845381,0.9393318419624567 +-123,357,0.7963486880119127,0.36878458746270426,0.47477628960074303 +-395,164,0.38570241969825425,2.2332075810469423,0.406865778472414 +337,95,1.2174799158678482,1.9051038283386008,0.6314050022556249 +-353,51,1.9880034872529706,2.283682930588637,0.16011320689743935 +206,-300,0.6955886105886137,0.5489330984096152,0.9971044941541544 +-8,73,0.12184823074410644,0.2629248289621293,0.13166888106550956 +-14,-251,2.3513193868074618,2.3242914110415174,0.9611355786397674 +-48,341,2.5508384489573617,0.07669133760609004,0.10700993742284881 +-261,-128,0.8270536581824375,0.7015320527807056,0.5756307767858173 +293,136,2.8148660167425152,1.1718318819087539,0.7020775945707013 +238,-71,1.1038817960631504,2.8970165509107435,0.18361214504809853 +106,295,2.595390554176685,0.5367104135907009,0.888347240384757 +183,-370,1.0713603847998443,0.24516766752067642,0.4937660101017365 +235,235,0.05595923541125625,0.1754986453486116,0.45138393880386485 +-164,85,0.4759338058158722,0.28045340365991267,0.9724547036588055 +48,-397,1.8511636892887564,1.009758525921665,0.23928187098140186 +-113,-184,0.42108699577691555,0.052945567964078566,0.7852751658328967 +-188,-125,2.4703356689494287,2.2609400306665197,0.6350256981890094 +40,-187,1.784888603492516,0.6442086082025844,0.16847573843940344 +165,-48,0.25274624847589144,2.531400682810567,0.42100543658983647 +-195,-26,2.032019524052766,2.8935864078258247,0.3598921788970092 +-242,-99,0.30426399437527774,2.8857235351027533,0.7751913891763521 +148,235,1.7111527584451842,2.735556870649323,0.3832728053389485 +-85,330,1.0013193173602954,0.21262324217896067,0.7927456721804723 +-203,-395,0.5455382297233615,2.614763970520219,0.32738371542483813 +312,17,0.9745913380348834,0.92195954462926,0.42056555245309646 +144,-264,2.3468061523928556,2.8454143500576725,0.6483101461219214 +-205,-59,0.3275536202893149,1.1287769468813424,0.6942376001541013 +-384,219,2.8829225173607695,2.7772920510909973,0.050447909198046426 +-195,40,0.673110389794724,1.659798377542913,0.7918384809932197 +14,241,1.1254010040733653,0.18551695749047303,0.4370090145030082 +-358,275,2.975236909013449,1.3171389274623864,0.1635001422889013 +358,63,1.2903345211993913,0.8217022510639383,0.8070081605494076 +260,-249,0.2448882654971769,0.9068916138898191,0.8820351077665246 +-106,-160,0.9350004478803148,1.6036036130260327,0.8303834421926884 +-359,142,2.131341861089617,0.39338069943260034,0.42477020849986225 +360,234,1.971443818489853,2.539490729541009,0.3784717839942505 +265,-276,2.8738853391192754,0.5505805373757894,0.08132688344904948 +-148,10,1.6513066404780323,1.914036017216914,0.7890304520235334 +335,-117,0.8188620482303255,0.3992298394812642,0.7381977692157945 +-314,-58,1.972264556086088,2.3080298134388926,0.04536158239712795 +58,305,2.299587691178361,2.846255177606949,0.16195757408158595 +-183,-396,1.9607622597542598,1.5792608563412753,0.7496814693858613 +295,-325,1.938690202315516,0.845968126728079,0.3188896023988418 +159,162,2.000994320545963,2.9369373579496934,0.23895248522057833 +142,332,0.23843804466285579,0.6226437462578462,0.8240883672708168 +196,-143,1.8042301861596033,0.6626304468858718,0.7182172557594304 +-112,-168,2.528014224214856,1.236813058187367,0.16138334746991667 +304,-317,0.6618297720685312,0.6656281652629865,0.48791530741924016 +74,-221,0.2318987326667824,0.4563273340937225,0.2854020052822922 +213,83,0.6388698255134315,0.7998550388991091,0.9676755977721595 +-355,169,0.1660476662655237,0.8153238529701459,0.054393304039016876 +40,335,1.2721122113173835,1.8022174718742987,0.021692963339098315 +126,-378,0.6709632564284224,0.6627465036614849,0.3113612957824944 +320,368,2.507822973276448,0.5424520644919759,0.9429291732261824 +296,-370,1.5538888261219124,1.8298537239134516,0.16164282326848756 +-191,271,1.7452007449135125,2.773525481848898,0.2753519879502998 +284,-52,0.4759559041155813,0.1611238257182236,0.28164857708656055 +-370,-295,0.47493790384688883,2.1538924991851847,0.3219683287714683 +-329,-77,2.775956059500606,1.6269860726680856,0.16894239525348498 +297,-258,0.26627540769560043,0.7393875729459011,0.5131806247819095 +125,199,2.922775929728854,2.027792358548753,0.18063906318098244 +381,58,1.423984033473742,0.9781351625089174,0.7678433081115392 +108,-294,1.6233084965613025,0.3183759816190521,0.08935709233959666 +189,356,0.626454248121771,1.1644078272028442,0.5931654475734099 +14,207,2.413877182199918,1.4173582513268752,0.594760613911735 +-45,252,0.6457279383019148,1.3358043299904807,0.9259154347735102 +368,-399,2.0920764038477575,2.4383478667464495,0.27614816233436457 +-356,87,0.5458265468447103,2.668915574249706,0.3254310226169187 +221,200,2.143968791792588,2.237292384675182,0.17403396071081978 +393,387,0.33165576783190653,2.4086003060235224,0.32865707221090756 +-379,-88,2.2497474671193345,0.6051775387554363,0.5833313257283594 +-225,-278,0.47198827457164905,1.2305332361360435,0.608902963610542 +103,-184,2.2468477483088054,1.8983147870193164,0.6658303330239714 +233,-229,2.9569048944106977,2.5311441118498696,0.7716809731897811 +-287,-370,0.24220305475238302,2.2423928168660647,0.6666733254804535 +50,-150,2.069777012128804,0.3589996815635935,0.09475120153336569 +283,-374,2.807798393855503,1.0607880579482138,0.6695658607239187 +-44,-165,0.6253421835606077,0.06285139954724983,0.717256617839543 +-245,104,1.163492495696344,0.34952237544594555,0.13581995419984538 +-64,-337,2.2027288074529574,1.9664858071574094,0.48585571029733643 +-1,-210,0.6442014702376323,0.6037891738722788,0.25899757818066793 +33,-376,0.0002244183481484585,0.6098722433324144,0.27550680762660906 +193,92,1.4374935780627252,0.3766276639675279,0.4608287250145795 +66,-319,1.9891917447306362,0.5142586831631378,0.7909692374919208 +-59,-19,2.268935127141737,1.2202114036007528,0.8040528821536851 +-46,-175,1.6770457900658176,1.023784275030771,0.640475225015206 +-173,-260,1.0436445621419956,1.1907067099782154,0.43006848483215065 +127,-296,0.4394748909713533,2.019174551915878,0.48078426535168006 +333,393,1.9518935887833737,0.07375208039297143,0.7607610112448248 +-350,-351,1.7604085213127876,1.131378416956117,0.42844576017906244 +326,209,0.9803448910933016,1.6058773645349698,0.46192078320116847 +398,313,2.530801461512866,0.19131265442043444,0.8067816576178115 +-196,384,0.3706808368912383,2.9865642741848424,0.02447752107441803 +94,63,1.1997714964015445,0.9611779826030947,0.8287570378297435 +-394,49,2.8154190501207523,1.959766122582316,0.3481280014641822 +-122,-374,2.8896434604063588,1.2980919443956696,0.7719826690177249 +222,-367,2.310958375401537,1.164411922515138,0.9242898922438931 +-374,86,1.5550081292010436,1.6367146348055857,0.15602835560561423 +-199,19,2.2455004648953114,0.7766535873719602,0.8171334814179666 +-388,-46,0.3859092848824597,2.6916320866193666,0.07525758309190345 +101,237,0.33887348681359764,1.113358212817525,0.1899187677570593 +-205,95,2.3189751869226525,1.466776158538935,0.8102284674634405 +200,-182,0.15508163253653107,1.972278815642308,0.7030684562731536 +-128,69,2.717158628988344,0.911962903491991,0.22428017196356276 +180,170,0.9265988880469912,1.7646748713984435,0.4133960702755204 +-88,161,1.561847460997213,2.703208286121938,0.9242027055802903 +-349,101,0.009841905255343009,1.6729001885253627,0.7657059748582571 +351,-333,1.2662837133159321,1.497630635645558,0.021847564375917727 +182,-134,2.138747842258889,2.1420386549433785,0.26907582704321875 +-28,-232,1.835961661735217,0.36413100673535015,0.7664691417859487 +-5,-220,2.2424817879315246,2.5999884372378013,0.9062868984187485 +224,40,1.5669927322850508,2.966713281067027,0.8927185261891548 +-153,-292,1.947317969387274,2.6390197953375125,0.42495363555372856 +-220,-239,1.7632725739589201,1.4961663751119123,0.44866935406579544 +-16,-113,1.1444238325255816,1.9655909033330563,0.22162298148487236 +2,-324,0.5431678059451145,0.7574976514259559,0.40527306179284284 +-374,268,1.5269937159671034,0.23985408376375972,0.16897945888368282 +-280,-88,1.5708214066589137,0.03812454223151118,0.031209633912833157 +-242,278,1.049672655434072,0.2955363865552746,0.7270650211498125 +-389,-90,2.6763208754140386,0.04565469654703391,0.7175182450989708 +-85,18,1.7398891797570375,1.2137568953536093,0.6871457141528282 +-391,258,1.6343308647827948,1.6350082375005988,0.25974060402062626 +-176,-226,0.5662419926688504,2.3583396422546246,0.7848197028024215 +80,324,0.1889190212651911,2.3285928628833594,0.1759080435543353 +383,103,2.7536384286131157,0.26142717096969303,0.12395457979673685 +128,-237,2.9608932217449637,1.4088235589159832,0.3257836397837076 +-218,317,0.8161319462648325,1.716898684901815,0.06380846248000938 +352,-297,2.1732731949254327,1.4478869455025334,0.7861154600431296 +27,137,2.59264815174531,2.435775719657552,0.5777872787043955 +308,-250,2.2750369498070433,0.5326380683447824,0.5539694443926976 +-268,-103,0.2134776262904854,2.2786713529490203,0.40279999795547283 +163,-274,1.0505514158673335,2.498664165575174,0.00420602430062289 +19,-205,0.4369575427941501,0.3555890262934064,0.7650172800428305 +131,-239,0.17688003029672617,2.9331786237960875,0.7058137202547535 +-142,-31,0.6906323431107032,2.367584808054531,0.8030379554910889 +167,-325,1.8186534078208663,0.6630221460176167,0.7407704646492846 +46,130,2.694160046385192,1.054930157104823,0.39893561678533296 +215,-45,1.4329397504221673,0.5331821516711543,0.6553241481314931 +-121,92,0.6392811311545817,2.1284399901923,0.3521986235015454 +-14,275,2.7107673027199484,1.4239999085006383,0.0394461956443134 +28,-81,0.6515644731113842,1.2145336589105915,0.3011408352524805 +98,-236,2.9141079033762454,0.047972871748903856,0.21025429976849364 +-38,261,0.6770036190608018,0.8175161037627752,0.6154395604587382 +-83,-268,1.6669732918600997,2.88638884638435,0.8033608922948609 +-334,1,1.3635721118207802,0.7729917159332116,0.3705188070005787 +-291,115,2.44329025364115,0.7195882633958421,0.476997194583323 +334,-187,2.061693429813455,1.685794554593469,0.05057719597298005 +46,-305,1.4813383406688874,1.8135045687571583,0.6065911265730556 +-187,-313,2.5383350827773263,0.670145595668917,0.08784466097156396 +244,340,0.7386706386260201,1.728521992096965,0.026753034823866817 +-336,236,0.15671520660893845,2.1776710372525994,0.32418682524402986 +250,269,2.825033963470659,1.063603602959454,0.9151424633798461 +205,-374,1.2952793387788017,1.1640350040826437,0.5338241469311052 +339,154,0.9031575262027188,2.4428702153964377,0.16345005361879994 +-74,-204,1.4600219169847408,1.4020210773271584,0.8371886083861592 +214,370,1.6107069336222017,2.760085380390837,0.7699724939672724 +-122,259,2.0126061099256,1.8800059324678504,0.48202406004448095 +-310,-180,1.4272794840906087,1.8260763576300167,0.43431499987183286 +-196,74,1.178216337045762,0.02412954950769608,0.3759341966001237 +-136,-224,1.486184370945772,1.6303829144793114,0.8537109207336675 +-218,-329,0.2837313571623987,0.2661364999553998,0.09124893951015556 +-51,123,1.8433297811704172,2.1811202042763025,0.8636896414590378 +61,-176,2.927316276894339,1.4608282197669096,0.31219191968711113 +-167,248,2.738820276829649,0.4721389622528024,0.3313295936143542 +-109,187,1.7463096131717228,2.564908841259096,0.4135252250254762 +-49,128,1.9601649534198176,0.34855994582774463,0.9587293075524594 +-23,192,0.38809623839991314,0.8601759057914629,0.4109048479864952 +67,383,1.6812278131492657,2.757479521379072,0.4982831569061653 +-66,282,1.5196124550960448,0.5099520849605966,0.727677307053365 +-309,2,0.060465820277420756,0.4479652445579423,0.5568699984650374 +213,49,1.486591959292962,1.1562586304132951,0.9994086061907744 +308,-74,0.6052454371384783,0.4631631988171322,0.08470201816244194 +-174,23,2.014685078068628,0.5437427032254039,0.41494922289441727 +223,284,1.0654432907693052,0.2329517391414302,0.3675981815576994 +158,217,0.46292242743855927,0.2652492961806856,0.6566380778507113 +168,-186,2.2563781054330754,0.6477663796864098,0.0754623740404563 +-24,248,1.8359495907782692,2.6898945256477145,0.739293888796529 +-273,-55,1.9260579646493512,0.9638496715898274,0.16176097994508498 +-245,117,0.5963942615803665,2.060836518401767,0.8110955813110056 +-299,-43,2.4255914378106853,2.891821340794612,0.09436126377952447 +-145,-196,2.190858689896521,0.3309432842890988,0.26921115368842463 +-364,147,2.9673337620256186,2.238649910041639,0.26191928538831477 +-28,270,1.0311966604702554,0.5895434092846242,0.15345091819340728 +126,-302,1.411648528796071,1.777174362055833,0.8674693233586825 +-309,-90,1.5880641542848422,1.3079566974356873,0.6159138085551911 +98,282,2.4727893317682095,0.16410522369558067,0.5891181999947753 +-360,-307,0.18202784197690525,2.088248621270804,0.790863512697301 +47,266,2.101895232599838,2.3702648363258256,0.46954413458672994 +-393,-1,0.737838403814684,1.1968533588911252,0.7551660755859227 +170,-209,0.48417582177291785,2.144191075867316,0.038816695326699735 +1,302,0.5703912539762755,2.227208464521694,0.9796998012638584 +-376,229,2.784522537178727,0.5462976940291452,0.5381006494293263 +-176,-324,2.07660392471754,0.2885306488509497,0.5936154783038528 +-25,221,1.316394742641427,1.6158447350417964,0.15712432524021414 +127,-44,1.7124919284346798,2.7081118614499036,0.6456632220773864 +-385,327,0.22935687117228987,2.1192732430140273,0.37135981037395305 +281,261,2.9859706896284703,1.4981341717265284,0.18935724670940768 +306,-316,2.162141939137004,2.0511256491092666,0.3803605862256435 +-132,93,0.39445301189107906,1.1196122612533213,0.7485028098350831 +230,-7,1.4231984353836835,2.9363514933026713,0.5553543608297385 +394,63,1.2972758628952126,2.2755240950509945,0.5394862588032763 +197,138,1.2342164639886608,1.7743078869511353,0.694618348310554 +-282,-115,1.134231652846375,1.272103251451663,0.1568988295089564 +-20,143,1.0321661362843995,2.9710768639507386,0.8307073124401463 +203,-118,2.4519818757280314,0.14296002834339427,0.18366658375911582 +-266,-128,1.218034790709937,0.07867459620671968,0.6294674249266942 +-366,232,2.055604079666157,1.6686194070174885,0.968675348119671 +-346,-251,1.5655138094997592,0.3203201411429405,0.8236010194473256 +-359,-61,1.90532438963449,2.868001613235838,0.8492610068012004 +-167,228,1.8868907824247383,0.872944405519393,0.8839336077107415 +377,160,1.1038720030462752,2.095373228187911,0.8626984507728636 +-3,287,0.27006179275552933,2.6672389864624106,0.4600186067708061 +-1,41,2.9399704963590487,0.3661302381358299,0.8731412264322939 +224,294,2.174422954440301,1.3630248076750853,0.6479051705768336 +64,-209,0.5006080881269637,1.4731411864597963,0.5609287947908812 +359,-159,2.781068082120119,0.36483936172804543,0.46934899944413033 +-386,-333,2.627605305155238,2.81879801636269,0.21797362226807548 +159,-363,1.8296872585084578,1.738003608060767,0.17659856625453663 +-67,-127,1.2015387356426517,1.045115476601595,0.6293768054970074 +216,76,1.0278350558592728,0.5645937009686522,0.04480261830392196 +-101,257,0.6111950118826055,2.4856920538974365,0.5460909664544328 +214,356,2.055300093215346,2.7452296648943704,0.5398793642589987 +-132,-168,0.13226841705972003,0.6578113499064332,0.15112338119344348 +-180,-174,2.187670476303767,1.1061536665406866,0.6122691317701265 +32,-246,2.8218631469200104,0.40328334654472175,0.4477383021964224 +-291,266,0.2500602636967626,0.5529709159639189,0.88606916285809 +-332,82,0.6195524251677087,1.126615486735835,0.39051204287264474 +-60,243,1.9636625524781415,2.525491093399209,0.37251708932909167 +-132,293,2.178248997624747,1.429579646784783,0.4478825079332577 +326,390,0.4521335899041796,1.1984802047224954,0.9142629335209334 +178,-197,0.5097953530886101,2.998306807501207,0.753248246623865 +23,365,1.392320043919847,0.4132606630660689,0.16707913371826344 +-151,-241,1.5601047286447065,0.75624352718793,0.3285017525489565 +-286,-199,2.37582453656689,0.12802560509365624,0.4095472194625762 +-199,171,1.871308611622664,2.622699991785651,0.9539180259644003 +218,-155,1.4310269478812119,0.4738779161401889,0.4422777906901961 +-229,189,2.6647911930746955,2.8750637181111087,0.8925248308396273 +188,-194,0.7607120327263122,0.5482140496859026,0.5745032092957143 +-88,72,1.4468674397729426,0.3699738475195856,0.24246522311834984 +144,-246,1.6543937759851468,0.998589505668302,0.5360393111659322 +79,-125,1.6423412527966437,1.095375363364667,0.9078040496997228 +233,-348,1.550324510124587,1.2694388324320607,0.32324801728232644 +-236,-39,2.5404175550285886,0.17290919809648808,0.6312688845932634 +217,201,1.1254133522591963,2.8823704563967727,0.4229475398204372 +78,-36,0.2979245072968194,0.8602127526093714,0.6413673282119657 +-35,233,1.35221170523935,1.9205256130388295,0.16151865485963046 +172,-127,1.5051744527806155,1.31731343527407,0.09653293406581553 +-186,-218,1.0655208339145346,0.7584308973722128,0.828779955020996 +-90,213,2.9665216176354363,2.523262343093061,0.5286929686243687 +-313,-168,1.1266300497755524,1.3665089572670581,0.23390552562851086 +24,-211,1.3522842787380773,2.3143248668118095,0.4464351875831345 +55,96,1.0824117359333765,2.2104309672803004,0.5180047881200737 +135,-155,0.11566472605499667,2.613205817457508,0.9973719920192246 +343,111,2.637808581888506,1.177133388752945,0.16000714172895658 +95,-355,2.66817200407264,2.1095176487249003,0.07001106543974378 +340,-340,0.5775272004572912,1.2544544465695662,0.4310249065249119 +-62,237,0.06329859079181088,0.044456377151335436,0.007839443252667389 +37,-221,0.7372980644892051,2.1306310301779585,0.6473995286165075 +300,238,0.7955889917345178,2.848674086936749,0.6081614597838828 +303,68,0.36686044641191307,2.313288323779466,0.42255477498349026 +-280,-263,2.9845784232958392,1.2402962715719226,0.6649202956727496 +52,-196,1.4847797389847042,0.019623518928138517,0.8908586466086831 +-181,174,1.6132874230807697,2.83112818108947,0.006732164610376401 +-90,63,1.736334221705079,1.5111891691461579,0.5827319324126738 +34,-372,0.40083374788924464,2.378314109675479,0.9011687528906982 +-232,-170,2.7945532148461587,2.944507029144128,0.0033065532021496757 +87,154,2.344375710918334,1.9145611676268326,0.9466691259563019 +140,385,1.306015051202896,2.3100762279402622,0.5316964168610919 +-9,-105,2.534145919356762,2.313905911363942,0.565938570048561 +-372,-350,2.094880548851239,0.403139645433083,0.6141845571363068 +170,127,1.6394369519281693,0.6853999514425644,0.9034292892544574 +301,338,1.6679314646039023,2.238984907671082,0.7500496132398561 +246,-18,2.379083948092288,0.08128118116619643,0.8869206671047439 +304,-153,2.696662507211357,1.5701225444967257,0.1693667177629654 +-224,-268,0.08636510958586463,0.08227725224805083,0.6597923966469614 +105,-186,2.0007798491247426,1.5152382425208848,0.6106587919110862 +-3,383,0.4298123520956213,2.3623126134575014,0.5883124011920209 +-399,272,2.636226843555476,1.540718054353221,0.10019919404905075 +-216,237,2.3416291523841513,2.248146007936884,0.5166208017118565 +-73,1,1.2270862045343507,1.4537184414872772,0.27889770440006123 +231,396,1.2132440900896462,0.8579712744904371,0.09377294085437848 +-342,-123,0.8037670350017276,0.8862482272103599,0.46024463127477844 +12,-218,0.1621057041290349,2.257538185554322,0.42733257367386035 +-54,152,1.2517315227358274,0.7693166428852565,0.5844384160429494 +186,-29,1.6615035334148285,1.9315436039709404,0.1027875077007232 diff --git a/data/simple.csv b/data/simple.csv new file mode 100644 index 0000000..d598eb5 --- /dev/null +++ b/data/simple.csv @@ -0,0 +1,8 @@ +0,-30,6,0,10 +0,30,-6,0,10 +200,0,0,-5,3 +-200,0,0,5,2 +0,300,-6,0,4 +0,-300,5,0,3 +-300,300,3,2,5 +300,-300,-3,-3,4 diff --git a/main.py b/main.py new file mode 100755 index 0000000..c80d4cf --- /dev/null +++ b/main.py @@ -0,0 +1,37 @@ +#!./venv/bin/python +import argparse + +import data +import physics + + +class Args: + filename: str + gravity: float + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + prog="n-body simulation", + description="Simulating gravitational effects" + ) + + parser.add_argument( + "-f", + "--filename", + default="data/simple.csv" + ) + parser.add_argument( + "-g", + "--gravity", + type=float, + default=1. + ) + + args: Args = parser.parse_args() + + physics.G = args.gravity + + objects = data.parse_csv(args.filename) + a = data.Animator(*objects) + a.show() diff --git a/physics.py b/physics.py new file mode 100644 index 0000000..a779c3b --- /dev/null +++ b/physics.py @@ -0,0 +1,20 @@ +import numpy as np + + +G = 6.674e-11 + + +def rotate(a: np.ndarray, n: int): + return np.concatenate(np.split(a, [n])[::-1]) + + +def rotations(a: np.ndarray): + for i in range(1, len(a)): + yield rotate(a, i) + + +def n_body(pos: np.ndarray, vel: np.ndarray, mass: np.ndarray): + for (o_pos, o_mass) in zip(rotations(pos), rotations(mass)): + dist = o_pos - pos + vel += G * (dist / np.linalg.norm(dist, axis=1)[:, np.newaxis]) * o_mass[:, np.newaxis] / np.sum(dist ** 2, axis=1)[:, np.newaxis] + pos += vel diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2e5db94 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,11 @@ +contourpy==1.1.1 +cycler==0.12.1 +fonttools==4.43.1 +kiwisolver==1.4.5 +matplotlib==3.8.0 +numpy==1.26.0 +packaging==23.2 +Pillow==10.0.1 +pyparsing==3.1.1 +python-dateutil==2.8.2 +six==1.16.0