Skip to content
Snippets Groups Projects
Commit a2ea3575 authored by Erik Strand's avatar Erik Strand
Browse files

Write a random number generator and answer 6.2 (c)

parent 61d10946
Branches
No related tags found
No related merge requests found
import numpy as np
import matplotlib.pyplot as plt
uniform_samples = np.array([
[0.316139, 1.53805], [0.884079, 1.4898], [0.250138, 2.97285], [0.303945, 1.53857], [0.242934, 4.92948], [0.232131, 4.80524], [0.736897, 3.01305], [0.166709, 0.00494019], [0.493423, 5.12557], [0.805746, 6.00333], [0.0153707, 4.45289], [0.995829, 3.48421], [0.628502, 2.31783], [0.820536, 2.90344], [0.316724, 2.84286], [0.346007, 4.77784], [0.80875, 0.452461], [0.906672, 3.93964], [0.898311, 2.8438], [0.677135, 3.15903], [0.53789, 3.40872], [0.481619, 1.95222], [0.0238657, 3.9772], [0.105797, 4.37167], [0.271287, 1.56883], [0.865473, 3.44895], [0.0315917, 3.28883], [0.08644, 0.883585], [0.932475, 4.51298], [0.438335, 0.860995], [0.146411, 0.723109], [0.917591, 5.07933], [0.532152, 2.81949], [0.0334965, 2.32945], [0.309735, 3.10879], [0.7594, 0.274077], [0.335067, 4.2255], [0.670101, 5.62154], [0.613459, 3.82163], [0.658831, 0.977763], [0.0371085, 1.89177], [0.664055, 2.03241], [0.254855, 4.03807], [0.343052, 3.24564], [0.51877, 4.88984], [0.223581, 2.99578], [0.999282, 3.75056], [0.765606, 1.83726], [0.836824, 2.65238], [0.355774, 1.39154], [0.756062, 4.01192], [0.565774, 3.67607], [0.110647, 0.535916], [0.292856, 5.03828], [0.26325, 5.73852], [0.503795, 1.94685], [0.888686, 0.856414], [0.073202, 1.29747], [0.891196, 2.99395], [0.230949, 5.19199], [0.0676513, 4.81087], [0.117992, 3.87966], [0.498907, 3.71362], [0.615133, 4.89077], [0.131116, 3.64784], [0.624209, 0.902393], [0.316034, 4.16379], [0.940566, 2.70588], [0.311074, 3.61542], [0.378353, 3.20763], [0.0126842, 0.63977], [0.405585, 5.84917], [0.869284, 1.41348], [0.77914, 4.64948], [0.23289, 5.17326], [0.430067, 5.65281], [0.615266, 2.57233], [0.655277, 2.91659], [0.898338, 3.74334], [0.784851, 3.29214], [0.795859, 0.954619], [0.257649, 6.13438], [0.944612, 5.88985], [0.912616, 5.99497], [0.538652, 5.45799], [0.673342, 5.99517], [0.26767, 5.61601], [0.012488, 2.52198], [0.412523, 4.64828], [0.416617, 2.25556], [0.966643, 1.20418], [0.171249, 1.11935], [0.513856, 3.65872], [0.11759, 3.87584], [0.680342, 1.18717], [0.482456, 2.85156], [0.0452426, 4.13019], [0.213038, 4.36991], [0.0740391, 3.89785], [0.340941, 1.10074], [0.38911, 1.26852], [0.235535, 3.34356], [0.445067, 1.37913], [0.334344, 5.18402], [0.724412, 6.01702], [0.74005, 2.09249], [0.170378, 5.65227], [0.158856, 4.85459], [0.0235769, 5.04061], [0.495933, 0.327072], [0.912613, 2.4625], [0.204043, 3.23533], [0.114388, 1.03274], [0.369322, 1.10596], [0.409378, 2.58433], [0.420359, 3.49767], [0.474598, 5.32659], [0.578431, 4.29731], [0.37058, 2.07463], [0.740852, 3.74586], [0.563614, 1.23582], [0.476454, 3.99224], [0.583666, 0.368953], [0.43014, 5.35021], [0.965307, 3.02761], [0.177421, 2.8939], [0.66175, 0.714527], [0.462817, 4.62003], [0.966797, 2.71831], [0.611642, 2.97681], [0.623701, 1.0519], [0.77641, 0.671368], [0.541222, 1.44407], [0.0568091, 3.95291], [0.0348342, 0.476022], [0.581254, 5.4285], [0.22117, 5.335], [0.116605, 3.81647], [0.462857, 2.54058], [0.945643, 2.31444], [0.127127, 4.52582], [0.607109, 2.1886], [0.430629, 4.56987], [0.919177, 5.61681], [0.289934, 4.53052], [0.24504, 1.81422], [0.330404, 2.44596], [0.800724, 1.99091], [0.184838, 2.77322], [0.608999, 4.13329], [0.906729, 2.70262], [0.721462, 0.145067], [0.256845, 5.08864], [0.953583, 4.52703], [0.863856, 2.69577], [0.572787, 1.64511], [0.590552, 3.01672], [0.0637656, 1.69892], [0.43782, 3.64487], [0.995935, 5.26482], [0.217211, 2.62284], [0.577637, 4.75985], [0.153151, 5.00148], [0.195604, 0.0414172], [0.640834, 3.31769], [0.121866, 3.18936], [0.730124, 2.91874], [0.335526, 0.488706], [0.504072, 2.80944], [0.24565, 0.302833], [0.440973, 2.31393], [0.776895, 1.80025], [0.118739, 6.09404], [0.623788, 4.2767], [0.550887, 1.84173], [0.232979, 3.70318], [0.23615, 4.37343], [0.524581, 1.22386], [0.246898, 5.53958], [0.202894, 4.98634], [0.286001, 5.88216], [0.425366, 4.17209], [0.839136, 6.16579], [0.152846, 1.15433], [0.127718, 2.43028], [0.643752, 2.71225], [0.711467, 2.8119], [0.00692405, 6.17089], [0.136661, 2.67481], [0.337625, 4.0119], [0.302973, 5.08736], [0.407995, 2.31162], [0.414799, 0.287778], [0.319282, 6.08779], [0.916938, 1.03038], [0.0330362, 3.981], [0.866766, 1.09953], [0.824769, 1.17165], [0.818126, 2.04713], [0.850555, 3.07635], [0.843332, 3.03756], [0.325282, 0.141816], [0.511585, 0.665341], [0.691512, 0.0079404], [0.70871, 0.0484113], [0.990784, 4.1605], [0.32574, 4.79083], [0.518467, 4.42245], [0.499194, 3.79721], [0.883527, 2.92539], [0.746115, 5.29726], [0.961959, 6.25781], [0.7621, 0.0460913], [0.647888, 3.31218], [0.425824, 4.7386], [0.596169, 1.52933], [0.886019, 0.255047], [0.811186, 2.08642], [0.383553, 2.88453], [0.566799, 3.42854], [0.229079, 6.02237], [0.347964, 4.58066], [0.469297, 0.609068], [0.584791, 2.51188], [0.773215, 0.273843], [0.901615, 3.90267], [0.531072, 5.43285], [0.542009, 0.195691], [0.576491, 5.93405], [0.45437, 0.271964], [0.70615, 6.00639], [0.540232, 2.88184], [0.348361, 5.22345], [0.712479, 3.23848], [0.16943, 6.01577], [0.849911, 4.68048], [0.697622, 6.20604], [0.244524, 0.125849], [0.0177815, 1.67685], [0.356754, 3.29358], [0.286912, 2.66177], [0.64719, 3.2218], [0.909099, 5.44031], [0.674461, 2.64036], [0.956485, 5.44809], [0.578809, 1.37124], [0.413589, 3.57804], [0.175083, 3.13049], [0.0722, 5.75772], [0.877597, 3.55408], [0.564702, 0.251538], [0.860967, 1.12883], [0.832252, 5.07107], [0.722957, 0.354606], [0.569914, 0.114306], [0.364545, 0.149493], [0.770904, 4.00695], [0.697573, 4.52299], [0.738008, 0.530964], [0.714397, 3.20427], [0.243293, 1.63335], [0.540487, 1.19527], [0.489669, 0.342826], [0.905504, 5.29871], [0.633282, 2.29499], [0.728603, 3.4997], [0.3684, 1.00774], [0.502245, 5.46267], [0.395379, 3.50997], [0.26305, 1.91402], [0.364664, 2.23289], [0.193228, 3.49421], [0.287871, 3.72551], [0.624874, 5.89791], [0.631869, 4.9136], [0.620421, 0.737388], [0.834527, 2.19681], [0.713555, 2.19335], [0.195524, 0.641834], [0.154655, 5.3152], [0.89331, 1.4974], [0.599076, 2.17321], [0.629691, 3.34615], [0.528375, 3.87476], [0.403869, 1.45249], [0.390882, 5.95215], [0.586253, 2.74943], [0.836137, 1.37082], [0.869405, 2.03088], [0.933071, 0.259313], [0.941902, 1.41339], [0.272355, 1.8666], [0.327005, 4.4586], [0.597797, 6.24613], [0.759954, 4.25524], [0.471068, 5.95971], [0.695248, 1.12982], [0.262018, 3.62616], [0.899801, 1.22686], [0.399307, 1.22627], [0.428436, 5.17429], [0.363009, 0.981049], [0.319742, 4.5296], [0.0586058, 4.21314], [0.379442, 4.84889], [0.0259881, 0.83453], [0.101946, 5.68623], [0.914525, 3.03097], [0.870034, 0.392111], [0.15175, 5.20442], [0.266402, 4.13861], [0.99309, 5.61726], [0.976213, 5.90458], [0.792115, 5.58688], [0.724482, 3.88723], [0.818681, 5.04634], [0.0703119, 1.54753], [0.0117581, 3.98941], [0.544483, 3.52262], [0.27828, 5.06571], [0.015054, 1.66456], [0.655934, 1.31257], [0.257736, 2.72687], [0.919264, 5.45873], [0.64086, 0.275263], [0.835495, 3.621], [0.00557595, 0.0398099], [0.177317, 5.26501], [0.962819, 5.66191], [0.348624, 4.14932], [0.205989, 5.68698], [0.808027, 4.03449], [0.335294, 0.672217], [0.406757, 0.549728], [0.169154, 5.55067], [0.773526, 3.27322], [0.440182, 5.59558], [0.56557, 6.09021], [0.396451, 4.92944], [0.469633, 4.48506], [0.156041, 4.03379], [0.432878, 6.00957], [0.756545, 0.922819], [0.103337, 4.27633], [0.251104, 5.79919], [0.210859, 0.920667], [0.412373, 6.17291], [0.952659, 3.56628], [0.929708, 4.50027], [0.68241, 3.76135], [0.00446549, 4.02246], [0.976976, 5.90312], [0.686955, 4.09759], [0.245454, 1.12437], [0.505262, 4.8841], [0.6929, 3.79292], [0.75595, 4.77965], [0.567711, 5.4132], [0.228391, 4.94118], [0.869834, 5.18974], [0.81546, 6.26072], [0.852457, 1.30086], [0.963086, 2.47889], [0.0954053, 1.14459], [0.210167, 3.80643], [0.428851, 2.26168], [0.155956, 0.113712], [0.141887, 3.1436], [0.413613, 1.45198], [0.611805, 0.559657], [0.876303, 5.93726], [0.0288781, 3.27641], [0.773662, 4.52049], [0.931162, 0.652057], [0.249621, 0.832998], [0.603456, 2.79613], [0.351061, 1.71474], [0.0939724, 3.82913], [0.581823, 1.73525], [0.530207, 1.04455], [0.508212, 5.08211], [0.827674, 4.06194], [0.946631, 2.43855], [0.281089, 3.23368], [0.24318, 3.56762], [0.678164, 5.04858], [0.119063, 4.75075], [0.309975, 0.740766], [0.0902699, 1.58968], [0.0441766, 2.55825], [0.739316, 2.31625], [0.391236, 4.79012], [0.333367, 5.5571], [0.158938, 5.39712], [0.78125, 3.91203], [0.898978, 0.674403], [0.0361729, 2.89182], [0.734725, 2.25919], [0.0451564, 3.72441], [0.981727, 0.824394], [0.777839, 0.326851], [0.798379, 4.00188], [0.790006, 1.55644], [0.311176, 4.14155], [0.793809, 3.53024], [0.625934, 4.33255], [0.585693, 5.39385], [0.857293, 5.47821], [0.612701, 2.57372], [0.40028, 2.91669], [0.167511, 1.48825], [0.221915, 2.40579], [0.568914, 0.824094], [0.759831, 4.26397], [0.369024, 2.14406], [0.644512, 1.73765], [0.423322, 1.24249], [0.110594, 3.90749], [0.777088, 5.25696], [0.877746, 2.05196], [0.52464, 0.814918], [0.147006, 4.41144], [0.556499, 2.44386], [0.419089, 0.750699], [0.49547, 1.05588], [0.380874, 5.32018], [0.839819, 1.48558], [0.128417, 1.18962], [0.163379, 5.12503], [0.232751, 2.56568], [0.838333, 2.22959], [0.0266386, 0.322282], [0.912415, 2.99838], [0.779418, 6.16631], [0.392802, 2.71721], [0.671818, 5.23867], [0.7956, 4.9141], [0.76428, 2.48366], [0.181173, 2.8075], [0.968242, 5.2988], [0.494547, 1.71876], [0.4236, 3.35685], [0.847177, 4.95477], [0.64405, 3.1778], [0.749173, 2.63175], [0.643562, 4.54409], [0.157796, 0.119021], [0.740488, 3.43024], [0.30437, 3.28369], [0.461034, 2.24298], [0.514487, 3.8102], [0.0344445, 1.57735], [0.344662, 0.540166], [0.978962, 0.147959], [0.981656, 2.82151], [0.900368, 0.186244], [0.761572, 2.09345], [0.137617, 0.189015], [0.524263, 6.18685], [0.332853, 1.39386], [0.347397, 3.47875], [0.27974, 6.15454], [0.294725, 5.01017], [0.33008, 0.18004], [0.828306, 2.93821], [0.872541, 1.62525], [0.479319, 5.11767], [0.246376, 2.19287], [0.518917, 4.72469], [0.818017, 4.43453], [0.123797, 4.23511], [0.476451, 3.60456], [0.192909, 5.64288], [0.746899, 4.85881], [0.427829, 1.98038], [0.0526606, 3.33611], [0.55289, 0.413064], [0.179256, 4.09235], [0.243477, 5.55186], [0.922823, 5.99498], [0.961516, 2.88135], [0.834518, 5.16637], [0.742032, 4.87253], [0.332235, 3.67945], [0.684504, 1.31113], [0.534158, 3.40471], [0.833497, 1.76546], [0.82315, 5.10813], [0.665142, 0.316338], [0.935154, 0.0928334], [0.397669, 3.83812], [0.48432, 4.49], [0.910659, 2.38451], [0.879879, 1.3125], [0.892539, 0.651825], [0.0336439, 1.19599], [0.601818, 2.49118], [0.562896, 3.56979], [0.494093, 2.59778], [0.703473, 1.57009], [0.744898, 1.00883], [0.476196, 4.23812], [0.460438, 4.39499], [0.365047, 2.75619], [0.641818, 0.715618], [0.749417, 5.18336], [0.938872, 2.42245], [0.168503, 3.8414], [0.493287, 1.62247], [0.322699, 4.48979], [0.843248, 4.33911], [0.0968993, 2.47572], [0.617126, 0.328585], [0.55213, 5.35197], [0.923094, 2.10228], [0.33421, 2.51671], [0.236093, 0.523198], [0.790278, 1.88392], [0.693552, 0.382635], [0.690204, 5.87288], [0.522184, 0.114597], [0.413611, 3.68352], [0.41715, 1.41807], [0.608354, 1.52601], [0.747119, 5.42728], [0.802604, 2.23847], [0.0115473, 0.379109], [0.0108027, 2.45516], [0.0134149, 0.628286], [0.986593, 2.25307], [0.105765, 5.76798], [0.0875092, 1.98541], [0.328695, 0.0972343], [0.814501, 3.53776], [0.859199, 2.3819], [0.951873, 4.84189], [0.198208, 3.57169], [0.1317, 4.09346], [0.560435, 0.978005], [0.0406443, 4.80888], [0.980918, 1.58975], [0.177391, 3.19256], [0.847194, 2.02829], [0.931426, 4.90622], [0.8876, 2.43053], [0.548546, 2.66918], [0.969943, 2.08215], [0.661037, 4.51145], [0.782664, 1.68572], [0.831174, 0.588989], [0.669935, 0.0475393], [0.854703, 0.791592], [0.405946, 2.89941], [0.173403, 4.37612], [0.360466, 5.68922], [0.551702, 4.74366], [0.566481, 3.47926], [0.828847, 0.872665], [0.204881, 5.33568], [0.716689, 3.68167], [0.275956, 3.22062], [0.00481157, 4.04429], [0.138507, 1.18719], [0.0807637, 0.629673], [0.953523, 2.98068], [0.193431, 1.71981], [0.260476, 0.396523], [0.707952, 4.98465], [0.104174, 0.0230348], [0.513639, 2.81477], [0.0476802, 0.119585], [0.531129, 2.09538], [0.506118, 5.18968], [0.353123, 0.753806], [0.0643939, 5.66216], [0.272136, 2.7926], [0.254033, 2.81346], [0.406978, 3.23413], [0.275465, 0.811564], [0.166278, 1.05046], [0.868691, 1.43009], [0.490158, 3.12056], [0.45827, 2.15545], [0.50707, 1.65238], [0.914468, 1.24528], [0.694096, 0.0634067], [0.651083, 1.98697], [0.360035, 0.988805], [0.413307, 4.93982], [0.740753, 4.68038], [0.862529, 3.14328], [0.796451, 4.27289], [0.238936, 4.50661], [0.559973, 0.505174], [0.174185, 5.12716], [0.178175, 3.94993], [0.241837, 1.94985], [0.443617, 4.55341], [0.257478, 6.11824], [0.727844, 3.11755], [0.716966, 5.98197], [0.209518, 5.47474], [0.865164, 4.90238], [0.349907, 3.96197], [0.0176024, 3.29599], [0.223901, 0.33302], [0.101737, 2.38937], [0.70394, 1.39346], [0.183409, 1.74799], [0.802751, 2.38987], [0.6471, 0.00606367], [0.731271, 4.23147], [0.2317, 1.79604], [0.881514, 0.963962], [0.866851, 5.27403], [0.0910198, 0.38778], [0.960249, 2.79394], [0.190184, 2.21983], [0.902233, 0.400067], [0.761412, 0.265007], [0.327125, 3.86917], [0.671458, 0.616113], [0.456425, 1.28158], [0.690158, 3.55637], [0.234586, 1.08142], [0.573256, 0.570439], [0.991125, 2.94046], [0.612329, 5.70905], [0.0235981, 4.26151], [0.822767, 2.12577], [0.894056, 3.91134], [0.51068, 1.53163], [0.106299, 3.3869], [0.907412, 4.85375], [0.751989, 5.97324], [0.0301467, 3.34311], [0.0616443, 3.09075], [0.452901, 1.82539], [0.149552, 4.78258], [0.136215, 0.769873], [0.809486, 4.57637], [0.330261, 2.90065], [0.571996, 0.798356], [0.0769839, 5.17322], [0.222434, 0.962843], [0.940837, 6.08359], [0.63356, 0.137507], [0.298857, 0.728902], [0.907832, 2.07245], [0.429221, 1.54241], [0.810146, 4.60387], [0.97634, 4.39416], [0.780722, 3.76238], [0.956328, 4.49475], [0.677953, 5.60732], [0.561588, 4.94589], [0.376791, 2.14417], [0.309953, 3.37807], [0.875904, 1.8428], [0.492665, 4.44356], [0.833688, 3.26451], [0.716541, 0.48227], [0.648505, 5.26919], [0.559761, 1.35013], [0.528518, 2.73787], [0.948073, 3.81767], [0.194591, 2.23136], [0.83078, 5.05424], [0.923164, 4.10014], [0.721573, 3.64203], [0.0505364, 3.38288], [0.054156, 2.68476], [0.476888, 5.15751], [0.525946, 3.5164], [0.558245, 5.92909], [0.0495828, 4.1723], [0.452293, 0.69188], [0.00225353, 6.12144], [0.506406, 0.135486], [0.868101, 5.01736], [0.986132, 4.84361], [0.428278, 0.384401], [0.619332, 4.44825], [0.64086, 6.16785], [0.183147, 1.42044], [0.59877, 0.935893], [0.816016, 4.48661], [0.903184, 5.50141], [0.55755, 3.14524], [0.736039, 4.07608], [0.988139, 4.94568], [0.0255532, 1.12963], [0.257879, 4.88961], [0.489069, 6.18956], [0.739217, 4.17431], [0.653602, 5.5021], [0.00283155, 6.0339], [0.84427, 4.42177], [0.896853, 2.35824], [0.352097, 2.81067], [0.210822, 5.9082], [0.298639, 3.55128], [0.60264, 4.45698], [0.00921492, 3.87167], [0.226613, 5.86729], [0.421274, 3.12681], [0.413769, 4.0063], [0.403577, 2.18739], [0.140543, 3.62832], [0.453749, 0.325838], [0.680527, 5.07614], [0.681213, 2.45716], [0.874188, 1.20835], [0.911524, 1.91875], [0.674196, 2.1781], [0.644635, 3.2474], [0.510427, 5.64746], [0.93084, 1.88219], [0.86539, 1.99636], [0.0808571, 1.64981], [0.47987, 2.81245], [0.383976, 1.92556], [0.921237, 2.01836], [0.147771, 2.48881], [0.440436, 2.72417], [0.878154, 0.13057], [0.854235, 1.56054], [0.781605, 5.13763], [0.415755, 0.188978], [0.490427, 0.410544], [0.871352, 4.8612], [0.629042, 5.09229], [0.377592, 6.00919], [0.641623, 4.20196], [0.781007, 0.966189], [0.0253015, 4.71539], [0.0681029, 0.842318], [0.41436, 5.038], [0.821322, 1.95305], [0.599948, 1.24736], [0.954226, 1.91085], [0.93593, 1.51388], [0.388875, 2.1991], [0.0404095, 3.00412], [0.648305, 5.62518], [0.872957, 1.75944], [0.251732, 5.42059], [0.53778, 3.67954], [0.135713, 4.00092], [0.0929593, 5.49004], [0.170787, 3.14445], [0.231241, 2.93272], [0.471513, 4.97092], [0.492888, 0.764211], [0.828337, 4.38646], [0.0726284, 3.15181], [0.556603, 4.39283], [0.604224, 2.81877], [0.328108, 5.08543], [0.0383854, 1.57973], [0.466284, 1.82021], [0.952224, 4.19339], [0.213085, 0.846745], [0.341658, 4.6275], [0.921328, 1.14993], [0.351795, 1.23841], [0.488343, 3.84664], [0.556805, 2.84641], [0.272833, 2.48665], [0.706874, 1.10945], [0.118343, 4.18357], [0.290094, 3.5206], [0.331373, 5.91277], [0.697801, 5.64295], [0.650047, 4.93478], [0.905683, 5.81773], [0.420522, 2.05548], [0.679781, 2.55475], [0.958381, 4.57804], [0.617389, 1.15079], [0.706524, 4.78161], [0.125741, 4.72878], [0.832031, 3.02962], [0.399455, 3.92086], [0.393005, 3.18233], [0.641852, 0.0437692], [0.527553, 4.03867], [0.282848, 1.72209], [0.245754, 0.787678], [0.24654, 5.97965], [0.249406, 5.5443], [0.897145, 1.82044], [0.472793, 0.0529376], [0.785134, 1.7539], [0.605616, 0.267788], [0.0413015, 1.37301], [0.548505, 5.02229], [0.192018, 3.91313], [0.881193, 4.1981], [0.406234, 4.7282], [0.226564, 3.13578], [0.87905, 0.481061], [0.375378, 5.48888], [0.525625, 3.86296], [0.0910383, 4.97936], [0.994509, 2.25147], [0.773769, 1.20932], [0.926872, 4.79339], [0.377277, 3.76629], [0.983551, 1.70264], [0.821451, 4.00078], [0.37664, 5.741], [0.0729277, 3.32209], [0.899683, 5.72473], [0.0456853, 4.6877], [0.844036, 0.671518], [0.592402, 3.78552], [0.905176, 5.76387], [0.579481, 0.815388], [0.121959, 3.26473], [0.959481, 5.18764], [0.944083, 5.32972], [0.598525, 4.83887], [0.59626, 2.73119], [0.322352, 3.78422], [0.927837, 4.04762], [0.237258, 2.00436], [0.475936, 2.57272], [0.549413, 0.623527], [0.0495456, 0.221344], [0.933097, 4.55027], [0.705822, 5.11214], [0.309132, 3.67145], [0.2756, 5.44256], [0.360396, 3.06414], [0.929754, 4.50303], [0.338107, 0.835552], [0.0448563, 5.13575], [0.627959, 2.8409], [0.395922, 1.78272], [0.296516, 1.21778], [0.215172, 5.10435], [0.0301375, 0.16645], [0.29548, 5.46902], [0.0833143, 4.22165], [0.925053, 2.82386], [0.529129, 0.945886], [0.132575, 4.8558], [0.0928958, 1.45757], [0.0910772, 2.16782], [0.966945, 3.78083], [0.917211, 0.530753], [0.0977098, 3.86034], [0.58559, 3.22966], [0.566785, 1.08954], [0.10519, 5.91586], [0.0640122, 3.58184], [0.890613, 2.11277], [0.704328, 0.574781], [0.850288, 2.71242], [0.984545, 3.35563], [0.0589737, 2.72504], [0.991923, 0.0889246], [0.601997, 4.73214], [0.275671, 5.78041], [0.223164, 3.4747], [0.676437, 5.2314], [0.818615, 0.563331], [0.950372, 0.0901604], [0.258261, 1.00825], [0.311465, 5.73331], [0.110052, 4.5633], [0.384117, 5.46045], [0.139881, 3.82443], [0.868429, 4.86523], [0.968573, 0.321111], [0.77998, 3.00548], [0.179363, 0.0798878], [0.704827, 1.28122], [0.973231, 1.50561], [0.070958, 5.1058], [0.771949, 4.56699], [0.850781, 5.83642], [0.134944, 0.595312], [0.781994, 3.13452], [0.842217, 5.20392], [0.60711, 4.39654], [0.19961, 2.89419], [0.458974, 4.17534], [0.217621, 0.0722364], [0.696566, 0.629523], [0.394671, 5.02932], [0.1771, 5.54971], [0.488394, 0.510073], [0.304967, 0.905018], [0.669135, 1.95144], [0.0713098, 0.33081], [0.655427, 3.71655], [0.394417, 5.53372], [0.0747325, 0.980972], [0.298838, 5.56795], [0.309169, 2.39997], [0.498751, 5.57756], [0.814309, 3.09547], [0.549855, 5.96179], [0.70586, 6.23108], [0.415665, 2.10534], [0.356974, 5.21334], [0.970834, 3.66897], [0.976295, 5.88559], [0.516447, 0.198535], [0.82612, 6.27285], [0.291587, 5.56466], [0.670907, 4.755], [0.820112, 0.642246], [0.0449641, 2.32716], [0.476839, 4.11605], [0.537017, 2.55035], [0.230721, 0.413261], [0.144036, 0.138927], [0.978357, 5.03388], [0.102203, 4.05257], [0.348821, 0.713514], [0.393973, 5.32103], [0.363751, 3.47225], [0.655264, 2.46447], [0.691007, 1.59894], [0.510297, 4.22967], [0.226315, 0.907134], [0.745727, 0.664348], [0.181065, 1.38892], [0.321276, 1.13764], [0.317506, 3.72148], [0.305939, 1.48692], [0.890086, 5.34607], [0.470654, 2.37312], [0.176068, 0.136045], [0.469019, 1.15665], [0.102251, 1.99663], [0.125397, 2.44457], [0.324552, 5.05194], [0.693375, 4.53985], [0.357725, 4.23147], [0.0322793, 1.01391], [0.451131, 3.1426], [0.450977, 1.34177], [0.603673, 4.6306], [0.0832892, 5.26633], [0.00826551, 6.10104], [0.962464, 0.532625], [0.0274315, 5.75574], [0.804815, 2.19049], [0.158785, 2.42072], [0.591637, 2.32639], [0.618821, 3.69866], [0.761682, 5.26672], [0.974854, 5.60956], [0.935256, 2.1032], [0.442076, 0.671362], [0.788689, 4.36417], [0.118359, 1.03977], [0.197252, 3.28806], [0.183021, 3.40878], [0.444357, 2.35146], [0.400449, 3.17918], [0.734159, 2.19023], [0.968411, 1.50929], [0.364786, 0.153511], [0.45563, 5.96338], [0.441719, 1.74949], [0.643982, 1.15532], [0.44243, 1.42176], [0.683229, 4.0967], [0.014055, 1.00561], [0.361487, 5.87369], [0.508906, 4.41053], [0.894895, 1.55368], [0.104351, 2.12708], [0.0457239, 6.2606], [0.265374, 0.0516906], [0.0584615, 1.28603], [0.462382, 2.68844], [0.241625, 2.48418], [0.211751, 0.177361], [0.831926, 2.51698], [0.186623, 0.411792], [0.382824, 5.83777], [0.586206, 4.6633], [0.413092, 0.337095], [0.238366, 1.10104], [0.136317, 4.30692], [0.260929, 0.672729], [0.608443, 4.17298], [0.396273, 1.43056], [0.179724, 5.50332], [0.931741, 3.98346], [0.414988, 2.87149], [0.465897, 3.67603], [0.152556, 1.63264], [0.327027, 3.90603]
])
transformed_samples = np.array([
[1.5168, 0.049694], [0.494776, 0.0401653], [0.279587, -1.64113], [1.54251, 0.0497326], [-1.64276, 0.362336], [-1.7017, 0.158463], [0.10017, -0.774971], [0.00935117, 1.89286], [-1.08858, 0.477259], [-0.181541, 0.631678], [-2.79298, -0.741508], [-0.0307148, -0.0861108], [0.707119, -0.654841], [0.14838, -0.61121], [0.446283, -1.44923], [-1.45379, 0.095294], [0.284849, 0.585997], [-0.316944, -0.309024], [0.135882, -0.442734], [-0.0153944, -0.882912], [-0.293957, -1.07415], [1.12193, -0.449969], [-2.02726, -1.83326], [-1.9977, -0.708275], [1.61528, 0.00317078], [-0.162632, -0.512356], [-0.385637, -2.60019], [1.71056, 1.40378], [-0.366524, -0.0740718], [0.974165, 0.836986], [1.29715, 1.46972], [-0.387129, 0.148792], [0.355569, -1.06547], [1.89153, -1.79297], [0.0502167, -1.53021], [0.200808, 0.714233], [-1.30695, -0.691905], [-0.549772, 0.705979], [-0.621643, -0.768664], [0.757562, 0.510566], [2.43559, -0.809769], [0.810156, -0.403024], [-1.29162, -1.0324], [-0.151921, -1.45488], [-1.12769, 0.202233], [0.251484, -1.71252], [-0.0216803, -0.0310883], [0.705079, -0.192455], [0.280499, -0.526882], [1.41464, 0.256332], [-0.571752, -0.48204], [-0.543673, -0.918445], [1.07145, 1.80411], [-1.48472, 0.501744], [-0.846517, 1.39739], [1.08915, -0.430038], [0.367037, 0.318286], [2.20183, 0.617258], [0.070608, -0.47476], [-1.5189, 0.789978], [-2.3097, 0.22821], [-1.3911, -1.52942], [-0.63838, -0.991535], [-0.970173, 0.174922], [-0.977442, -1.76294], [0.761931, 0.601665], [-1.2951, -0.791536], [0.147749, -0.31736], [-0.697321, -1.35985], [-0.09201, -1.39118], [1.76445, 2.37098], [-0.564945, 1.21889], [0.522775, 0.082926], [-0.705094, -0.0444179], [-1.52904, 0.759214], [-0.765745, 1.04941], [0.531246, -0.830167], [0.205141, -0.896276], [-0.262127, -0.381715], [-0.1044, -0.688203], [0.551492, 0.390541], [-0.244161, 1.62871], [-0.129384, 0.311803], [-0.121553, 0.410007], [-0.81724, 0.754645], [-0.252633, 0.852749], [-1.00463, 1.27543], [1.71936, -2.41035], [-1.32803, -0.0852575], [1.025, -0.836985], [0.243172, 0.093373], [1.69043, 0.819581], [-0.570499, -1.00307], [-1.38634, -1.53596], [0.813884, 0.328503], [0.345285, -1.15694], [-2.07834, -1.36819], [-1.65644, -0.590563], [-1.56573, -1.65976], [1.30789, 0.66446], [1.31167, 0.40902], [-0.341128, -1.66596], [1.24912, 0.24239], [-1.31866, 0.672541], [-0.211211, 0.774713], [0.672716, -0.386689], [-1.10978, 1.51916], [-1.89885, 0.271849], [-2.59155, 0.882526], [0.38049, 1.12154], [0.268605, -0.332774], [-0.166878, -1.77511], [1.78815, 1.06715], [1.26168, 0.632717], [0.706827, -1.1343], [-0.458953, -1.23396], [-0.997756, 0.703601], [-0.957511, -0.421956], [1.23394, -0.680267], [-0.440061, -0.637381], [1.01135, 0.352042], [-0.915344, -0.803065], [0.374241, 0.967883], [-1.04357, 0.773463], [0.0302239, -0.264015], [0.45594, -1.80294], [0.595434, 0.686434], [-1.23602, -0.114484], [0.106745, -0.236937], [0.162651, -0.978141], [0.843777, 0.481881], [0.442558, 0.557039], [1.0992, 0.140048], [-1.73686, -1.64908], [1.18741, 2.30312], [-0.785817, 0.683833], [-1.41118, 1.01303], [-1.2953, -1.61868], [0.701894, -1.02373], [0.246073, -0.226337], [-1.9958, -0.376736], [0.814376, -0.578693], [-1.28492, -0.184377], [-0.25378, 0.322721], [-1.54764, -0.28461], [1.62766, -0.404218], [0.953776, -1.14245], [0.608717, -0.271921], [0.661692, -1.71427], [-0.833552, -0.54504], [0.188075, -0.400562], [0.116811, 0.799567], [-1.53347, 0.605837], [-0.303033, -0.0568209], [0.233285, -0.488137], [1.05278, -0.0783762], [0.127835, -1.01836], [2.32706, -0.299787], [-0.619879, -1.1259], [-0.0768306, 0.0473629], [0.866406, -1.5176], [-1.04649, 0.0497008], [-1.85679, 0.552251], [0.0747975, 1.80492], [-0.165269, -0.928792], [-0.0979704, -2.04941], [0.175298, -0.773533], [0.693838, 1.30487], [0.381671, -1.10653], [0.499713, 1.59937], [0.94228, -0.865824], [0.691939, -0.161617], [-0.388143, 2.02756], [-0.880776, -0.410028], [1.05216, -0.292254], [-0.909, -1.44476], [-1.60232, -0.564926], [1.06824, 0.386236], [-1.13225, 1.23108], [-1.71949, 0.483212], [-0.617656, 1.45672], [-1.12127, -0.672574], [-0.0693707, 0.588178], [1.77254, 0.784062], [1.32444, -1.53679], [0.390694, -0.85337], [0.267139, -0.780698], [-0.353381, 3.13379], [0.89783, -1.78169], [-1.12665, -0.949899], [-1.43801, 0.565995], [0.98809, -0.903702], [0.376524, 1.27207], [-0.293375, 1.48233], [0.357103, 0.214263], [-1.94366, -1.74427], [0.476472, 0.242793], [0.571936, 0.241233], [0.563089, -0.290534], [0.0370962, -0.567765], [0.0606191, -0.580616], [0.211828, 1.48366], [0.714737, 0.910843], [0.00682012, 0.858897], [0.0401575, 0.828858], [-0.115874, -0.0713449], [-1.49316, 0.117364], [-1.09835, -0.32769], [-0.71864, -0.934385], [0.106762, -0.486076], [-0.638129, 0.422542], [-0.00706574, 0.27842], [0.0339631, 0.736343], [-0.15817, -0.918181], [-1.30625, 0.0342484], [1.01621, 0.0421664], [0.12412, 0.476056], [0.562818, -0.318983], [0.351976, -1.33891], [-0.301597, -1.02203], [-0.442708, 1.65873], [-1.44045, -0.190849], [0.703719, 1.00887], [0.610031, -0.837175], [0.193958, 0.69049], [-0.3139, -0.32955], [-0.845467, 0.742226], [0.215206, 1.08565], [-0.35904, 0.986246], [0.337408, 1.20989], [-0.227956, 0.802428], [0.285022, -1.07251], [-1.26669, 0.710295], [-0.0796537, -0.819551], [-0.497919, 1.81733], [-0.570015, -0.0181934], [-0.0654037, 0.846096], [0.210662, 1.66509], [2.82292, -0.300504], [-0.217381, -1.41921], [0.72947, -1.4018], [-0.0747465, -0.929862], [-0.325933, 0.290467], [0.426457, -0.778343], [-0.221145, 0.200187], [1.02498, 0.207302], [-0.561718, -1.20426], [0.0207239, -1.8667], [-1.15007, 1.98342], [-0.204859, -0.468154], [0.266086, 1.03543], [0.494597, 0.234035], [-0.567438, 0.21273], [0.279682, 0.755374], [0.120951, 1.05352], [0.211585, 1.40479], [-0.549202, -0.467717], [-0.833525, -0.159786], [0.394705, 0.672167], [-0.0513709, -0.818531], [1.67807, -0.105113], [1.03201, 0.406853], [0.401703, 1.12547], [-0.371147, 0.246529], [0.715973, -0.633293], [-0.278918, -0.74529], [1.19505, 0.754341], [-0.858487, 0.800209], [-0.490562, -1.27089], [1.53894, -0.549977], [1.12028, -0.873227], [-0.626214, -1.70165], [-0.870011, -1.31665], [-0.364442, 0.898661], [-0.938868, 0.191501], [0.656956, 0.723272], [0.487422, -0.352421], [0.667446, -0.479071], [1.08161, 1.44716], [-1.59159, 1.09543], [0.473741, 0.0348349], [0.834097, -0.573599], [-0.19537, -0.941744], [-0.75593, -0.839326], [1.33719, 0.158936], [-0.445489, 1.29624], [0.394972, -0.95499], [0.586346, 0.118846], [0.474037, -0.234908], [0.0954438, 0.359777], [0.341711, 0.0542344], [1.5428, -0.470164], [-1.44728, -0.375404], [-0.0375819, 1.0137], [-0.664858, -0.327045], [-0.39001, 1.16336], [0.771061, 0.36392], [-0.762406, -1.44825], [0.432612, 0.154949], [1.27538, 0.457659], [-1.16557, 0.580239], [1.18313, 0.79174], [-1.48497, -0.274502], [-2.09124, -1.14042], [-1.37921, 0.189445], [2.00205, 1.81439], [-1.20125, 1.76738], [0.0466702, -0.420145], [0.201648, 0.487631], [-1.71156, 0.917394], [-1.36602, -0.882879], [-0.0727535, 0.0926031], [-0.0811062, 0.203889], [-0.437882, 0.523791], [-0.544695, -0.589834], [-0.597606, 0.207334], [2.30364, 0.05361], [-2.23527, -1.97231], [-0.410048, -1.02357], [-1.50066, 0.553435], [2.88421, -0.271227], [0.887915, 0.234517], [0.66352, -1.50711], [-0.301247, 0.278591], [0.2564, 0.907826], [-0.276545, -0.531962], [0.128217, 3.21903], [-1.58314, 0.976363], [-0.160234, 0.223841], [-1.22761, -0.774916], [-0.998139, 1.47091], [-0.508565, -0.409489], [0.920596, 1.15672], [0.700768, 1.14368], [-1.2607, 1.40161], [-0.0940619, -0.710454], [-0.813082, 0.989966], [-0.204754, 1.04782], [-1.32838, 0.292944], [-1.19784, -0.27709], [-1.50047, -1.2099], [-0.349675, 1.24592], [0.595576, 0.450861], [-1.93124, -0.899907], [-0.773568, 1.47152], [1.40448, 1.06798], [-0.146481, 1.32295], [-0.128327, -0.283776], [-0.373242, -0.0803791], [-0.507778, -0.711625], [-2.5374, -2.09389], [-0.0800724, 0.200436], [-0.707903, -0.499845], [1.51183, 0.723649], [-1.1513, 0.199662], [-0.5193, -0.681224], [-0.746345, 0.0502775], [-0.813301, 0.686169], [-1.67376, 0.389771], [-0.46908, 0.242632], [-0.0143495, 0.638593], [0.544575, 0.150677], [0.168745, -0.216217], [1.97384, 0.896203], [-1.08966, -1.39009], [1.00286, -0.829195], [0.21874, 1.91534], [-0.00395804, -1.97622], [1.31941, 0.157514], [0.526279, 0.840068], [-0.174243, 0.483452], [-0.35788, -2.63842], [-0.703257, -0.136637], [0.229186, 0.300196], [1.23277, 1.12067], [0.340344, -0.945691], [1.43196, -0.207551], [-1.38018, -1.68066], [1.02672, -0.170384], [0.974074, 0.565822], [-1.08487, 0.420432], [-0.489454, -0.372433], [0.214134, -0.252663], [-0.146497, -1.58641], [-0.694953, -1.53132], [-0.831985, 0.290746], [-2.06154, 0.0791114], [1.03288, 1.12946], [2.19276, -0.0414119], [1.37585, -2.08474], [0.571082, -0.527185], [-1.36586, 0.106387], [-0.984126, 1.10838], [-1.48562, 1.21302], [-0.489361, -0.504228], [0.288182, 0.360477], [0.636906, -2.49665], [0.606375, -0.498827], [-1.3699, -2.07813], [0.140993, 0.130404], [0.227585, 0.671324], [-0.508696, -0.43769], [0.686536, 0.00985991], [-1.28574, -0.825638], [-0.257514, -0.628896], [-0.899003, -0.358909], [-0.803345, 0.65158], [-0.400003, 0.38464], [0.532371, -0.834469], [0.301788, -1.31913], [1.88391, 0.155857], [1.16464, -1.28629], [0.779508, 0.721401], [-0.667884, -0.321322], [1.18629, -0.765842], [0.924279, -0.155664], [1.24117, 0.422787], [-1.45466, -1.51253], [-0.607482, 0.367927], [0.452697, -0.236351], [0.826501, 0.77909], [-1.8702, -0.580457], [0.695595, -0.829656], [0.899648, 0.964353], [1.03145, 0.583624], [-1.14062, 0.793449], [0.588734, 0.0502924], [1.88065, 0.753729], [-1.74374, 0.763374], [0.929903, -1.43208], [0.46959, -0.363544], [0.852872, 2.55409], [0.0611106, -0.423777], [-0.0823281, 0.70117], [0.562902, -1.24581], [-0.771232, 0.448037], [-0.662542, 0.135482], [0.448362, -0.580184], [0.606109, -1.74621], [-0.211613, 0.14059], [1.17372, -0.174945], [-0.279966, -1.28045], [-0.559091, 0.138234], [-0.0339575, -0.937446], [0.3709, -0.663327], [-0.925603, -0.157267], [0.228183, 1.9081], [-0.22066, -0.743102], [-0.218435, -1.52686], [0.973707, -0.774895], [-0.714671, -0.904662], [2.59548, -0.0170057], [0.750631, 1.25177], [0.0304001, 0.203962], [0.0605462, -0.182655], [0.0848355, 0.450229], [0.639532, -0.36843], [0.374209, 1.95615], [-0.109307, 1.13118], [1.46012, 0.261082], [-0.481051, -1.37229], [-0.204773, 1.58299], [-1.49435, 0.458627], [0.266616, 1.46484], [0.123975, -0.601145], [0.521424, -0.0284228], [-1.11451, 0.478166], [1.36029, -0.975398], [-1.14535, 0.014084], [-0.609522, -0.173861], [-1.81564, -0.938981], [-0.54383, -1.08951], [-1.08384, 1.45477], [-0.755795, 0.111464], [1.19531, -0.518929], [-0.469019, -2.38071], [0.437009, 0.997103], [-1.50902, -1.07738], [-1.12261, 1.25109], [-0.113918, 0.384264], [0.0720902, -0.270724], [-0.540572, 0.263787], [-0.762595, 0.123179], [-0.760523, -1.27492], [0.841512, 0.223559], [-0.291269, -1.08134], [0.592134, -0.116742], [-0.575666, 0.240504], [0.28093, 0.858246], [0.033945, 0.364604], [-0.871256, -1.04172], [-1.17451, -0.265589], [0.297135, -0.31446], [0.489123, 0.129227], [0.289265, 0.379072], [2.42377, 0.953507], [0.610223, -0.802015], [-0.445155, -0.975274], [0.614393, -1.01616], [0.83872, 0.000589636], [0.649442, 0.408953], [-1.08369, -0.556308], [-1.18324, -0.388701], [0.5337, -1.31553], [0.61787, 0.710731], [-0.676858, 0.34465], [0.23397, -0.267227], [-1.2155, -1.44366], [1.18725, -0.0614038], [-1.46691, -0.332034], [-0.54373, -0.212946], [1.33469, -1.69905], [0.317066, 0.929964], [-0.874496, 0.650538], [0.344876, -0.202755], [0.866114, -1.20076], [0.848977, 1.47183], [0.652745, -0.211339], [0.31941, 0.793622], [-0.343494, 0.78965], [0.130349, 1.13247], [-0.685374, -1.13838], [1.30696, 0.201177], [0.995993, 0.0446384], [-0.576631, 0.500556], [0.520761, -0.410604], [1.10549, 2.77497], [1.90724, -2.32774], [1.72593, 2.3757], [0.127523, -0.103604], [-1.0444, 1.84453], [2.02025, -0.889171], [0.144819, 1.48468], [-0.247195, -0.590976], [0.379414, -0.399442], [-0.31145, 0.0405589], [-0.750158, -1.63528], [-1.64005, -1.1682], [0.892537, 0.601219], [-2.51919, 0.243846], [0.196264, -0.00372001], [-0.0947557, -1.85737], [0.516668, -0.254372], [-0.369872, 0.0726034], [0.318704, -0.369996], [0.498668, -0.975858], [0.215453, -0.120897], [-0.891578, -0.181604], [0.695455, -0.080279], [0.337833, 0.505668], [0.0425349, 0.894058], [0.398681, 0.393772], [0.322024, -1.3036], [-1.76713, -0.617684], [-0.799484, 1.18387], [-1.09011, 0.034104], [-0.353196, -1.00592], [0.469379, 0.393856], [-1.4458, 1.03938], [-0.419707, -0.700052], [-0.126686, -1.59968], [-2.56462, -2.0239], [1.84387, 0.744189], [1.32104, 1.81309], [0.0494293, -0.304532], [1.79255, -0.269118], [0.633494, 1.513], [-0.800503, 0.2235], [0.0489867, 2.12626], [0.370579, -1.09323], [0.294322, 2.44946], [0.973676, -0.563431], [-1.03661, 0.536108], [0.987528, 1.05198], [-1.36279, 1.9048], [0.551695, -1.51609], [0.533521, -1.56714], [-0.123904, -1.33515], [1.16479, 1.10537], [1.64355, 0.941772], [0.525356, 0.0744118], [0.0251129, -1.19391], [1.04174, -0.689469], [1.16155, -0.0949755], [0.400669, 0.135236], [0.0541491, 0.852852], [0.847335, -0.374513], [1.19406, 0.785711], [-1.2951, 0.299727], [-0.774313, -0.0247946], [-0.000917833, -0.543849], [-0.610554, -0.287061], [-1.65638, -0.345741], [0.52118, 0.942393], [-1.71104, 0.753406], [-1.34317, -1.28292], [1.56533, -0.623488], [-1.25891, -0.201842], [-0.270484, 1.62496], [0.019163, -0.79685], [-0.242023, 0.779025], [-1.27866, 1.22103], [-0.528527, 0.101643], [-1.05995, -0.98827], [-0.437136, -2.80862], [0.565554, 1.63501], [1.46076, -1.56106], [0.824786, 0.147819], [1.81292, -0.324645], [0.452687, -0.484248], [0.00565743, 0.932993], [-0.701425, -0.365985], [1.66695, -0.381951], [0.412556, 0.286403], [-0.45246, 0.284703], [0.827877, 2.02681], [0.0970361, -0.267785], [1.45149, -1.10122], [0.176674, 0.417794], [0.193386, 0.712574], [-0.994219, -1.1164], [0.515763, 0.72842], [1.20045, 0.357202], [-0.347055, -0.788176], [1.50302, 0.800497], [0.569656, 0.887884], [0.0266759, -0.130836], [-0.537917, 0.831635], [-2.4638, -1.19283], [0.530884, -0.329132], [-0.329367, -0.339841], [1.15843, 0.0453925], [-0.514207, -2.05392], [-0.436419, 0.0621053], [-0.230287, 0.719052], [-0.529688, -2.59283], [0.119974, -2.35762], [1.21806, -0.316991], [-1.94462, 0.136711], [1.38983, 1.43367], [-0.644157, -0.088161], [0.355188, -1.44554], [0.757033, 0.737664], [-2.02834, 1.00704], [1.42318, 0.990358], [-0.0692463, 0.342309], [0.130962, 0.946389], [1.03519, 1.1593], [0.385578, -0.211472], [1.30008, 0.0369191], [-0.645091, -0.0702825], [-0.207849, -0.0684719], [-0.409273, -0.572336], [-0.291794, -0.0645279], [-0.55155, 0.687856], [-1.04508, 0.248562], [1.17375, -0.757926], [-0.358588, -1.48798], [0.495853, -0.138303], [-1.14716, -0.316039], [-0.0739512, -0.598602], [0.378677, 0.723355], [-0.790103, 0.491844], [1.05114, 0.23579], [0.443644, -1.03853], [-0.204346, -0.254734], [1.42874, -1.11014], [-0.573683, 0.204131], [-0.327238, -0.22981], [-0.387619, -0.708798], [-0.583865, -2.3726], [1.06524, -2.16726], [-1.09836, 0.523978], [-0.415014, -1.05493], [-0.374402, 1.01279], [-2.10227, -1.26043], [0.803672, 0.970031], [-0.562285, 3.44592], [0.157567, 1.15586], [-0.507335, 0.159707], [-0.165686, 0.0218664], [0.488365, 1.20726], [-0.94494, -0.25557], [-0.108557, 0.937072], [1.82175, 0.276], [0.815432, 0.600689], [-0.621502, -0.142754], [-0.31795, 0.320259], [-0.00394008, -1.08092], [-0.629688, -0.465227], [-0.150297, 0.0357136], [2.44885, 1.15635], [-1.62058, 0.290241], [-0.111816, 1.1908], [-0.667538, -0.398397], [-0.6493, 0.654922], [-0.84511, 3.31959], [-0.557464, -0.166731], [0.32927, -0.330618], [0.469461, -1.36649], [-0.646272, 1.64189], [-0.619264, -1.42603], [-0.973767, -0.254258], [-2.0419, -2.28133], [-0.696139, 1.5762], [0.0194398, -1.31475], [-1.01086, -0.86201], [1.09907, -0.778989], [-0.926607, -1.75097], [0.402417, 1.191], [-0.819963, 0.312149], [0.553975, -0.678874], [0.484886, 0.183866], [0.404641, -0.146767], [0.729182, -0.506717], [-0.098964, -0.931853], [-0.688612, 0.933183], [0.36039, -0.115999], [0.489764, -0.221994], [2.2358, -0.177027], [0.391697, -1.14676], [1.29744, -0.480615], [0.365164, -0.1753], [1.1878, -1.55349], [0.519166, -1.17066], [0.0663717, 0.505432], [0.561306, 0.00575556], [-0.639486, 0.289603], [0.248886, 1.3013], [0.476422, 1.09452], [-0.519003, 0.0778081], [-0.894218, 0.357055], [-0.377639, 1.3436], [-0.821997, -0.460249], [0.578454, 0.399667], [-2.71177, 0.00815065], [1.72972, 1.54322], [-1.25767, 0.424631], [0.582156, -0.23404], [0.95844, 0.321276], [0.288591, -0.102104], [0.363319, 0.0207018], [1.11193, -0.807845], [0.347161, -2.50935], [-0.569355, 0.736629], [0.512036, -0.0977537], [-1.26155, 1.0804], [-0.570699, -0.956511], [-1.51375, -1.30499], [-1.55318, 1.52932], [-0.00536719, -1.88007], [0.354854, -1.67412], [-1.18547, 0.313499], [0.823106, 0.858746], [-0.581424, -0.196512], [-0.0234025, -2.29003], [-1.0277, -0.34007], [0.318451, -0.95195], [-1.39025, 0.5441], [2.55336, -0.0228017], [1.19706, -0.304907], [-0.2717, -0.155204], [1.3173, 1.16484], [-1.46029, -0.124256], [0.369491, 0.16539], [1.36636, 0.471661], [-0.775922, -0.911821], [0.314819, -1.03536], [0.981746, -1.27827], [0.745869, 0.37079], [-1.78379, -1.04231], [-0.582105, -1.46159], [-0.538042, 1.38547], [-0.506773, 0.680312], [-0.905271, 0.204706], [-0.199785, 0.397766], [1.16465, -0.613275], [0.486524, -0.731617], [-0.288953, -0.0390552], [0.896737, 0.400469], [-0.831548, 0.0576494], [-2.03616, 0.0333684], [0.0677605, -0.602643], [-0.952051, -0.963799], [-0.0556652, -1.36556], [0.0412043, 0.940797], [-0.883829, -0.705589], [1.57109, -0.239523], [1.18736, 1.18196], [-0.500189, 1.59696], [-1.12236, 1.23193], [0.451472, -0.115106], [0.0647658, 1.22229], [0.683932, -0.12665], [0.264998, 0.965813], [2.4754, 0.496097], [-1.04375, 0.334224], [-1.26666, -1.30227], [-0.437887, -0.24741], [-1.34209, 0.0212165], [0.0100202, -1.72318], [0.234954, 0.450138], [-0.998634, 0.981007], [-0.749018, -0.85165], [-2.11172, 0.577559], [0.0815553, -0.0660415], [0.66993, 0.253295], [-0.38844, 0.0315316], [-0.816602, -1.13257], [0.180548, -0.023943], [-0.474977, -0.409587], [-0.721104, 1.19705], [-0.410808, -2.25118], [-0.243645, 0.389952], [-2.48359, -0.0613325], [0.362317, 0.455901], [-0.614325, -0.818379], [-0.221531, 0.387525], [0.76048, 0.716181], [-0.251954, -2.03584], [-0.255745, 0.131604], [-0.276625, 0.196372], [-1.00511, 0.127811], [0.405734, -0.932489], [-0.901784, -1.20458], [-0.304622, -0.238756], [1.53929, -0.712607], [0.656432, -1.02667], [0.639049, 0.888496], [0.538198, 2.39167], [-0.367266, -0.0600696], [-0.768924, 0.324871], [-0.77445, -1.3222], [-1.19619, 1.07086], [0.110543, -1.42439], [-0.373334, -0.0793233], [1.09224, 0.987827], [-2.27172, 1.02365], [0.285715, -0.921374], [1.33082, -0.286332], [1.46311, 0.539082], [-1.61996, 0.669608], [0.438479, 2.60993], [-1.13546, 1.07193], [-1.9663, -1.05068], [0.123316, -0.374968], [0.915063, 0.660079], [-1.98964, 0.287309], [2.16608, 0.24631], [1.8104, -1.23067], [-0.154682, -0.208087], [0.210437, 0.35854], [-1.42009, -1.62322], [-0.0909902, -1.03053], [0.944582, 0.49327], [-0.762145, 1.98068], [-0.999201, -2.12108], [0.412362, -0.248292], [0.455183, 0.702731], [0.236988, -0.517877], [-0.0374885, -0.17247], [0.96271, -2.17589], [0.0113102, 0.126853], [-1.00728, 0.0198978], [-0.773542, 1.40667], [-0.566324, -1.63676], [-0.767773, 0.438585], [0.337854, 0.534918], [0.0287283, 0.317772], [1.3919, 0.877594], [-0.798186, 1.30224], [-2.07755, -0.312064], [-1.01399, 0.940973], [-1.25153, -1.5387], [-0.524975, 0.080868], [0.0797614, 0.239796], [0.0956565, -0.698444], [0.147941, 1.84792], [0.8016, 0.238835], [0.23246, 0.0151746], [-2.12457, 0.881792], [-0.711904, -0.104244], [-0.245624, 0.512708], [1.12235, 1.65715], [0.00496017, -0.701278], [-0.516653, 0.276595], [-0.949625, -0.31033], [0.439616, -1.74055], [-1.07232, -0.638487], [0.126046, 1.74187], [0.500682, 0.687388], [-1.29569, 0.424968], [-1.24563, 1.3822], [0.584518, 1.0448], [1.21201, 0.951916], [0.832242, -0.333032], [0.746457, 2.17353], [-0.49986, -0.771412], [-0.929274, 0.99857], [1.89281, 1.26686], [-1.01927, 1.17337], [1.035, -1.12982], [-0.764936, 0.897869], [0.0295534, -0.640278], [-0.345498, 1.0377], [-0.0434688, 0.833539], [1.1402, -0.675048], [-1.25897, 0.689338], [-0.12245, -0.21025], [-0.0848153, 0.201959], [0.226738, 1.12701], [-0.00638499, 0.618052], [-1.03348, 1.18184], [-0.892638, 0.0380599], [0.377239, 0.504302], [1.81161, -1.70934], [-1.00696, -0.683504], [0.621547, -0.925813], [0.687788, 1.56845], [0.272612, 1.94963], [-0.198476, 0.0661005], [-1.6875, -1.30918], [0.949896, 1.09731], [-1.11979, 0.78039], [-0.461724, -1.34513], [0.5761, -0.716619], [0.859432, -0.0241924], [-1.02742, -0.538449], [1.35795, 1.0619], [0.472289, 0.603105], [1.81824, 0.334394], [1.36778, 0.632521], [-0.82999, -1.26714], [1.53366, 0.128943], [-0.388881, 0.285737], [0.853306, -0.882685], [0.25278, 1.84658], [1.12651, 0.495177], [1.94484, -0.882168], [1.30812, -1.56248], [-1.41455, 0.49967], [-0.843078, -0.146927], [-1.27123, -0.663297], [2.22449, 1.38502], [-0.001271, -1.26174], [1.22906, 0.286519], [-1.00135, -0.0820875], [-1.89613, 1.17284], [-0.56098, 3.04576], [0.140465, 0.238299], [-1.34982, 2.31735], [0.536465, -0.382739], [1.26624, -1.44119], [0.745741, -0.702564], [-0.517982, -0.831608], [-0.627377, 0.388396], [-0.140789, 0.176391], [0.315242, -0.185723], [0.794804, 1.00042], [-0.647678, -0.235116], [1.78143, 1.04622], [-0.262964, -1.78253], [-0.486572, -1.77751], [0.904881, -0.89635], [-0.0508336, -1.35195], [0.640106, -0.456426], [0.252893, 0.0155731], [0.217156, 1.40347], [-0.394186, 1.19028], [1.25799, -0.227223], [0.858356, 0.378674], [1.26293, 0.189622], [-0.712565, -0.504085], [2.46637, 1.56416], [-0.567978, 1.30861], [-1.10977, -0.345549], [0.471204, 0.00806457], [1.80547, -1.12261], [-0.0560927, 2.48337], [0.08416, 1.6267], [2.28704, 0.669478], [0.543775, -1.11671], [1.02993, -1.33416], [0.310876, 1.73437], [0.354757, -0.492108], [0.733383, 1.67913], [-0.597031, 1.25056], [-1.03228, -0.0507122], [0.439803, 1.25489], [1.51004, 0.766595], [-1.83451, -0.787465], [1.02143, 1.28207], [-0.855308, -0.512009], [1.34727, 0.190189], [-1.30282, 1.31732], [-0.280476, -0.250465], [0.353894, -1.27819], [-0.629537, -1.06361], [1.93548, -0.119851], [-1.03482, -1.07915]
])
def make_uniform_plot():
fig = plt.figure(figsize=[6, 1.5])
left, bottom, width, height = 0.1, 0.15, 0.8, 0.9
ax = fig.add_axes([left, bottom, width, height])
ax.scatter(uniform_samples[:, 1], uniform_samples[:, 0], color='k', marker='.', s=4)
ax.set_aspect(1)
ax.set_xlabel('$x_2$')
ax.set_ylabel("$x_1$")
fig.savefig("../assets/img/03_uniform_samples.png", transparent=True)
def make_gaussian_plot():
fig = plt.figure(figsize=[6, 6])
left, bottom, width, height = 0.1, 0.1, 0.8, 0.8
ax = fig.add_axes([left, bottom, width, height])
ax.scatter(transformed_samples[:, 0], transformed_samples[:, 1], color='k', marker='.', s=4)
ax.set_aspect(1)
ax.set_xlabel('$y_1$')
ax.set_ylabel("$y_2$")
ax.set_xlim(-3.5, 3.5)
ax.set_ylim(-3.5, 3.5)
fig.savefig("../assets/img/03_gaussian_samples.png", transparent=True)
if __name__ == "__main__":
make_uniform_plot()
make_gaussian_plot()
*.swp
*.swo
.DS_Store
build
cmake_minimum_required(VERSION 3.13) # 3.13 is required for target_link_options
project(Rand CXX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
include(cmake/shared_settings.cmake)
add_subdirectory(rand)
# This file defines an interface library used to add common compile flags to all libraries and
# executables.
#---------------------------------------------------------------------------------------------------
add_library(shared_settings INTERFACE)
# Speed flags
target_compile_options(shared_settings INTERFACE -march=native -ffast-math)
# Warning flags
target_compile_options(shared_settings INTERFACE
-Wall
-Wcast-align
-Wcast-qual
-Wextra
-Wundef
-Wzero-as-null-pointer-constant
-pedantic
)
target_compile_features(shared_settings INTERFACE cxx_std_17)
add_executable(rand
main.cpp
)
target_link_libraries(rand shared_settings Eigen3::Eigen)
#include <iostream>
#include <Eigen/Dense>
#include <cmath>
#include <vector>
#include "xorshift.h"
//--------------------------------------------------------------------------------------------------
int main() {
XorShift64 rand;
uint32_t constexpr n_warmup = 1000;
uint32_t constexpr n_samples = 100000000;
uint32_t constexpr n_printed = 1000;
for (uint32_t i = 0; i < n_warmup; ++i) {
rand.advance();
}
Eigen::ArrayX2d samples;
samples.resize(n_samples, 2);
// Draw uniform samples.
for (uint32_t i = 0; i < n_samples; ++i) {
samples(i, 0) = rand.draw_double();
samples(i, 1) = rand.draw_double();
}
samples.col(1) *= 2 * 3.1415926;
// Print uniform samples.
std::cout << "Uniform samples\n";
for (uint32_t i = 0; i < n_printed; ++i) {
std::cout << '[' << samples(i, 0) << ", " << samples(i, 1) << "], ";
}
std::cout << "\n\n";
// Transform samples.
Eigen::ArrayXd radii = Eigen::sqrt(-2 * Eigen::log(samples.col(0)));
samples.col(0) = radii * Eigen::sin(samples.col(1));
samples.col(1) = radii * Eigen::cos(samples.col(1));
// Print transformed samples.
std::cout << "Transformed samples\n";
for (uint32_t i = 0; i < n_printed; ++i) {
std::cout << '[' << samples(i, 0) << ", " << samples(i, 1) << "], ";
}
std::cout << "\n\n";
// Calculate expectations of y_1, y_1^2, and y_1^3.
double e_1 = samples.col(1).mean();
double e_2 = samples.col(1).square().mean();
double e_3 = samples.col(1).cube().mean();
std::cout << "C1 = " << e_1 << '\n';
std::cout << "C2 = " << e_2 - e_1 * e_1 << '\n';
std::cout << "C3 = " << e_3 - 3 * e_1 * e_2 + 2 * e_1 * e_1 * e_1 << '\n';
}
#ifndef XORSHIFT_H
#define XORSHIFT_H
#include <stdint.h>
//--------------------------------------------------------------------------------------------------
// from Numerical Recipes in C, 3rd Edition
class XorShift64 {
public:
XorShift64 (): x_(0xdefceed) {}
XorShift64 (uint64_t seed): x_(seed) {}
inline XorShift64& advance();
inline uint64_t draw_uint64() { advance(); return x_; }
inline uint32_t draw_uint32() { advance(); return static_cast<uint32_t>(x_); }
inline double draw_double() { advance(); return 5.42101086242752217e-20 * x_; }
private:
uint64_t x_;
static constexpr uint32_t a1_ = 21;
static constexpr uint32_t a2_ = 35;
static constexpr uint32_t a3_ = 4;
};
//..................................................................................................
XorShift64& XorShift64::advance() {
x_ = x_ ^ (x_ >> a1_);
x_ = x_ ^ (x_ << a2_);
x_ = x_ ^ (x_ >> a3_);
return *this;
}
#endif
......@@ -322,3 +322,63 @@ $$
This is the two dimensional normal normal distribution with mean $$(0, 0)$$ and identity covariance
matrix.
### (c)
{:.question}
Write a uniform random number generator, and transform it by the equations above. Numerically
evaluate the first three cumulants of its output.
I implemented a 64 bit [xorshift](https://en.wikipedia.org/wiki/Xorshift) random number generator
(code lives [here](https://gitlab.cba.mit.edu/erik/nmm_2020_site/_code/pset_03_rand)). These
generators are mathematically equivalent to LFSRs, but they are more efficient to implement in
software. I got the special constants from Numerical Recipes in C, third edition.
First, let's make sure it works. Here are 1,000 samples drawn from a uniform distribution on a
rectangle of area $$2 \pi$$.
![uniform samples](../assets/img/03_uniform_samples.png)
And here are the transformed samples.
![gaussian samples](../assets/img/03_gaussian_samples.png)
Looks good to me.
Cumulants can be defined for multivariate distributions, but since I already worked out the
univariate cases above I'm just going to calculate them for $$y_1$$ alone. I computed $$\langle y_1
\rangle$$, $$\langle y_1^2 \rangle$$, and $$\langle y_1^3 \rangle$$ experimentally by taking the
average over a large sample of $$y_1$$, $$y_1^2$$, and $$y_1^3$$, respectively. Then I just plugged
the resulting values into the formulas I found in the previous problem.
With 100,000 samples, I get these values.
$$
\begin{aligned}
C_1 &= 0.00106 \\
C_2 &= 1.00525 \\
C_3 &= -0.00516
\end{aligned}
$$
With 1,000,000 samples, I get these.
$$
\begin{aligned}
C_1 &= 7.524 \times 10^{-5} \\
C_2 &= 0.9992 \\
C_3 &= -0.003815
\end{aligned}
$$
And with one hundred million samples, I get these.
$$
\begin{aligned}
C_1 &= 8.541 \times 10^{-5} \\
C_2 &= 0.9999 \\
C_3 &= 4.013 \times 10^{-4}
\end{aligned}
$$
These are consistent with the predicted values.
assets/img/03_gaussian_samples.png

16.8 KiB

assets/img/03_uniform_samples.png

9.5 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment