CoCalc Shared FilesLab 4 / Lab4-turnin.sagews
Authors: Tarek Abushamma, Qi Wu
Views : 26
# Lab 1:

# Name: Tarek Abushamma
# I worked on this code with:

# Please do all of your work for this week's lab in this worksheet. If
# you wish to create other worksheets for scratch work, you can, but
# this is the one that will be graded. You do not need to do anything
# to turn in your lab. It will be collected by your TA at the beginning
# of (or right before) next week’s lab.

# Be sure to clearly label which question you are answering as you go and to


#1
# need input for function, step size, number of steps and initial value
# make list to track all the values that we obtain
# loop through list as many times as number of steps
# using initial value, iterate using euler method and update list with new values
# output values

#2.1
Nprime(N) = 0.2*N*((1-N)/100)
initial_N = 10
stepsize = 0.1
new_N = initial_N + Nprime(initial_N)*stepsize
new_N

9.98200000000000
#2.2
Nprime(N) = 0.2*N*((1-N)/100)
initial_N = [10]
stepsize = 0.1

final_t = 100
num_iter = ((final_t)/stepsize)

for a in srange (0, num_iter):
new_N = initial_N[-1]+(Nprime(initial_N[-1])*stepsize)
initial_N.append(new_N)
initial_N[-1]

3.79795164396582
#3
Nprime(N) = 0.2*N*((1-N)/100)
initial_N = [15,68,450]
stepsize = 0.1

final_t = 100
num_iter = ((final_t)/stepsize)

for a in srange (0, num_iter):
new_N = initial_N[-1]+(Nprime(initial_N[-1])*stepsize)
initial_N.append(new_N)
initial_N[-1]

5.43969334166354
#3 [ctd.]
Nprime(N) = 0.2*N*((1-N)/100)
initial_N = [200]
stepsize = 0.1

final_t = 100
num_iter = ((final_t)/stepsize)

for a in srange (0, num_iter):
new_N = initial_N[-1]+(Nprime(initial_N[-1])*stepsize)
initial_N.append(new_N)
initial_N

