-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinear Algerbra assignment.py
More file actions
540 lines (521 loc) · 16.1 KB
/
Linear Algerbra assignment.py
File metadata and controls
540 lines (521 loc) · 16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# This code was written for an assignment done during a course at the University of Waterloo.
# Due to copyright and trademark rules, the questions for which the code was written for is not provided.
import math
import random
import numpy as np
class BoxMueller:
call_count = 0;
second_random_variable = 0.0;
@classmethod
def randn( cls ):
cls.call_count += 1;
if cls.call_count%2 == 0:
return cls.second_random_variable;
u1 = 1.0 - random.random();
u2 = 1.0 - random.random();
c = math.sqrt( -2.0*math.log(u1) );
cls.second_random_variable = c*math.sin( 2*math.pi*u2 );
return c*math.cos( 2*math.pi*u2 );
white_noise = [None] * 16
# Question 1
random.seed(132456 )
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print( white_noise )
random.seed( 278567 )
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print( white_noise )
random.seed( 354879)
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print( white_noise )
random.seed( 4568742 )
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print( white_noise )
random.seed( 5765892)
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print( white_noise )
#Question 3
x = np.arange(16)
print(x)
m1 = np.cos(2.*np.pi * 1. * (x+0.5)/16.)
print(m1)
m2 = np.cos(2.*np.pi * 2. * (x+0.5)/16.)
print(m2)
m3 = np.cos(2.*np.pi * 3. * (x+0.5)/16.)
print(m3)
m4 = np.cos(2.*np.pi * 4. * (x+0.5)/16.)
print(m4)
m5 = np.cos(2.*np.pi * 5. * (x+0.5)/16.)
print(m5)
m6 = np.cos(2.*np.pi * 6. * (x+0.5)/16.)
print(m6)
m7 = np.cos(2.*np.pi * 7. * (x+0.5)/16.)
print(m7)
m8 = np.cos(2.*np.pi * 8. * (x+0.5)/16.)
print(m8)
m9 = np.sin(2.*np.pi * 1. * (x+0.5)/16.)
print(m9)
m10 = np.sin(2.*np.pi * 2. * (x+0.5)/16.)
print(m10)
m11 = np.sin(2.*np.pi * 3. * (x+0.5)/16.)
print(m11)
m12 = np.sin(2.*np.pi * 4. * (x+0.5)/16.)
print(m12)
m13 = np.sin(2.*np.pi * 5. * (x+0.5)/16.)
print(m13)
m14 = np.sin(2.*np.pi * 6. * (x+0.5)/16.)
print(m14)
m15 = np.sin(2.*np.pi * 7. * (x+0.5)/16.)
print(m15)
m16 = np.sin(2.*np.pi * 8. * (x+0.5)/16.)
print(m16)
m0 = np.ones(16)
print(m0)
# Question 4
m1_nor = np.sqrt(np.sum(m1*m1))
print("m1 nor:", m1_nor)
m2_nor = np.sqrt(np.sum(m2*m2))
print("m2 nor:", m2_nor)
m3_nor = np.sqrt(np.sum(m3*m3))
print("m3 nor:", m3_nor)
m4_nor = np.sqrt(np.sum(m4*m4))
print("m4 nor:", m4_nor)
m5_nor = np.sqrt(np.sum(m5*m5))
print("m5 nor:", m5_nor)
m6_nor = np.sqrt(np.sum(m6*m6))
print("m6 nor:", m6_nor)
m7_nor = np.sqrt(np.sum(m7*m7))
print("m7 nor:", m7_nor)
m9_nor = np.sqrt(np.sum(m9*m9))
print("m9 nor:", m9_nor)
m10_nor = np.sqrt(np.sum(m10*m10))
print("m10 nor:", m10_nor)
m11_nor = np.sqrt(np.sum(m11*m11))
print("m11 nor:", m11_nor)
m12_nor = np.sqrt(np.sum(m12*m12))
print("m12 nor:", m12_nor)
m13_nor = np.sqrt(np.sum(m13*m13))
print("m13 nor:", m13_nor)
m14_nor = np.sqrt(np.sum(m14*m14))
print("m14 nor:", m14_nor)
m15_nor = np.sqrt(np.sum(m15*m15))
print("m15 nor:", m15_nor)
m16_nor = np.sqrt(np.sum(m16*m16))
print("m16 nor:", m16_nor)
m0_nor = np.sqrt(np.sum(m0*m0))
print("m0 nor:", m0_nor)
m1n = m1/m1_nor
m2n = m2/m2_nor
m3n = m3/m3_nor
m4n = m4/m4_nor
m5n = m5/m5_nor
m6n = m6/m6_nor
m7n = m7/m7_nor
m9n = m9/m9_nor
m10n = m10/m10_nor
m11n = m11/m11_nor
m12n = m12/m12_nor
m13n = m13/m13_nor
m14n = m14/m14_nor
m15n = m15/m15_nor
m16n = m16/m16_nor
m0n = m0/m0_nor
# Question 5
print("m0 in m1",np.sum(m0n*m1n))
print("m0 in m2",np.sum(m0n*m2n))
print("m0 in m3",np.sum(m0n*m3n))
print("m0 in m4",np.sum(m0n*m4n))
print("m0 in m5",np.sum(m0n*m5n))
print("m0 in m6",np.sum(m0n*m6n))
print("m0 in m7",np.sum(m0n*m7n))
print("m0 in m9",np.sum(m0n*m9n))
print("m0 in m10",np.sum(m0n*m10n))
print("m0 in m11",np.sum(m0n*m11n))
print("m0 in m12",np.sum(m0n*m12n))
print("m0 in m13",np.sum(m0n*m13n))
print("m0 in m14",np.sum(m0n*m14n))
print("m0 in m15",np.sum(m0n*m15n))
print("m0 in m16",np.sum(m0n*m16n))
print("m1 in m2",np.sum(m1n*m2n))
print("m1 in m3",np.sum(m1n*m3n))
print("m1 in m4",np.sum(m1n*m4n))
print("m1 in m5",np.sum(m1n*m5n))
print("m1 in m6",np.sum(m1n*m6n))
print("m1 in m7",np.sum(m1n*m7n))
print("m1 in m9",np.sum(m1n*m9n))
print("m1 in m10",np.sum(m1n*m10n))
print("m1 in m11",np.sum(m1n*m11n))
print("m1 in m12",np.sum(m1n*m12n))
print("m1 in m13",np.sum(m1n*m13n))
print("m1 in m14",np.sum(m1n*m14n))
print("m1 in m15",np.sum(m1n*m15n))
print("m1 in m16",np.sum(m1n*m16n))
print("m2 in m3",np.sum(m2n*m3n))
print("m2 in m4",np.sum(m2n*m4n))
print("m2 in m5",np.sum(m2n*m5n))
print("m2 in m6",np.sum(m2n*m6n))
print("m2 in m7",np.sum(m2n*m7n))
print("m2 in m9",np.sum(m2n*m9n))
print("m2 in m10",np.sum(m2n*m10n))
print("m2 in m11",np.sum(m2n*m11n))
print("m2 in m12",np.sum(m2n*m12n))
print("m2 in m13",np.sum(m2n*m13n))
print("m2 in m14",np.sum(m2n*m14n))
print("m2 in m15",np.sum(m2n*m15n))
print("m2 in m16",np.sum(m2n*m16n))
print("m3 in m4",np.sum(m3n*m4n))
print("m3 in m5",np.sum(m3n*m5n))
print("m3 in m6",np.sum(m3n*m6n))
print("m3 in m7",np.sum(m3n*m7n))
print("m3 in m9",np.sum(m3n*m9n))
print("m3 in m10",np.sum(m3n*m10n))
print("m3 in m11",np.sum(m3n*m11n))
print("m3 in m12",np.sum(m3n*m12n))
print("m3 in m13",np.sum(m3n*m13n))
print("m3 in m14",np.sum(m3n*m14n))
print("m3 in m15",np.sum(m3n*m15n))
print("m3 in m16",np.sum(m3n*m16n))
print("m4 in m5",np.sum(m4n*m5n))
print("m4 in m6",np.sum(m4n*m6n))
print("m4 in m7",np.sum(m4n*m7n))
print("m4 in m9",np.sum(m4n*m9n))
print("m4 in m10",np.sum(m4n*m10n))
print("m4 in m11",np.sum(m4n*m11n))
print("m4 in m12",np.sum(m4n*m12n))
print("m4 in m13",np.sum(m4n*m13n))
print("m4 in m14",np.sum(m4n*m14n))
print("m4 in m15",np.sum(m4n*m15n))
print("m4 in m16",np.sum(m4n*m16n))
print("m5 in m6",np.sum(m5n*m6n))
print("m5 in m7",np.sum(m5n*m7n))
print("m5 in m9",np.sum(m5n*m9n))
print("m5 in m10",np.sum(m5n*m10n))
print("m5 in m11",np.sum(m5n*m11n))
print("m5 in m12",np.sum(m5n*m12n))
print("m5 in m13",np.sum(m5n*m13n))
print("m5 in m14",np.sum(m5n*m14n))
print("m5 in m15",np.sum(m5n*m15n))
print("m5 in m16",np.sum(m5n*m16n))
print("m6 in m7",np.sum(m6n*m7n))
print("m6 in m9",np.sum(m6n*m9n))
print("m6 in m10",np.sum(m6n*m10n))
print("m6 in m11",np.sum(m6n*m11n))
print("m6 in m12",np.sum(m6n*m12n))
print("m6 in m13",np.sum(m6n*m13n))
print("m6 in m14",np.sum(m6n*m14n))
print("m6 in m15",np.sum(m6n*m15n))
print("m6 in m16",np.sum(m6n*m16n))
print("m7 in m9",np.sum(m7n*m9n))
print("m7 in m10",np.sum(m7n*m10n))
print("m7 in m11",np.sum(m7n*m11n))
print("m7 in m12",np.sum(m7n*m12n))
print("m7 in m13",np.sum(m7n*m13n))
print("m7 in m14",np.sum(m7n*m14n))
print("m7 in m15",np.sum(m7n*m15n))
print("m7 in m16",np.sum(m7n*m16n))
print("m9 in m10",np.sum(m9n*m10n))
print("m9 in m11",np.sum(m9n*m11n))
print("m9 in m12",np.sum(m9n*m12n))
print("m9 in m13",np.sum(m9n*m13n))
print("m9 in m14",np.sum(m9n*m14n))
print("m9 in m15",np.sum(m9n*m15n))
print("m9 in m16",np.sum(m9n*m16n))
print("m10 in m11",np.sum(m10n*m11n))
print("m10 in m12",np.sum(m10n*m12n))
print("m10 in m13",np.sum(m10n*m13n))
print("m10 in m14",np.sum(m10n*m14n))
print("m10 in m15",np.sum(m10n*m15n))
print("m10 in m16",np.sum(m10n*m16n))
print("m11 in m12",np.sum(m11n*m12n))
print("m11 in m13",np.sum(m11n*m13n))
print("m11 in m14",np.sum(m11n*m14n))
print("m11 in m15",np.sum(m11n*m15n))
print("m11 in m16",np.sum(m11n*m16n))
print("m12 in m13",np.sum(m12n*m13n))
print("m12 in m14",np.sum(m12n*m14n))
print("m12 in m15",np.sum(m12n*m15n))
print("m12 in m16",np.sum(m12n*m16n))
print("m13 in m14",np.sum(m13n*m14n))
print("m13 in m15",np.sum(m13n*m15n))
print("m13 in m16",np.sum(m13n*m16n))
print("m14 in m15",np.sum(m14n*m15n))
print("m14 in m16",np.sum(m14n*m16n))
print("m15 in m16",np.sum(m15n*m16n))
# question 6 also add the whitnoise inner product with the zero vector
random.seed(132456)
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print("w10 in m1",np.sum(white_noise*m1n))
print("w10 in m2",np.sum(white_noise*m2n))
print("w10 in m3",np.sum(white_noise*m3n))
print("w10 in m4",np.sum(white_noise*m4n))
print("w10 in m5",np.sum(white_noise*m5n))
print("w10 in m6",np.sum(white_noise*m6n))
print("w10 in m7",np.sum(white_noise*m7n))
print("w10 in m9",np.sum(white_noise*m9n))
print("w10 in m10",np.sum(white_noise*m10n))
print("w10 in m11",np.sum(white_noise*m11n))
print("w10 in m12",np.sum(white_noise*m12n))
print("w10 in m13",np.sum(white_noise*m13n))
print("w10 in m14",np.sum(white_noise*m14n))
print("w10 in m15",np.sum(white_noise*m15n))
print("w10 in m16",np.sum(white_noise*m16n))
print("w10 in m0",np.sum(white_noise*m0n))
random.seed( 278567 )
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print("w20 in m1",np.sum(white_noise*m1n))
print("w20 in m2",np.sum(white_noise*m2n))
print("w20 in m3",np.sum(white_noise*m3n))
print("w20 in m4",np.sum(white_noise*m4n))
print("w20 in m5",np.sum(white_noise*m5n))
print("w20 in m6",np.sum(white_noise*m6n))
print("w20 in m7",np.sum(white_noise*m7n))
print("w20 in m9",np.sum(white_noise*m9n))
print("w20 in m10",np.sum(white_noise*m10n))
print("w20 in m11",np.sum(white_noise*m11n))
print("w20 in m12",np.sum(white_noise*m12n))
print("w20 in m13",np.sum(white_noise*m13n))
print("w20 in m14",np.sum(white_noise*m14n))
print("w20 in m15",np.sum(white_noise*m15n))
print("w20 in m16",np.sum(white_noise*m16n))
print("w20 in m0",np.sum(white_noise*m0n))
random.seed( 354879)
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print("w30 in m1",np.sum(white_noise*m1n))
print("w30 in m2",np.sum(white_noise*m2n))
print("w30 in m3",np.sum(white_noise*m3n))
print("w30 in m4",np.sum(white_noise*m4n))
print("w30 in m5",np.sum(white_noise*m5n))
print("w30 in m6",np.sum(white_noise*m6n))
print("w30 in m7",np.sum(white_noise*m7n))
print("w30 in m9",np.sum(white_noise*m9n))
print("w30 in m10",np.sum(white_noise*m10n))
print("w30 in m11",np.sum(white_noise*m11n))
print("w30 in m12",np.sum(white_noise*m12n))
print("w30 in m13",np.sum(white_noise*m13n))
print("w30 in m14",np.sum(white_noise*m14n))
print("w30 in m15",np.sum(white_noise*m15n))
print("w30 in m16",np.sum(white_noise*m16n))
print("m30 in v0",np.sum(white_noise*m0n))
random.seed( 4568742 )
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print("w40 in m1",np.sum(white_noise*m1n))
print("w40 in m2",np.sum(white_noise*m2n))
print("w40 in m3",np.sum(white_noise*m3n))
print("w40 in m4",np.sum(white_noise*m4n))
print("w40 in m5",np.sum(white_noise*m5n))
print("w40 in m6",np.sum(white_noise*m6n))
print("w40 in m7",np.sum(white_noise*m7n))
print("w40 in m9",np.sum(white_noise*m9n))
print("w40 in m10",np.sum(white_noise*m10n))
print("w40 in m11",np.sum(white_noise*m11n))
print("w40 in m12",np.sum(white_noise*m12n))
print("w40 in m13",np.sum(white_noise*m13n))
print("w40 in m14",np.sum(white_noise*m14n))
print("w40 in m15",np.sum(white_noise*m15n))
print("w40 in m16",np.sum(white_noise*m16n))
print("w40 in m0",np.sum(white_noise*m0n))
random.seed( 5765892)
for i in range( 0, 16 ):
white_noise[i] = BoxMueller.randn();
pray = np.array(white_noise)
np.sqrt(np.sum(pray*pray))
np.mean(pray)
print("w50 in m1",np.sum(white_noise*m1n))
print("w50 in m2",np.sum(white_noise*m2n))
print("w50 in m3",np.sum(white_noise*m3n))
print("w50 in m4",np.sum(white_noise*m4n))
print("w50 in m5",np.sum(white_noise*m5n))
print("w50 in m6",np.sum(white_noise*m6n))
print("w50 in m7",np.sum(white_noise*m7n))
print("w50 in m9",np.sum(white_noise*m9n))
print("w50 in m10",np.sum(white_noise*m10n))
print("w50 in m11",np.sum(white_noise*m11n))
print("w50 in m12",np.sum(white_noise*m12n))
print("w50 in m13",np.sum(white_noise*m13n))
print("w50 in m14",np.sum(white_noise*m14n))
print("w50 in m15",np.sum(white_noise*m15n))
print("w50 in m16",np.sum(white_noise*m16n))
print("w50 in m0",np.sum(white_noise*m0n))
# Question 7
x = np.arange(16)
A = 20
Fee = 2
phi= 0.9197057831
sig = A*np.sin(2*np.pi*Fee*(x+0.5)/16. + phi)
coef1= np.sum(sig*m1n)
coef2=np.sum(sig*m2n)
coef3 =np.sum(sig*m3n)
coef4 =np.sum(sig*m4n)
coef5 = np.sum(sig*m5n)
coef6 = np.sum(sig*m6n)
coef7 = np.sum(sig*m7n)
coef9 = np.sum(sig*m9n)
coef10 = np.sum(sig*m10n)
coef11 = np.sum(sig*m11n)
coef12 = np.sum(sig*m12n)
coef13 = np.sum(sig*m13n)
coef14 = np.sum(sig*m14n)
coef15 = np.sum(sig*m15n)
coef16 = np.sum(sig*m16n)
coef0 = np.sum(sig*m0n)
print ("sig of 2-Norm", np.sqrt(np.sum(sig*sig)))
print(coef1)
print(coef2)
print(coef3)
print(coef4)
print(coef5)
print(coef6)
print(coef7)
print(coef9)
print(coef10)
print(coef11)
print(coef12)
print(coef13)
print(coef14)
print(coef15)
print(coef16)
print(coef0)
print ("sig. on the coef. of 2-Norm", np.sqrt((coef1*coef1)+(coef9*coef9)))
# Question 8
f1 = 1.398745
sig_1 = A*np.sin(2*np.pi*f1*(x+0.5)/16. + phi)
coef1x= np.sum(sig_1*m1n)
coef2x=np.sum(sig_1*m2n)
coef3x =np.sum(sig_1*m3n)
coef4x =np.sum(sig_1*m4n)
coef5x = np.sum(sig_1*m5n)
coef6x = np.sum(sig_1*m6n)
coef7x = np.sum(sig_1*m7n)
coef9x = np.sum(sig_1*m9n)
coef10x = np.sum(sig_1*m10n)
coef11x = np.sum(sig_1*m11n)
coef12x = np.sum(sig_1*m12n)
coef13x = np.sum(sig_1*m13n)
coef14x = np.sum(sig_1*m14n)
coef15x = np.sum(sig_1*m15n)
coef16x = np.sum(sig_1*m16n)
coef0x = np.sum(sig_1*m0n)
print(coef1x)
print(coef2x)
print(coef3x)
print(coef4x)
print(coef5x)
print(coef6x)
print(coef7x)
print(coef9x)
print(coef10x)
print(coef11x)
print(coef12x)
print(coef13x)
print(coef14x)
print(coef15x)
print(coef16x)
print(coef0x)
print ("2-Norm of Sig.", np.sqrt(np.sum(sig_1*sig_1)))
print ("sig. on the coef. of 2-Norm", np.sqrt((coef1x*coef1x)+(coef9x*coef9x)+(coef2x*coef2x)+(coef3x*coef3x)+(coef4x*coef4x)+(coef5x*coef5x)+(coef6x*coef6x)+(coef7x*coef7x)+(coef10x*coef10x)+(coef11x*coef11x)+(coef12x*coef12x)+(coef13x*coef13x)+(coef14x*coef14x)+(coef15x*coef15x)+(coef16x*coef16x)+(coef0x*coef0x)))
# The coefficients does provide usefull info on the 16 norxalized dimentional vector as it provides the 2 norm of the signal_1 vectors and provides some what of the frequicency as we can give a rough apporximation
# Question 9
White_noise1 = np.array(( -1.90, -6.05, -2.48, 2.82, -.324, 3.99, 5.22, -2.90, -.599, -1.64, -3.76, -2.97, 3.39, 4.23, 3.26, 3.35 ))
coef1m= np.sum(White_noise1*m1n)
coef2m=np.sum(White_noise1*m2n)
coef3m =np.sum(White_noise1*m3n)
coef4m =np.sum(White_noise1*m4n)
coef5m = np.sum(White_noise1*m5n)
coef6m = np.sum(White_noise1*m6n)
coef7m = np.sum(White_noise1*m7n)
coef9m = np.sum(White_noise1*m9n)
coef10m = np.sum(White_noise1*m10n)
coef11m = np.sum(White_noise1*m11n)
coef12m = np.sum(White_noise1*m12n)
coef13m = np.sum(White_noise1*m13n)
coef14m = np.sum(White_noise1*m14n)
coef15m = np.sum(White_noise1*m15n)
coef16m = np.sum(White_noise1*m16n)
coef0m = np.sum(White_noise1*m0n)
print(coef1m)
print(coef2m)
print(coef3m)
print(coef4m)
print(coef5m)
print(coef6m)
print(coef7m)
print(coef9m)
print(coef10m)
print(coef11m)
print(coef12m)
print(coef13m)
print(coef14m)
print(coef15m)
print(coef16m)
print(coef0m)
# The frequencies are 5 and 2
#Question 10
t1 = np.array ((-0.1591651345,-0.9730117519,-0.5855458235,0.5248543817,0.9872519740,0.2307555723,-0.8106393076,-0.8511920292,0.1591651223,0.9730117520,0.5855458262,-0.5248543789,-0.9872519761,-0.2307555755,0.8106393115,0.8511920414))
coef1e= np.sum(t1*m1n)
coef2e=np.sum(t1*m2n)
coef3e =np.sum(t1*m3n)
coef4e =np.sum(t1*m4n)
coef5e = np.sum(t1*m5n)
coef6e = np.sum(t1*m6n)
coef7e = np.sum(t1*m7n)
coef9e = np.sum(t1*m9n)
coef10e = np.sum(t1*m10n)
coef11e = np.sum(t1*m11n)
coef12e = np.sum(t1*m12n)
coef13e = np.sum(t1*m13n)
coef14e = np.sum(t1*m14n)
coef15e = np.sum(t1*m15n)
coef16e = np.sum(t1*m16n)
coef0e = np.sum(t1*m0n)
print(coef1e)
print(coef2e)
print(coef3e)
print(coef4e)
print(coef5e)
print(coef6e)
print(coef7e)
print(coef9e)
print(coef10e)
print(coef11e)
print(coef12e)
print(coef13e)
print(coef14e)
print(coef15e)
print(coef16e)
print(coef0e)
# The frequensies is 3