CoCalc Public FilesLab 4 / lab4quiz.sagewsOpen with one click!
Author: Kyung Jin Kim
Views : 32
Compute Environment: Ubuntu 18.04 (Deprecated)
#1 for letter in "kyung jin kim": print letter*10
kkkkkkkkkk yyyyyyyyyy uuuuuuuuuu nnnnnnnnnn gggggggggg jjjjjjjjjj iiiiiiiiii nnnnnnnnnn kkkkkkkkkk iiiiiiiiii mmmmmmmmmm
for n in srange(1,10+1): print "Kyung Jin Kim"
Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim Kyung Jin Kim
#2 list2=srange(0,50+0.1,0.1) list2
#3 f(N)= 0.2*N*(1-(N/100)) f(10) f(10.1) f(10.2)
1.80000000000000 1.81598000000000 1.83192000000000
10+f(10.2)
11.8319200000000
def eulers (N1,num): f(N)= 0.2*N*(1-(N/100)) count = srange(0,num,step) nprime=[N1] for i in count: b=f(nprime[i]) nprime.append(10+b) return nprime eulers(10,2/10, 1/10)
Error in lines 9-9 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 996, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> TypeError: eulers() takes exactly 2 arguments (3 given)
def Euler (DE, init, stepSize, numSteps): f(x)=DE times= srange(0, numSteps, stepSize) pop= [init] for t in times: old = pop[-1] new= old + (f(old)*stepSize) pop.append(new) return pop Euler (0.2*x*(1-(x/100)), 10, 0.1, 100.1)
#iterate previous procedure to find population value at t=100 pop = [10] #creates list with initial state as first element count = srange #5 def eulers (myFunction, initPop, numSteps, stepSize): f(x)= myFunction population=[initPop] count = srange(0,numSteps,stepSize) for i in count: old = population[-1] new = f(population[i])*stepSize + old population.append(new) return population eulers (0.2*N*(1-(N/100)), 10, 100.1, 0.1)
[10, 10.1800000000000, 10.3628735200000, 10.5486531608817, 10.7373714073976, 10.9290606065975, 11.1237529455809, 11.3214804285737, 11.5222748533262, 11.7261677868336, 11.9331905403773, 12.1433741438903, 12.3567493196484, 12.5733464552916, 12.7931955761805, 13.0163263170940, 13.2427678932773, 13.4725490708478, 13.7056981365714, 13.9422428670207, 14.1822104971285, 14.4256276881541, 14.6725204950778, 14.9229143334436, 15.1768339456718, 15.4343033668624, 15.6953458901155, 15.9599840313958, 16.2282394939672, 16.5001331324319, 16.7756849164029, 17.0549138938481, 17.3378381541397, 17.6244747908507, 17.9148398643370, 18.2089483641508, 18.5068141713282, 18.8084500206003, 19.1138674625768, 19.4230768259530, 19.7360871797947, 20.0529062959569, 20.3735406116931, 20.6979951925157, 21.0262736953681, 21.3583783321730, 21.6943098338204, 22.0340674146637, 22.3776487375901, 22.7250498797374, 23.0762652989248, 23.4312878008740, 23.7901085072900, 24.1527168248781, 24.5191004153711, 24.8892451666427, 25.2631351649825, 25.6407526686093, 26.0220780824990, 26.4070899346026, 26.7957648535318, 27.1880775477853, 27.5840007865921, 27.9835053824450, 28.3865601753961, 28.7931320191857, 29.2031857692746, 29.6166842728451, 30.0335883608386, 30.4538568420897, 30.8774464996198, 31.3043120891448, 31.7344063398528, 32.1676799575012, 32.6040816298816, 33.0435580346936, 33.4860538498691, 33.9315117663792, 34.3798725035564, 34.8310748269554, 35.2850555687743, 35.7417496508515, 36.2010901102477, 36.6630081274186, 37.1274330569767, 37.5942924610362, 38.0635121451277, 38.5350161966658, 39.0087270259437, 39.4845654096256, 39.9624505367008, 40.4423000568551, 40.9240301312145, 41.4075554854027, 41.8927894648554, 42.3796440923231, 42.8680301274912, 43.3578571286387, 43.8490335162540, 44.3414666385172, 44.8350628385566, 45.3297275233803, 45.8253652343791, 46.3218797192938, 46.8191740055340, 47.3171504747325, 47.8157109384175, 48.3147567146766, 48.8141887056904, 49.3139074760053, 49.8138133314150, 50.3138063983199, 50.8137867034288, 51.3136542536690, 51.8133091161694, 52.3126514981792, 52.8115818267888, 53.3100008283151, 53.8078096072184, 54.3049097244174, 54.8012032748703, 55.2965929642930, 55.7909821848871, 56.2842750899540, 56.7763766672728, 57.2671928111254, 57.7566303928546, 58.2445973298443, 58.7310026528181, 59.2157565713534, 59.6987705375169, 60.1799573075290, 60.6592310013724, 61.1365071602642, 61.6117028019181, 62.0847364735261, 62.5555283023992, 63.0240000442087, 63.4900751287784, 63.9536787033824, 64.4147376735109, 64.8731807410717, 65.3289384400004, 65.7819431692609, 66.2321292232214, 66.6794328193975, 67.1237921235621, 67.5651472722240, 68.0034403924850, 68.4386156192918, 68.8706191101006, 69.2993990569809, 69.7249056961888, 70.1470913152441, 70.5659102575511, 70.9813189246068, 71.3932757758436, 71.8017413261593, 72.2066781411888, 72.6080508303755, 73.0058260379057, 73.3999724315685, 73.7904606896088, 74.1772634856441, 74.5603554717132, 74.9397132595338, 75.3153154000403, 75.6871423612796, 76.0551765047418, 76.4194020602032, 76.7798050991594, 77.1363735069297, 77.4890969535081, 77.8379668632443, 78.1829763834284, 78.5241203518627, 78.8613952634932, 79.1947992361820, 79.5243319756938, 79.8499947399716, 80.1717903027764, 80.4897229167615, 80.8037982760533, 81.1140234784069, 81.4204069870039, 81.7229585919581, 82.0216893715927, 82.3166116535506, 82.6077389757973, 82.8950860475745, 83.1786687103591, 83.4585038988807, 83.7346096022504, 84.0070048252472, 84.2757095498103, 84.5407446967817, 84.8021320879401, 85.0598944083668, 85.3140551691816, 85.5646386706832, 85.8116699659280, 86.0551748247783, 86.2951796984492, 86.5317116845807, 86.7647984928596, 86.9944684112155, 87.2207502726098, 87.4436734224386, 87.6632676865654, 87.8795633399994, 88.0925910762336, 88.3023819772534, 88.5089674842271, 88.7123793688868, 88.9126497056067, 89.1098108441845, 89.3038953833309, 89.4949361448701, 89.6829661486526, 89.8680185881816, 90.0501268069521, 90.2293242755015, 90.4056445691688, 90.5791213465588, 90.7497883287071, 90.9176792789402, 91.0828279834253, 91.2452682324022, 91.4050338020896, 91.5621584372592, 91.7166758344664, 91.8686196259308, 92.0180233640546, 92.1649205065702, 92.3093444023051, 92.4513282775545, 92.5909052230488, 92.7281081815050, 92.8629699357510, 92.9955230974084, 93.1258000961244, 93.2538331693382, 93.3796543525700, 93.5032954702203, 93.6247881268665, 93.7441636990437, 93.8614533274979, 93.9766879098979, 94.0898980939930, 94.2011142712052, 94.3103665706420, 94.4176848535171, 94.5230987079678, 94.6266374442559, 94.7283300903397, 94.8282053878057, 94.9262917881474, 95.0226174493806, 95.1172102329820, 95.2100977011406, 95.3013071143112, 95.3908654290582, 95.4787992961784, 95.5651350590940, 95.6498987525033, 95.7331161012805, 95.8148125196139, 95.8950131103724, 95.9737426646922, 96.0510256617723, 96.1268862688721, 96.2013483414998, 96.2744354237853, 96.3461707490273, 96.4165772404076, 96.4856775118647, 96.5534938691173, 96.6200483108329, 96.6853625299320, 96.7494579150218, 96.8123555519521, 96.8740762254876, 96.9346404210890, 96.9940683267977, 97.0523798352169, 97.1095945455854, 97.1657317659355, 97.2208105153323, 97.2748495261873, 97.3278672466426, 97.3798818430194, 97.4309112023277, 97.4809729348311, 97.5300843766635, 97.5782625924929, 97.6255243782289, 97.6718862637686, 97.7173645157795, 97.7619751405131, 97.8057338866485, 97.8486562481603, 97.8907574672094, 97.9320525370528, 97.9725562049698, 98.0122829752020, 98.0512471119038, 98.0894626421020, 98.1269433586608, 98.1637028232512, 98.1997543693219, 98.2351111050693, 98.2697859164057, 98.3037914699225, 98.3371402158486, 98.3698443909993, 98.4019160217174, 98.4333669268027, 98.4642087204294, 98.4944528150500, 98.5241104242837, 98.5531925657901, 98.5817100641240, 98.6096735535730, 98.6370934809761, 98.6639801085206, 98.6903435165201, 98.7161936061688, 98.7415401022740, 98.7663925559657, 98.7907603473812, 98.8146526883261, 98.8380786249097, 98.8610470401551, 98.8835666565831, 98.9056460387694, 98.9272935958755, 98.9485175841521, 98.9693261094149, 98.9897271294928, 99.0097284566484, 99.0293377599695, 99.0485625677333, 99.0674102697411, 99.0858881196253, 99.1040032371268, 99.1217626103445, 99.1391730979551, 99.1562414314049, 99.1729742170724, 99.1893779384018, 99.2054589580084, 99.2212235197548, 99.2366777507984, 99.2518276636112, 99.2666791579700, 99.2812380229192, 99.2955099387048, 99.3095004786814, 99.3232151111900, 99.3366592014091, 99.3498380131779, 99.3627567107925, 99.3754203607747, 99.3878339336141, 99.4000023054832, 99.4119302599269, 99.4236224895245, 99.4350835975271, 99.4463180994682, 99.4573304247495, 99.4681249182009, 99.4787058416163, 99.4890773752641, 99.4992436193731, 99.5092085955951, 99.5189762484427, 99.5285504467039, 99.5379349848336, 99.5471335843213, 99.5561498950368, 99.5649874965529, 99.5736498994462, 99.5821405465756, 99.5904628143396, 99.5986200139115, 99.6066153924546, 99.6144521343156, 99.6221333621980, 99.6296621383148, 99.6370414655222, 99.6442742884322, 99.6513634945072, 99.6583119151344, 99.6651223266823, 99.6717974515374, 99.6783399591241, 99.6847524669052, 99.6910375413657, 99.6971976989782, 99.7032354071519, 99.7091530851642, 99.7149531050753, 99.7206377926274, 99.7262094281262, 99.7316702473083, 99.7370224421909, 99.7422681619079, 99.7474095135296, 99.7524485628683, 99.7573873352681, 99.7622278163817, 99.7669719529318, 99.7716216534590, 99.7761787890560, 99.7806451940880, 99.7850226669001, 99.7893129705113, 99.7935178332962, 99.7976389496532, 99.8016779806612, 99.8056365547233, 99.8095162681991, 99.8133186860247, 99.8170453423216, 99.8206977409938, 99.8242773563139, 99.8277856334982, 99.8312239892706, 99.8345938124168, 99.8378964643271, 99.8411332795293, 99.8443055662117, 99.8474146067362, 99.8504616581410, 99.8534479526350, 99.8563746980818, 99.8592430784747, 99.8620542544030, 99.8648093635092, 99.8675095209374, 99.8701558197732, 99.8727493314755, 99.8752911062995, 99.8777821737119, 99.8802235427982, 99.8826162026623, 99.8849611228179, 99.8872592535729, 99.8895115264063, 99.8917188543376, 99.8938821322895, 99.8960022374434, 99.8980800295876, 99.9001163514598, 99.9021120290819, 99.9040678720893, 99.9059846740529, 99.9078632127955, 99.9097042507021, 99.9115085350236, 99.9132767981752, 99.9150097580290, 99.9167081182002, 99.9183725683287, 99.9200037843546, 99.9216024287886, 99.9231691509770, 99.9247045873616, 99.9262093617345, 99.9276840854882, 99.9291293578601, 99.9305457661733, 99.9319338860717, 99.9332942817511, 99.9346275061855, 99.9359341013492, 99.9372145984344, 99.9384695180644, 99.9396993705030, 99.9409046558598, 99.9420858642906, 99.9432434761954, 99.9443779624109, 99.9454897844005, 99.9465793944397, 99.9476472357987, 99.9486937429204, 99.9497193415956, 99.9507244491347, 99.9517094745360, 99.9526748186504, 99.9536208743428, 99.9545480266513, 99.9554566529419, 99.9563471230611, 99.9572197994851, 99.9580750374663, 99.9589131851765, 99.9597345838477, 99.9605395679100, 99.9613284651267, 99.9621015967266, 99.9628592775343, 99.9636018160970, 99.9643295148095, 99.9650426700366, 99.9657415722329, 99.9664265060602, 99.9670977505031, 99.9677555789815, 99.9684002594613, 99.9690320545634, 99.9696512216694, 99.9702580130263, 99.9708526758486, 99.9714354524184, 99.9720065801833, 99.9725662918533, 99.9731148154946, 99.9736523746221, 99.9741791882902, 99.9746954711815, 99.9752014336941, 99.9756972820264, 99.9761832182614, 99.9766594404484, 99.9771261426831, 99.9775835151868, 99.9780317443833, 99.9784710129747, 99.9789015000158, 99.9793233809861, 99.9797368278619, 99.9801420091854, 99.9805390901338, 99.9809282325857, 99.9813095951875, 99.9816833334175, 99.9820495996491, 99.9824085432128, 99.9827603104566, 99.9831050448061, 99.9834428868221, 99.9837739742580, 99.9840984421161, 99.9844164227019, 99.9847280456782, 99.9850334381182, 99.9853327245562, 99.9856260270393, 99.9859134651763, 99.9861951561867, 99.9864712149482, 99.9867417540436, 99.9870068838065, 99.9872667123662, 99.9875213456915, 99.9877708876343, 99.9880154399714, 99.9882551024460, 99.9884899728086, 99.9887201468563, 99.9889457184722, 99.9891667796633, 99.9893834205983, 99.9895957296440, 99.9898037934013, 99.9900076967408, 99.9902075228367, 99.9904033532015, 99.9905952677183, 99.9907833446742, 99.9909676607913, 99.9911482912589, 99.9913253097632, 99.9914987885178, 99.9916687982934, 99.9918354084457, 99.9919986869447, 99.9921587004016, 99.9923155140964, 99.9924691920042, 99.9926197968215, 99.9927673899916, 99.9929120317296, 99.9930537810472, 99.9931926957762, 99.9933288325928, 99.9934622470401, 99.9935929935508, 99.9937211254699, 99.9938466950756, 99.9939697536015, 99.9940903512567, 99.9942085372467, 99.9943243597936, 99.9944378661551, 99.9945491026446, 99.9946581146492, 99.9947649466491, 99.9948696422350, 99.9949722441261, 99.9950727941880, 99.9951713334487, 99.9952679021166, 99.9953625395957, 99.9954552845026, 99.9955461746816, 99.9956352472207, 99.9957225384661, 99.9958080840374, 99.9958919188422, 99.9959740770901, 99.9960545923067, 99.9961334973473, 99.9962108244104, 99.9962866050506, 99.9963608701917, 99.9964336501393, 99.9965049745927, 99.9965748726578, 99.9966433728583, 99.9967105031478, 99.9967762909207, 99.9968407630238, 99.9969039457672, 99.9969658649347, 99.9970265457948, 99.9970860131107, 99.9971442911502, 99.9972014036962, 99.9972573740558, 99.9973122250703, 99.9973659791241, 99.9974186581540, 99.9974702836582, 99.9975208767052, 99.9975704579418, 99.9976190476025, 99.9976666655166, 99.9977133311174, 99.9977590634493, 99.9978038811760, 99.9978478025878, 99.9978908456097, 99.9979330278078, 99.9979743663972, 99.9980148782486, 99.9980545798955, 99.9980934875406, 99.9981316170629, 99.9981689840234, 99.9982056036724, 99.9982414909550, 99.9982766605174, 99.9983111267131, 99.9983449036084, 99.9983780049884, 99.9984104443624, 99.9984422349698, 99.9984733897851, 99.9985039215233, 99.9985338426452, 99.9985631653623, 99.9985919016422, 99.9986200632128, 99.9986476615677, 99.9986747079706, 99.9987012134599, 99.9987271888533, 99.9987526447522, 99.9987775915460, 99.9988020394162, 99.9988259983409, 99.9988494780984, 99.9988724882717, 99.9988950382520, 99.9989171372428, 99.9989387942634, 99.9989600181529, 99.9989808175735, 99.9990012010143, 99.9990211767945, 99.9990407530670, 99.9990599378216, 99.9990787388885, 99.9990971639410, 99.9991152204991, 99.9991329159326, 99.9991502574636, 99.9991672521699, 99.9991839069878, 99.9992002287148, 99.9992162240126, 99.9992318994095, 99.9992472613033, 99.9992623159639, 99.9992770695358, 99.9992915280406, 99.9993056973794, 99.9993195833354, 99.9993331915761, 99.9993465276556, 99.9993595970171, 99.9993724049947, 99.9993849568161, 99.9993972576041, 99.9994093123793, 99.9994211260620, 99.9994327034737, 99.9994440493399, 99.9994551682913, 99.9994660648661, 99.9994767435117, 99.9994872085867, 99.9994974643624, 99.9995075150247, 99.9995173646757, 99.9995270173356, 99.9995364769441, 99.9995457473622, 99.9995548323737, 99.9995637356866, 99.9995724609348, 99.9995810116796, 99.9995893914109, 99.9995976035489, 99.9996056514456, 99.9996135383856, 99.9996212675880, 99.9996288422075, 99.9996362653358, 99.9996435400027, 99.9996506691772, 99.9996576557693, 99.9996645026304, 99.9996712125553, 99.9996777882826, 99.9996842324962, 99.9996905478263, 99.9996967368506, 99.9997028020952, 99.9997087460356, 99.9997145710980, 99.9997202796597, 99.9997258740509, 99.9997313565548, 99.9997367294093, 99.9997419948072, 99.9997471548978, 99.9997522117870, 99.9997571675390, 99.9997620241764, 99.9997667836816, 99.9997714479971, 99.9997760190267, 99.9997804986361, 99.9997848886537, 99.9997891908714, 99.9997934070451, 99.9997975388957, 99.9998015881095, 99.9998055563395, 99.9998094452051, 99.9998132562938, 99.9998169911609, 99.9998206513310, 99.9998242382979, 99.9998277535258, 99.9998311984493, 99.9998345744747, 99.9998378829797, 99.9998411253148, 99.9998443028035, 99.9998474167426, 99.9998504684031, 99.9998534590305, 99.9998563898456, 99.9998592620446, 99.9998620767997, 99.9998648352599, 99.9998675385511, 99.9998701877766, 99.9998727840177, 99.9998753283341, 99.9998778217643, 99.9998802653260, 99.9998826600166, 99.9998850068135, 99.9998873066746, 99.9998895605386, 99.9998917693254, 99.9998939339365, 99.9998960552555, 99.9998981341483, 99.9999001714632, 99.9999021680320, 99.9999041246694, 99.9999060421742, 99.9999079213289, 99.9999097629007, 99.9999115676410, 99.9999133362867, 99.9999150695594, 99.9999167681668, 99.9999184328021, 99.9999200641447, 99.9999216628605, 99.9999232296021, 99.9999247650089, 99.9999262697075, 99.9999277443123, 99.9999291894250, 99.9999306056355, 99.9999319935218, 99.9999333536505, 99.9999346865766, 99.9999359928442, 99.9999372729865, 99.9999385275260, 99.9999397569747, 99.9999409618345, 99.9999421425971, 99.9999432997445, 99.9999444337490, 99.9999455450734, 99.9999466341713, 99.9999477014873, 99.9999487474570, 99.9999497725074, 99.9999507770567, 99.9999517615151, 99.9999527262843, 99.9999536717582, 99.9999545983226, 99.9999555063557, 99.9999563962282, 99.9999572683033, 99.9999581229368, 99.9999589604778, 99.9999597812679, 99.9999605856422, 99.9999613739290, 99.9999621464501, 99.9999629035209, 99.9999636454502, 99.9999643725409, 99.9999650850898, 99.9999657833878, 99.9999664677198, 99.9999671383652, 99.9999677955976, 99.9999684396855, 99.9999690708916, 99.9999696894735, 99.9999702956839, 99.9999708897700, 99.9999714719745, 99.9999720425348, 99.9999726016840, 99.9999731496501, 99.9999736866570, 99.9999742129237, 99.9999747286651, 99.9999752340917, 99.9999757294097, 99.9999762148214, 99.9999766905249, 99.9999771567143, 99.9999776135799, 99.9999780613082, 99.9999785000819, 99.9999789300802, 99.9999793514785, 99.9999797644488, 99.9999801691598, 99.9999805657765, 99.9999809544609, 99.9999813353716, 99.9999817086641, 99.9999820744907, 99.9999824330009, 99.9999827843408, 99.9999831286539, 99.9999834660808, 99.9999837967591, 99.9999841208239, 99.9999844384074, 99.9999847496392, 99.9999850546463, 99.9999853535534, 99.9999856464822, 99.9999859335526, 99.9999862148815, 99.9999864905838, 99.9999867607721, 99.9999870255566, 99.9999872850454, 99.9999875393445, 99.9999877885575, 99.9999880327864, 99.9999882721306, 99.9999885066880, 99.9999887365542, 99.9999889618231, 99.9999891825866, 99.9999893989348, 99.9999896109561, 99.9999898187370, 99.9999900223622, 99.9999902219149, 99.9999904174766, 99.9999906091271, 99.9999907969445, 99.9999909810056, 99.9999911613855, 99.9999913381577, 99.9999915113946, 99.9999916811666, 99.9999918475433, 99.9999920105924, 99.9999921703806, 99.9999923269729, 99.9999924804335, 99.9999926308248, 99.9999927782083, 99.9999929226441, 99.9999930641912, 99.9999932029074, 99.9999933388492, 99.9999934720722, 99.9999936026308, 99.9999937305782, 99.9999938559666, 99.9999939788472, 99.9999940992703, 99.9999942172849, 99.9999943329392, 99.9999944462804, 99.9999945573548, 99.9999946662077, 99.9999947728835, 99.9999948774258, 99.9999949798773, 99.9999950802798, 99.9999951786742, 99.9999952751007, 99.9999953695987, 99.9999954622067, 99.9999955529625, 99.9999956419033, 99.9999957290652, 99.9999958144839, 99.9999958981942, 99.9999959802304, 99.9999960606257, 99.9999961394132, 99.9999962166250, 99.9999962922925, 99.9999963664466, 99.9999964391177, 99.9999965103353, 99.9999965801286, 99.9999966485260, 99.9999967155555, 99.9999967812444, 99.9999968456195, 99.9999969087071, 99.9999969705330, 99.9999970311223, 99.9999970904999, 99.9999971486899, 99.9999972057161, 99.9999972616018, 99.9999973163697, 99.9999973700423, 99.9999974226415, 99.9999974741887, 99.9999975247049, 99.9999975742108, 99.9999976227266, 99.9999976702720, 99.9999977168666, 99.9999977625293, 99.9999978072787, 99.9999978511331, 99.9999978941105, 99.9999979362282, 99.9999979775037, 99.9999980179536, 99.9999980575945, 99.9999980964426, 99.9999981345138, 99.9999981718235, 99.9999982083870, 99.9999982442193, 99.9999982793349, 99.9999983137482, 99.9999983474732, 99.9999983805238, 99.9999984129133, 99.9999984446550]