[200, 192.040000000000, 184.702535680000, 177.916470849812, 171.621200024051, 165.764757004517, 160.302319022965, 155.195012789941, 150.408953393525, 145.914464532017, 141.685441232990, 137.698825469759, 133.934171927703, 130.373286280097, 126.999922182258, 123.799526119835, 120.759021491560, 117.866625041538, 115.111690106810, 112.484572204982, 109.976513322595, 107.579541928741, 105.286386268807, 103.090398919352, 100.985490929266, 98.9660741518065, 97.0270106000327, 95.1635678449569, 93.3713796295296, 91.6464109986711, 89.9849273510834, 88.3834669064777, 86.8388161553773, 85.3479879203549, 83.9082017095283, 82.5168660870449, 81.1715628224968, 79.8700326128520, 78.6101621974590, 77.3899727097563, 76.2076091290949, 75.0613307130861, 73.9495023055449, 72.8705864277584, 71.8231360717789, 70.8057881239562, 69.8172573552101, 68.8563309217604, 67.9218633263433, 67.0127717954641, 66.1280320330810, 65.2666743153740, 64.4277798949993, 63.6104776865386, 62.8139412077740, 62.0373857540048, 61.2800657849173, 60.5412725055536, 59.8203316247363, 59.1166012759226, 58.4294700868945, 57.7583553859848, 57.1027015336833, 56.4619783695010, 55.8356797648953, 55.2233222738867, 54.6244438737484, 54.0386027888199, 53.4653763911040, 52.9043601718538, 52.3551667788495, 51.8174251145171, 51.2907794904402, 50.7748888341909, 50.2694259447329, 49.7740767929592, 49.2885398641995, 48.8125255397834, 48.3457555149770, 47.8879622508172, 47.4388884575602, 46.9982866076340, 46.5659184761448, 46.1415547071347, 45.7249744039178, 45.3159647419508, 44.9143206028004, 44.5198442278788, 44.1323448907094, 43.7516385865771, 43.3775477384923, 43.0099009184789, 42.6485325832592, 42.2932828234747, 41.9439971256422, 41.6005261460921, 41.2627254961950, 40.9304555382194, 40.6035811912138, 40.2819717463417, 39.9655006911364, 39.6540455421760, 39.3474876857122, 39.0457122258139, 38.7486078396148, 38.4560666392811, 38.1679840403360, 37.8842586360034, 37.6047920772507, 37.3294889582315, 37.0582567068466, 36.7910054801578, 36.5276480644057, 36.2680997793951, 36.0122783870294, 35.7601040037818, 35.5114990169103, 35.2663880042281, 35.0246976572560, 34.7863567075910, 34.5512958563350, 34.3194477064358, 34.0907466978022, 33.8651290450590, 33.6425326778203, 33.4228971833602, 33.2061637515710, 32.9922751221021, 32.7811755335800, 32.5728106748140, 32.3671276378975, 32.1640748731195, 31.9636021456054, 31.7656604936100, 31.5702021883897, 31.3771806955842, 31.1865506380427, 30.9982677600304, 30.8122888927579, 30.6285719211743, 30.4470757519725, 30.2677602827536, 30.0905863723033, 29.9155158119319, 29.7425112978355, 29.5715364044347, 29.4025555586519, 29.2355340150877, 29.0704378320612, 28.9072338484781, 28.7458896614937, 28.5863736049398, 28.4286547284845, 28.2727027774960, 28.1184881735825, 27.9659819957837, 27.8151559623851, 27.6659824133353, 27.5184342932389, 27.3724851349073, 27.2281090434421, 27.0852806808345, 26.9439752510588, 26.8041684856430, 26.6658366296988, 26.5289564283924, 26.3935051138422, 26.2594603924261, 26.1268004324843, 25.9955038524030, 25.8655497090654, 25.7369174866568, 25.6095870858111, 25.4835388130872, 25.3587533707621, 25.2352118469325, 25.1128957059099, 24.9917867789039, 24.8718672549793, 24.7531196722804, 24.6355269095128, 24.5190721776729, 24.4037390120176, 24.2895112642667, 24.1763730950282, 24.0643089664412, 23.9533036350280, 23.8433421447486, 23.7344098202513, 23.6264922603122, 23.5195753314589, 23.4136451617708, 23.3086881348509, 23.2046908839643, 23.1016402863370, 22.9995234576104, 22.8983277464465, 22.7980407292791, 22.6986502052061, 22.6001441910195, 22.5025109163668, 22.4057388190418, 22.3098165404002, 22.2147329208950, 22.1204769957298, 22.0270379906253, 21.9344053176953, 21.8425685714306, 21.7515175247854, 21.6612421253641, 21.5717324917065, 21.4829789096661, 21.3949718288814, 21.3077018593354, 21.2211597680020, 21.1353364755758, 21.0502230532838, 20.9658107197758, 20.8820908380923, 20.7990549127058, 20.7166945866360, 20.6350016386342, 20.5539679804366, 20.4735856540845, 20.3938468293083, 20.3147438009747, 20.2362689865951, 20.1584149238928, 20.0811742684288, 20.0045397912827, 19.9285043767888, 19.8530610203250, 19.7782028261537, 19.7039230053125, 19.6302148735537, 19.5570718493320, 19.4844874518379, 19.4124552990761, 19.3409691059882, 19.2700226826176, 19.1996099323164, 19.1297248499923, 19.0603615203950, 18.9915141164414, 18.9231768975777, 18.8553442081778, 18.7880104759777, 18.7211702105438, 18.6548180017755, 18.5889485184399, 18.5235565067394, 18.4586367889091, 18.3941842618459, 18.3301938957665, 18.2666607328944, 18.2035798861748, 18.1409465380176, 18.0787559390661, 18.0170034069931, 17.9556843253210, 17.8947941422679, 17.8343283696175, 17.7742825816124, 17.7146524138705, 17.6554335623245, 17.5966217821822, 17.5382128869096, 17.4802027472337, 17.4225872901662, 17.3653624980476, 17.3085244076095, 17.2520691090572, 17.1959927451703, 17.1402915104209, 17.0849616501106, 17.0299994595235, 16.9754012830971, 16.9211635136093, 16.8672825913811, 16.8137550034959, 16.7605772830331, 16.7077460083176, 16.6552578021836, 16.6031093312526, 16.5512973052257, 16.4998184761896, 16.4486696379354, 16.3978476252914, 16.3473493134680, 16.2971716174153, 16.2473114911933, 16.1977659273532, 16.1485319563312, 16.0996066458535, 16.0509871003525, 16.0026704603934, 15.9546539021127, 15.9069346366659, 15.8595099096862, 15.8123770007530, 15.7655332228704, 15.7189759219547, 15.6727024763321, 15.6267102962450, 15.5809968233677, 15.5355595303304, 15.4903959202524, 15.4455035262832, 15.4008799111524, 15.3565226667271, 15.3124294135777, 15.2685978005512, 15.2250255043523, 15.1817102291316, 15.1386497060811, 15.0958416930377, 15.0532839740920, 15.0109743592059, 14.9689106838352, 14.9270908085598, 14.8855126187202, 14.8441740240595, 14.8030729583730, 14.7622073791625, 14.7215752672972, 14.6811746266805, 14.6410034839221, 14.6010598880156, 14.5613419100225, 14.5218476427604, 14.4825752004971, 14.4435227186496, 14.4046883534885, 14.3660702818469, 14.3276667008347, 14.2894758275568, 14.2514958988371, 14.2137251709459, 14.1761619193331, 14.1388044383643, 14.1016510410627, 14.0647000588542, 14.0279498413168, 13.9913987559350, 13.9550451878567, 13.9188875396552, 13.8829242310948, 13.8471536988998, 13.8115743965274, 13.7761847939445, 13.7409833774079, 13.7059686492478, 13.6711391276548, 13.6364933464708, 13.6020298549824, 13.5677472177182, 13.5336440142490, 13.4997188389910, 13.4659703010124, 13.4323970238430, 13.3989976452866, 13.3657708172360, 13.3327152054916, 13.2998294895826, 13.2671123625901, 13.2345625309743, 13.2021787144032, 13.1699596455847, 13.1379040701006, 13.1060107462436, 13.0742784448567, 13.0427059491749, 13.0112920546694, 12.9800355688940, 12.9489353113338, 12.9179901132566, 12.8871988175661, 12.8565602786569, 12.8260733622729, 12.7957369453664, 12.7655499159605, 12.7355111730123, 12.7056196262793, 12.6758741961871, 12.6462738136988, 12.6168174201873, 12.5875039673085, 12.5583324168765, 12.5293017407414, 12.5004109206674, 12.4716589482144, 12.4430448246200, 12.4145675606834, 12.3862261766518, 12.3580197021073, 12.3299471758561, 12.3020076458194, 12.2742001689250, 12.2465238110015, 12.2189776466730, 12.1915607592563, 12.1642722406589, 12.1371111912780, 12.1100767199024, 12.0831679436140, 12.0563839876920, 12.0297239855178, 12.0031870784813, 11.9767724158888, 11.9504791548716, 11.9243064602964, 11.8982535046766, 11.8723194680853, 11.8465035380684, 11.8208049095605, 11.7952227848005, 11.7697563732488, 11.7444048915063, 11.7191675632335, 11.6940436190711, 11.6690322965620, 11.6441328400737, 11.6193445007222, 11.5946665362971, 11.5700982111867, 11.5456387963057, 11.5212875690220, 11.4970438130862, 11.4729068185608, 11.4488758817510, 11.4249503051362, 11.4011293973023, 11.3774124728749, 11.3537988524539, 11.3302878625480, 11.3068788355109, 11.2835711094778, 11.2603640283032, 11.2372569414989, 11.2142492041733, 11.1913401769715, 11.1685292260155, 11.1458157228463, 11.1231990443653, 11.1006785727781, 11.0782536955374, 11.0559238052880, 11.0336882998114, 11.0115465819718, 10.9894980596628, 10.9675421457541, 10.9456782580395, 10.9239058191854, 10.9022242566799, 10.8806330027827, 10.8591314944750, 10.8377191734110, 10.8163954858694, 10.7951598827052, 10.7740118193031, 10.7529507555305, 10.7319761556914, 10.7110874884813, 10.6902842269418, 10.6695658484166, 10.6489318345076, 10.6283816710313, 10.6079148479765, 10.5875308594617, 10.5672292036935, 10.5470093829256, 10.5268709034175, 10.5068132753947, 10.4868360130090, 10.4669386342989, 10.4471206611509, 10.4273816192614, 10.4077210380985, 10.3881384508647, 10.3686333944600, 10.3492054094452, 10.3298540400057, 10.3105788339161, 10.2913793425048, 10.2722551206191, 10.2532057265906, 10.2342307222015, 10.2153296726509, 10.1965021465213, 10.1777477157458, 10.1590659555758, 10.1404564445490, 10.1219187644572, 10.1034525003152, 10.0850572403300, 10.0667325758700, 10.0484781014343, 10.0302934146236, 10.0121781161098, 9.99413180960732, 9.97615410184368, 9.95824460253130, 9.94040292433904, 9.92262868286427, 9.90492149660524, 9.88728098693378, 9.86970677806825, 9.85219849704685, 9.83475577370122, 9.81737824063029, 9.80006553317450, 9.78281728939023, 9.76563315002459, 9.74851275849042, 9.73145576084163, 9.71446180574875, 9.69753054447483, 9.68066163085152, 9.66385472125549, 9.64710947458503, 9.63042555223702, 9.61380261808404, 9.59724033845176, 9.58073838209665, 9.56429642018383, 9.54791412626524, 9.53159117625798, 9.51532724842297, 9.49912202334374, 9.48297518390553, 9.46688641527460, 9.45085540487771, 9.43488184238191, 9.41896541967444, 9.40310583084297, 9.38730277215594, 9.37155594204314, 9.35586504107658, 9.34022977195143, 9.32464983946725, 9.30912495050941, 9.29365481403067, 9.27823914103301, 9.26287764454957, 9.24757003962690, 9.23231604330727, 9.21711537461123, 9.20196775452037, 9.18687290596023, 9.17183055378337, 9.15684042475266, 9.14190224752473, 9.12701575263358, 9.11218067247434, 9.09739674128727, 9.08266369514186, 9.06798127192107, 9.05334921130587, 9.03876725475977, 9.02423514551357, 9.00975262855037, 8.99531945059055, 8.98093536007703, 8.96660010716067, 8.95231344368576, 8.93807512317569, 8.92388490081882, 8.90974253345438, 8.89564777955858, 8.88160039923089, 8.86760015418042, 8.85364680771237, 8.83974012471477, 8.82587987164521, 8.81206581651780, 8.79829772889017, 8.78457537985071, 8.77089854200583, 8.75726698946740, 8.74368049784033, 8.73013884421023, 8.71664180713124, 8.70318916661390, 8.68978070411325, 8.67641620251696, 8.66309544613360, 8.64981822068106, 8.63658431327503, 8.62339351241763, 8.61024560798611, 8.59714039122174, 8.58407765471871, 8.57105719241320, 8.55807879957256, 8.54514227278454, 8.53224740994667, 8.51939401025575, 8.50658187419740, 8.49381080353576, 8.48108060130321, 8.46839107179031, 8.45574202053572, 8.44313325431625, 8.43056458113709, 8.41803581022197, 8.40554675200358, 8.39309721811396, 8.38068702137504, 8.36831597578926, 8.35598389653029, 8.34369059993378, 8.33143590348829, 8.31921962582620, 8.30704158671482, 8.29490160704748, 8.28279950883477, 8.27073511519582, 8.25870825034971, 8.24671873960691, 8.23476640936079, 8.22285108707931, 8.21097260129667, 8.19913078160508, 8.18732545864663, 8.17555646410520, 8.16382363069847, 8.15212679216998, 8.14046578328129, 8.12884043980419, 8.11725059851299, 8.10569609717688, 8.09417677455236, 8.08269247037573, 8.07124302535567, 8.05982828116587, 8.04844808043773, 8.03710226675312, 8.02579068463722, 8.01451317955142, 8.00326959788629, 7.99205978695458, 7.98088359498432, 7.96974087111198, 7.95863146537566, 7.94755522870841, 7.93651201293147, 7.92550167074778, 7.91452405573532, 7.90357902234071, 7.89266642587270, 7.88178612249586, 7.87093796922420, 7.86012182391497, 7.84933754526240, 7.83858499279156, 7.82786402685227, 7.81717450861306, 7.80651630005516, 7.79588926396657, 7.78529326393616, 7.77472816434785, 7.76419383037481, 7.75369012797376, 7.74321692387923, 7.73277408559796, 7.72236148140330, 7.71197898032969, 7.70162645216714, 7.69130376745583, 7.68101079748067, 7.67074741426596, 7.66051349057012, 7.65030889988039, 7.64013351640765, 7.62998721508122, 7.61986987154378, 7.60978136214624, 7.59972156394273, 7.58969035468563, 7.57968761282057, 7.56971321748154, 7.55976704848605, 7.54984898633028, 7.53995891218426, 7.53009670788721, 7.52026225594277, 7.51045543951432, 7.50067614242044, 7.49092424913023, 7.48119964475881, 7.47150221506282, 7.46183184643589, 7.45218842590428, 7.44257184112243, 7.43298198036860, 7.42341873254057, 7.41388198715136, 7.40437163432490, 7.39488756479193, 7.38542966988571, 7.37599784153792, 7.36659197227455, 7.35721195521181, 7.34785768405207, 7.33852905307986, 7.32922595715790, 7.31994829172312, 7.31069595278276, 7.30146883691051, 7.29226684124262, 7.28308986347409, 7.27393780185490, 7.26481055518622, 7.25570802281670, 7.24663010463879, 7.23757670108503, 7.22854771312443, 7.21954304225887, 7.21056259051952, 7.20160626046326, 7.19267395516921, 7.18376557823516, 7.17488103377420, 7.16602022641120, 7.15718306127941, 7.14836944401714, 7.13957928076431, 7.13081247815920, 7.12206894333509, 7.11334858391704, 7.10465130801856, 7.09597702423846, 7.08732564165760, 7.07869706983575, 7.07009121880842, 7.06150799908373, 7.05294732163932, 7.04440909791928, 7.03589323983110, 7.02739965974260, 7.01892827047900, 7.01047898531987, 7.00205171799621, 6.99364638268751, 6.98526289401883, 6.97690116705793, 6.96856111731236, 6.96024266072668, 6.95194571367958, 6.94367019298113, 6.93541601586995, 6.92718310001048, 6.91897136349027, 6.91078072481721, 6.90261110291687, 6.89446241712983, 6.88633458720902, 6.87822753331706, 6.87014117602371, 6.86207543630321, 6.85403023553177, 6.84600549548496, 6.83800113833521, 6.83001708664931, 6.82205326338585, 6.81410959189283, 6.80618599590515, 6.79828239954216, 6.79039872730528, 6.78253490407559, 6.77469085511140, 6.76686650604596, 6.75906178288504, 6.75127661200464, 6.74351092014868, 6.73576463442668, 6.72803768231149, 6.72032999163703, 6.71264149059605, 6.70497210773792, 6.69732177196636, 6.68969041253730, 6.68207795905669, 6.67448434147832, 6.66690949010169, 6.65935333556987, 6.65181580886739, 6.64429684131814, 6.63679636458329, 6.62931431065922, 6.62185061187545, 6.61440520089263, 6.60697801070049, 6.59956897461585, 6.59217802628063, 6.58480509965985, 6.57745012903968, 6.57011304902549, 6.56279379453990, 6.55549230082088, 6.54820850341982, 6.54094233819965, 6.53369374133296, 6.52646264930012, 6.51924899888744, 6.51205272718531, 6.50487377158642, 6.49771206978389, 6.49056755976948, 6.48344017983185, 6.47632986855472, 6.46923656481517, 6.46216020778182, 6.45510073691317, 6.44805809195581, 6.44103221294276, 6.43402304019171, 6.42703051430341, 6.42005457615991, 6.41309516692297, 6.40615222803235, 6.39922570120421, 6.39231552842946, 6.38542165197215, 6.37854401436785, 6.37168255842208, 6.36483722720870, 6.35800796406837, 6.35119471260695, 6.34439741669398, 6.33761602046113, 6.33085046830066, 6.32410070486393, 6.31736667505985, 6.31064832405343, 6.30394559726426, 6.29725844036506, 6.29058679928019, 6.28393062018419, 6.27728984950037, 6.27066443389934, 6.26405432029760, 6.25745945585614, 6.25087978797897, 6.24431526431181, 6.23776583274065, 6.23123144139038, 6.22471203862342, 6.21820757303839, 6.21171799346872, 6.20524324898134, 6.19878328887533, 6.19233806268061, 6.18590752015665, 6.17949161129109, 6.17309028629855, 6.16670349561925, 6.16033118991779, 6.15397332008188, 6.14762983722104, 6.14130069266539, 6.13498583796438, 6.12868522488556, 6.12239880541340, 6.11612653174797, 6.10986835630385, 6.10362423170884, 6.09739411080280, 6.09117794663647, 6.08497569247028, 6.07878730177318, 6.07261272822150, 6.06645192569775, 6.06030484828953, 6.05417145028835, 6.04805168618851, 6.04194551068599, 6.03585287867730, 6.02977374525843, 6.02370806572368, 6.01765579556461, 6.01161689046895, 6.00559130631949, 5.99957899919304, 5.99357992535937, 5.98759404128011, 5.98162130360773, 5.97566166918450, 5.96971509504142, 5.96378153839724, 5.95786095665737, 5.95195330741293, 5.94605854843969, 5.94017663769708, 5.93430753332721, 5.92845119365386, 5.92260757718148, 5.91677664259426, 5.91095834875511, 5.90515265470472, 5.89935951966058, 5.89357890301607, 5.88781076433946, 5.88205506337299, 5.87631176003196, 5.87058081440375, 5.86486218674694, 5.85915583749038, 5.85346172723228, 5.84777981673929, 5.84211006694563, 5.83645243895215, 5.83080689402551, 5.82517339359724, 5.81955189926286, 5.81394237278107, 5.80834477607282, 5.80275907122049, 5.79718522046701, 5.79162318621502, 5.78607293102605, 5.78053441761962, 5.77500760887249, 5.76949246781775, 5.76398895764408, 5.75849704169484, 5.75301668346733, 5.74754784661198, 5.74209049493148, 5.73664459238007, 5.73121010306269, 5.72578699123421, 5.72037522129866, 5.71497475780843, 5.70958556546352, 5.70420760911074, 5.69884085374299, 5.69348526449848, 5.68814080665997, 5.68280744565403, 5.67748514705028, 5.67217387656069, 5.66687360003882, 5.66158428347906, 5.65630589301597, 5.65103839492350, 5.64578175561431, 5.64053594163902, 5.63530091968557, 5.63007665657842, 5.62486311927795, 5.61966027487968, 5.61446809061364, 5.60928653384366, 5.60411557206668, 5.59895517291208, 5.59380530414100, 5.58866593364571, 5.58353702944886, 5.57841855970290, 5.57331049268939, 5.56821279681835, 5.56312544062758, 5.55804839278208, 5.55298162207333, 5.54792509741873, 5.54287878786090, 5.53784266256709, 5.53281669082853, 5.52780084205983, 5.52279508579835, 5.51779939170357, 5.51281372955649, 5.50783806925904, 5.50287238083346, 5.49791663442168, 5.49297080028475, 5.48803484880225, 5.48310875047168, 5.47819247590787, 5.47328599584244, 5.46838928112315, 5.46350230271339, 5.45862503169158, 5.45375743925060, 5.44889949669722, 5.44405117545153, 5.43921244704644, 5.43438328312703, 5.42956365545007, 5.42475353588344, 5.41995289640560, 5.41516170910503, 5.41037994617970, 5.40560757993653, 5.40084458279086, 5.39609092726593, 5.39134658599232, 5.38661153170746, 5.38188573725510, 5.37716917558477]
#4
list_plot(zip(srange(0,100,0.1), initial_N), axes_labels = ["t","N"])

#4 [ctd.]
list_plot((srange(0,100,0.1), initial_N), axes_labels = ["t","N"])

3D rendering not yet implemented
# When "zip" is omitted, the result is a cube in 3D space.

#5
a(x)=0.2*x*(1-(x/100))
def eulers_method(initial_val,num_step,step,n):
val=[initial_val]
counter=srange(0,num_step*step,step)
for i in counter:
final=val[-1]
next_value=final+(n(final)*step)
val.append(next_value)
return val
eulers_method(10,100,.1,n)

[10, 11.0000000000000, 12.1000000000000, 13.3100000000000, 14.6410000000000, 16.1051000000000, 17.7156100000000, 19.4871710000000, 21.4358881000000, 23.5794769100000, 25.9374246010000, 28.5311670611000, 31.3842837672100, 34.5227121439310, 37.9749833583241, 41.7724816941565, 45.9497298635722, 50.5447028499294, 55.5991731349223, 61.1590904484145, 67.2749994932560, 74.0024994425816, 81.4027493868398, 89.5430243255237, 98.4973267580761, 108.347059433884, 119.181765377272, 131.099941914999, 144.209936106499, 158.630929717149, 174.494022688864, 191.943424957750, 211.137767453526, 232.251544198878, 255.476698618766, 281.024368480643, 309.126805328707, 340.039485861577, 374.043434447735, 411.447777892509, 452.592555681760, 497.851811249936, 547.636992374929, 602.400691612422, 662.640760773664, 728.904836851031, 801.795320536134, 881.974852589747, 970.172337848722, 1067.18957163359, 1173.90852879695, 1291.29938167665, 1420.42931984431, 1562.47225182874, 1718.71947701162, 1890.59142471278, 2079.65056718406, 2287.61562390246, 2516.37718629271, 2768.01490492198, 3044.81639541418, 3349.29803495560, 3684.22783845116, 4052.65062229628, 4457.91568452590, 4903.70725297849, 5394.07797827634, 5933.48577610398, 6526.83435371438, 7179.51778908581, 7897.46956799439, 8687.21652479383, 9555.93817727322, 10511.5319950005, 11562.6851945006, 12718.9537139507, 13990.8490853457, 15389.9339938803, 16928.9273932683, 18621.8201325951, 20484.0021458547, 22532.4023604401, 24785.6425964841, 27264.2068561326, 29990.6275417458, 32989.6902959204, 36288.6593255124, 39917.5252580637, 43909.2777838700, 48300.2055622570, 53130.2261184827, 58443.2487303310, 64287.5736033641, 70716.3309637005, 77787.9640600706, 85566.7604660776, 94123.4365126854, 103535.780163954, 113889.358180349, 125278.293998384, 137806.123398223]
#6
a(x)=0.2*x*(1-(x/100))
def eulers_method(initial_val,time_final,step,function):
val=[initial_val]
time=[0]
counter=srange(0,time_final,step)
for i in counter:
new_time=time[-1]+step
time.append(new_time)
final=val[-1]
next_value=final+(function(final)*step)
val.append(next_value)
list_one=zip(time,val)
return list_one
eulers_method(10,10,.1,n)

[(0, 10), (0.100000000000000, 11.0000000000000), (0.200000000000000, 12.1000000000000), (0.300000000000000, 13.3100000000000), (0.400000000000000, 14.6410000000000), (0.500000000000000, 16.1051000000000), (0.600000000000000, 17.7156100000000), (0.700000000000000, 19.4871710000000), (0.800000000000000, 21.4358881000000), (0.900000000000000, 23.5794769100000), (1.00000000000000, 25.9374246010000), (1.10000000000000, 28.5311670611000), (1.20000000000000, 31.3842837672100), (1.30000000000000, 34.5227121439310), (1.40000000000000, 37.9749833583241), (1.50000000000000, 41.7724816941565), (1.60000000000000, 45.9497298635722), (1.70000000000000, 50.5447028499294), (1.80000000000000, 55.5991731349223), (1.90000000000000, 61.1590904484145), (2.00000000000000, 67.2749994932560), (2.10000000000000, 74.0024994425816), (2.20000000000000, 81.4027493868398), (2.30000000000000, 89.5430243255237), (2.40000000000000, 98.4973267580761), (2.50000000000000, 108.347059433884), (2.60000000000000, 119.181765377272), (2.70000000000000, 131.099941914999), (2.80000000000000, 144.209936106499), (2.90000000000000, 158.630929717149), (3.00000000000000, 174.494022688864), (3.10000000000000, 191.943424957750), (3.20000000000000, 211.137767453526), (3.30000000000000, 232.251544198878), (3.40000000000000, 255.476698618766), (3.50000000000000, 281.024368480643), (3.60000000000000, 309.126805328707), (3.70000000000000, 340.039485861577), (3.80000000000000, 374.043434447735), (3.90000000000000, 411.447777892509), (4.00000000000000, 452.592555681760), (4.10000000000000, 497.851811249936), (4.20000000000000, 547.636992374929), (4.30000000000000, 602.400691612422), (4.40000000000000, 662.640760773664), (4.50000000000000, 728.904836851031), (4.60000000000000, 801.795320536134), (4.70000000000000, 881.974852589747), (4.80000000000000, 970.172337848722), (4.90000000000000, 1067.18957163359), (5.00000000000000, 1173.90852879695), (5.10000000000000, 1291.29938167665), (5.20000000000000, 1420.42931984431), (5.30000000000000, 1562.47225182874), (5.40000000000000, 1718.71947701162), (5.50000000000000, 1890.59142471278), (5.60000000000000, 2079.65056718406), (5.70000000000000, 2287.61562390246), (5.80000000000000, 2516.37718629271), (5.90000000000000, 2768.01490492198), (5.99999999999999, 3044.81639541418), (6.09999999999999, 3349.29803495560), (6.19999999999999, 3684.22783845116), (6.29999999999999, 4052.65062229628), (6.39999999999999, 4457.91568452590), (6.49999999999999, 4903.70725297849), (6.59999999999999, 5394.07797827634), (6.69999999999999, 5933.48577610398), (6.79999999999999, 6526.83435371438), (6.89999999999999, 7179.51778908581), (6.99999999999999, 7897.46956799439), (7.09999999999999, 8687.21652479383), (7.19999999999999, 9555.93817727322), (7.29999999999999, 10511.5319950005), (7.39999999999999, 11562.6851945006), (7.49999999999999, 12718.9537139507), (7.59999999999999, 13990.8490853457), (7.69999999999999, 15389.9339938803), (7.79999999999999, 16928.9273932683), (7.89999999999999, 18621.8201325951), (7.99999999999999, 20484.0021458547), (8.09999999999999, 22532.4023604401), (8.19999999999999, 24785.6425964841), (8.29999999999999, 27264.2068561326), (8.39999999999999, 29990.6275417458), (8.49999999999999, 32989.6902959204), (8.59999999999999, 36288.6593255124), (8.69999999999999, 39917.5252580637), (8.79999999999998, 43909.2777838700), (8.89999999999998, 48300.2055622570), (8.99999999999998, 53130.2261184827), (9.09999999999998, 58443.2487303310), (9.19999999999998, 64287.5736033641), (9.29999999999998, 70716.3309637005), (9.39999999999998, 77787.9640600706), (9.49999999999998, 85566.7604660776), (9.59999999999998, 94123.4365126854), (9.69999999999998, 103535.780163954), (9.79999999999998, 113889.358180349), (9.89999999999998, 125278.293998384), (9.99999999999998, 137806.123398223)]
#7
a(x)=0.2*x*(1-(x/100))
def eulers_method(initial_val,time_final,step,function):
val=[initial_val]
counter=srange(0,time_final,step)
for i in counter:
final=val[-1]
next_value=final+(function(final)*step)
val.append(next_value)
list_one=zip(counter,val)
return list_one
eulers_method(10,10,.1,n)

[(0.000000000000000, 10), (0.100000000000000, 11.0000000000000), (0.200000000000000, 12.1000000000000), (0.300000000000000, 13.3100000000000), (0.400000000000000, 14.6410000000000), (0.500000000000000, 16.1051000000000), (0.600000000000000, 17.7156100000000), (0.700000000000000, 19.4871710000000), (0.800000000000000, 21.4358881000000), (0.900000000000000, 23.5794769100000), (1.00000000000000, 25.9374246010000), (1.10000000000000, 28.5311670611000), (1.20000000000000, 31.3842837672100), (1.30000000000000, 34.5227121439310), (1.40000000000000, 37.9749833583241), (1.50000000000000, 41.7724816941565), (1.60000000000000, 45.9497298635722), (1.70000000000000, 50.5447028499294), (1.80000000000000, 55.5991731349223), (1.90000000000000, 61.1590904484145), (2.00000000000000, 67.2749994932560), (2.10000000000000, 74.0024994425816), (2.20000000000000, 81.4027493868398), (2.30000000000000, 89.5430243255237), (2.40000000000000, 98.4973267580761), (2.50000000000000, 108.347059433884), (2.60000000000000, 119.181765377272), (2.70000000000000, 131.099941914999), (2.80000000000000, 144.209936106499), (2.90000000000000, 158.630929717149), (3.00000000000000, 174.494022688864), (3.10000000000000, 191.943424957750), (3.20000000000000, 211.137767453526), (3.30000000000000, 232.251544198878), (3.40000000000000, 255.476698618766), (3.50000000000000, 281.024368480643), (3.60000000000000, 309.126805328707), (3.70000000000000, 340.039485861577), (3.80000000000000, 374.043434447735), (3.90000000000000, 411.447777892509), (4.00000000000000, 452.592555681760), (4.10000000000000, 497.851811249936), (4.20000000000000, 547.636992374929), (4.30000000000000, 602.400691612422), (4.40000000000000, 662.640760773664), (4.50000000000000, 728.904836851031), (4.60000000000000, 801.795320536134), (4.70000000000000, 881.974852589747), (4.80000000000000, 970.172337848722), (4.90000000000000, 1067.18957163359), (5.00000000000000, 1173.90852879695), (5.10000000000000, 1291.29938167665), (5.20000000000000, 1420.42931984431), (5.30000000000000, 1562.47225182874), (5.40000000000000, 1718.71947701162), (5.50000000000000, 1890.59142471278), (5.60000000000000, 2079.65056718406), (5.70000000000000, 2287.61562390246), (5.80000000000000, 2516.37718629271), (5.90000000000000, 2768.01490492198), (5.99999999999999, 3044.81639541418), (6.09999999999999, 3349.29803495560), (6.19999999999999, 3684.22783845116), (6.29999999999999, 4052.65062229628), (6.39999999999999, 4457.91568452590), (6.49999999999999, 4903.70725297849), (6.59999999999999, 5394.07797827634), (6.69999999999999, 5933.48577610398), (6.79999999999999, 6526.83435371438), (6.89999999999999, 7179.51778908581), (6.99999999999999, 7897.46956799439), (7.09999999999999, 8687.21652479383), (7.19999999999999, 9555.93817727322), (7.29999999999999, 10511.5319950005), (7.39999999999999, 11562.6851945006), (7.49999999999999, 12718.9537139507), (7.59999999999999, 13990.8490853457), (7.69999999999999, 15389.9339938803), (7.79999999999999, 16928.9273932683), (7.89999999999999, 18621.8201325951), (7.99999999999999, 20484.0021458547), (8.09999999999999, 22532.4023604401), (8.19999999999999, 24785.6425964841), (8.29999999999999, 27264.2068561326), (8.39999999999999, 29990.6275417458), (8.49999999999999, 32989.6902959204), (8.59999999999999, 36288.6593255124), (8.69999999999999, 39917.5252580637), (8.79999999999998, 43909.2777838700), (8.89999999999998, 48300.2055622570), (8.99999999999998, 53130.2261184827), (9.09999999999998, 58443.2487303310), (9.19999999999998, 64287.5736033641), (9.29999999999998, 70716.3309637005), (9.39999999999998, 77787.9640600706), (9.49999999999998, 85566.7604660776), (9.59999999999998, 94123.4365126854), (9.69999999999998, 103535.780163954), (9.79999999999998, 113889.358180349), (9.89999999999998, 125278.293998384)]
#8 & 9
f(x)=-2.1*x
def eulers_method(initial_val,time_final,step,function):
val=[initial_val]
counter=srange(0,time_final,step)
for i in counter:
final= val[-1]
next_value=final+(function(final)*step)
val.append(next_value)
list_one=zip(counter,val)
return list_one
result1 = eulers_method(5,10,1,f(x))
result2 = eulers_method(5,10,0.5,f(x))
result3 = eulers_method(5,10,0.1,f(x))
list_plot(result1,plotjoined=True)
list_plot(result2,plotjoined=True)
list_plot(result3,plotjoined=True)