-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic_statistics.jl
1662 lines (1374 loc) · 58.2 KB
/
basic_statistics.jl
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
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
### A Pluto.jl notebook ###
# v0.19.5
using Markdown
using InteractiveUtils
# ╔═╡ 653103ae-a91b-11ec-3cbd-6bcb6a71d48a
begin
using PlutoUI, Plots, StatsBase, Measures, Distributions, QuadGK
using LaTeXStrings, Random
end
# ╔═╡ 26e4377a-377d-47b9-9305-6b210d8b482b
md"""
# Estatística na Linguagem Julia
Version 0.0.1
## Probabilidade
_Probabilidade_ é a chance de algum evento acontecer, quantificados como números entre 0 e 1, com valores mais altos indicando uma maior probabilidade de ocorrência.
Uma maneira de representar a idéia acima é considerar uma _espaço de probabilidade_ que consiste de 3 elementos:
1 - **Espaço Amostral**: O conjunto de todas os possíveis resultados de experimentos.\
O espaço amostral é representado por **ômega** Ω. Considere como exemplo jogar uma moeda 2 vezes onde _a-cara_, _b-coroa_. O espaço amostral é o conjunto com todos os resultados possíveis:\
Ω = {aa, ab, ba, bb}\
2 - **Coleção de Eventos**: Cada evento é um subconjunto do _espaço amostral_ Ω.\
O evento A de resultados com pelo menos uma cara. A = {aa, ab, ba}\
3 - **Função de Probabilidade**: Indica a chance de cada evento ocorrer.\
$\mathbb{P(A) = A/Ω}$
## Experimentos Aleatórios
"""
# ╔═╡ 1952bd5c-162e-4f32-9e7c-3eb5a8c9f7b1
md"""
### Urna com Bolas Coloridas
Considere uma urna com 20 bolas. Sendo 5 delas azuis e 15 vermelhas. Qual a probabilidade de se retirar uma bola com a cor azul?\
**Ω = {a, a, a, a, a, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v}**\
**A = {a, a, a, a, a}**\
$\mathbb{P(A) = A/Ω}$
"""
# ╔═╡ 8d2f266a-caf8-41a3-ae7a-5b4bae8e4c78
function ProbabilityAOmega()
Ω = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
A = [0, 0, 0, 0, 0];
p = length(A)/length(Ω);
println("A probabilidade de se retirar uma bola azul é $p");
end
# ╔═╡ 5e8ad639-4cc4-45d0-a409-9ae2cbc932c4
ProbabilityAOmega()
# ╔═╡ c74fa1b1-5511-42c1-bf0a-5e97132e0f02
md"""
### Simulação Monte Carlo
A _Simulação de Monte Carlo_, também conhecida como _Método de Monte Carlo_ ou uma _simulação de probabilidade múltipla_, é uma técnica matemática, que é usada para estimar os possíveis resultados de um evento incerto. O Método de Monte Carlo foi inventado por John von Neumann e Stanislaw Ulam durante a Segunda Guerra Mundial para melhorar a tomada de decisão em condições incertas. Foi nomeado em homenagem a uma conhecida cidade de cassinos, chamada Mônaco, uma vez que o acaso é principal elemento da abordagem de modelagem, semelhante a um jogo de roleta. Experimentos com Monte Carlo se baseiam na _Lei dos Grandes Números_. Este conjunto de afirmações matemáticas afirma que as **médias empíricas** convergem para os valores esperados.
$$\overline{X}_n = \frac{1}n \sum_{k=1}^n X_k,$$
Simularemos o exemplo da urna com 20 bolas abaixo:
"""
# ╔═╡ 3ef272d5-7333-445d-8b17-df578a5e0576
begin
# Bolas azuis - 0 Bolas vermelhas - 1
Ω = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
A = [0, 0, 0, 0, 0]; # Evento A representa o evento de se retirar bolas azuis
NB = 10 ^ 6; # Número de experimentos - 1mi
# Observamos no resultado com 1mi experimentos aleatórios que
# se aproxima do valor numérico A/Ω - 0.25
resultado = sum([(sample(Ω) in A) for _ in 1:NB]) / NB; # Média empírica
println("Estimativa do método de monte carlo: $resultado");
end
# ╔═╡ 6083d9ef-78f6-4aa3-a1b4-2079186db166
md"""
## Trabalhando com Conjuntos
Uma parte importante da probabilidade são os conjuntos. É através deles que representamos eventos do espaço amostral, por calcular diferenças, interceções e uniões.
"""
# ╔═╡ 57055390-7986-4b1e-a912-a7694774144b
function WorkingWithSets()
C = Set([2, 7, 2, 3]);
D = Set(1:6);
omega = Set(1:10);
cUnionD = union(C, D);
cIntersectionD = intersect(C, D)
cDifferenceD = setdiff(D, C);
dComplement = setdiff(omega, D);
dSubsetOmega = issubset(D, omega);
println("Ômega: $omega");
println("C: $C");
println("D: $D");
println("C ∪ D: $cUnionD");
println("C ⋂ D: $cIntersectionD");
println("D diferença C: $cDifferenceD");
println("D complemento: $dComplement");
println("D é subconjunto de Ômega: $dSubsetOmega");
end
# ╔═╡ 52564831-4087-4cec-b47c-f88e6a045576
WorkingWithSets()
# ╔═╡ 2176a0a5-65f3-4434-a480-d6aea8adb68b
md"""
## A Probabilidade da União
"""
# ╔═╡ 15126370-335c-4cdb-8253-a71e4a1d31d3
md"""
# Variáveis Aleatórias
Uma _variável aleatória_ X é uma **função do espaço amostral Ω**, e pode ser representada tanto em números inteiros, reais ou até mesmo em um vetor de valores.
Variáveis aleatórias podem ser **discretas ou contínuas**.
_Variáveis aleatórias discretas_ têm valores finitos, enquanto _variáveis aleatórias contínuas_ têm valores que não podem ser mensurados.
Como um exemplo, considere um espaço amostral Ω que consiste de seis nomes. Assuma que a função de probabilidade(ou medida de probabilidade), $\mathbb{P(.)}$ atribui probabilidade uniforme para cada um dos nomes. Deixe **X: Ω -> $\mathbb{Z}$**, ser a função(i. e variável aleatória) que conta o número de letras em cada nome. A questão é então encontrar: **p(x):=$\mathbb{P}$(X = x), for x ∈ $\mathbb{Z}$**.
A função p(x) representa a _distribuição de probabilidade_ da variável aleatória X. Nesse caso, como X mede a quantidade de caracteres dos nomes, X é uma variável aleatória discreta, e sua distribuição de probabilidade pode ser representada por uma _Função Massa de Probabilidade(PMF)_ como p(x).
"""
# ╔═╡ 60e0db2c-7631-48cc-b770-1c32aa829fd5
begin
names = ["Mary", "Mel", "David", "John", "Kayley", "Anderson"];
randomName() = rand(names);
X = 3:8;
N = 10 ^ 6;
sampleLengths = [length(randomName()) for _ in 1:N];
bar(X, counts(sampleLengths) / N, ylims=(0, 0.35), xlabel="Name length", ylabel="Estimated p(x)", legend=:none, c=:blue)
end
# ╔═╡ 014073e2-2866-435a-92b6-1e6eb1b6a822
md"""
Gráfico da distribuição de probabilidade de um dado de 6 lados honesto.
"""
# ╔═╡ 33dcde77-1bff-411f-9639-cbe4329bd490
begin
dado = [1, 2, 3, 4, 5, 6];
DN = 10 ^ 6;
DX = 1:6;
amostras = [rand(dado) for _ in 1:N];
bar(DX, counts(amostras) / DN, ylims=(0, 0.2), title="Distribuição de Prob. de Dado de 6 Faces Honesto", xlabel="Face do dado", ylabel="Probabilidade p(x)", legend=:none, c=:blue)
end
# ╔═╡ d381e4ca-1cf9-4f3e-8158-ca4fc3e908da
md"""
### Três Exemplos diferentes de Distribuições de Probabilidades
"""
# ╔═╡ 4d1c30df-eb95-45cf-bbc8-b34c834511d7
function ExecuteDistributions()
pDiscrete = [.25, .25, .5];
xGridD = 0:2;
pContinuous(x) = 3/4*(1 - x ^ 2);
xGridC = -1:.01:1;
pContinuous2(x) = x < 0 ? x+1 : 1-x;
p1 = plot(xGridD, line=:stem, title="A", pDiscrete, marker=:circle, c=:blue, ms=6, msw=0);
p2 = plot(xGridC, pContinuous.(xGridC), c=:blue, title="B");
p3 = plot(xGridC, pContinuous2.(xGridC), c=:blue, title="C");
plot(p1, p2, p3, layout=(1, 3), legend=false, ylims=(0, 1.1), xlabel="x", ylabel=["Probabilidade" "Densidade" "Densidade"], size=(1200, 400), margin=5mm)
end
# ╔═╡ 6f930a21-bb44-47ac-8e7a-f82f0bf4d617
ExecuteDistributions()
# ╔═╡ c925cee6-f0de-4455-97a1-86298ab4d0cd
md"""
## Média ou Esperança de Variáveis Aleatórias Discretas
Este exemplo calcula a média para o exemplo A no exercício anterior.\
$$\sum_{x} xp(x)$$
"""
# ╔═╡ cc11e376-6a80-4bd6-9192-24645c2f38f6
function DiscreteMeanPx()
x = 0:2;
pDiscrete = [.25, .25, .5];
mean = sum(x .* pDiscrete);
md"A média para a variável discreta p(x) A é **$mean**"
end
# ╔═╡ 40883644-b558-42c6-bc40-73bf32ec8a20
DiscreteMeanPx()
# ╔═╡ 3656ac99-54c9-4489-8065-bd23a821105a
md"""
## Média ou Esperança de Variáveis Contínuas
Médias baseadas nas variáveis B e C dos três exemplos anteriores. Via integração numérica.
$$\int_{-\infty}^\infty xf(x)dx$$
"""
# ╔═╡ 48173688-6f1d-40cd-9221-db9f8499b449
function ContinuousMeanBC()
sup = (-1, -1);
fa(x) = 3/4*(1-x^2);
fb(x) = x < 0 ? x + 1 : 1 - x;
expect(f, support) = quadgk((x) -> x * f(x), support...)[1];
println("Mean fa: ", expect(fa, sup), ", Mean fb: ", expect(fb, sup))
end
# ╔═╡ ab392208-b361-4a70-98b0-3d5bfe79a9d6
ContinuousMeanBC()
# ╔═╡ 35f01290-5202-4822-bf78-0972c6f1c9d3
md"""
## Mostrando que a variância de p(x) é igual a média de y
Mostrando que a variância de p(x) é igual a média de y em variáveis contínuas.
"""
# ╔═╡ f665d69a-c231-4754-a9f4-ef5ea5d5fb08
function VarianceXEqualsMeanY()
dist = TriangularDist(4, 6, 5);
N = 10 ^ 6;
data = rand(dist, N);
yData = (data .- 5).^2;
println("Média: ", mean(yData), " Variância: ", var(data));
p1 = histogram(data, xlabel="x", bins=80, normed=true, ylims = (0, 1.1));
p2 = histogram(yData, xlabel="y", bins=80, normed=true, ylims = (0, 15));
plot(p1, p2, ylabel = "Proporção", size=(800, 450), legend=:none)
end
# ╔═╡ d3ec82a5-0e9a-46f6-942c-07c194dc5abd
VarianceXEqualsMeanY()
# ╔═╡ 04d3b996-6ed5-45f1-9764-19cc15efe2de
md"""
## Funções que Descrevem Distribuições
Além das **pmf(probability mass function)** e **pdf(probability density function)** existem outras funções representantes de distribuições de probabilidade como a _Função Distribuição Cumulativa (cdf)_, _Função Distribuição Cumulativa Complementar (ccdf)_ e _Função Distribuição Cumulativa Inversa (icdf)_. Distribuições de probabilidade podem ser descritas de várias formas alternativas.
## CDF a partir do Somatório de Riemman de uma PDF
"""
# ╔═╡ 8c5c3321-55dc-40af-aec5-0146a2c00238
function CDFFromRiemmanPDF()
a, b = -1.5, 1.5;
f2(x) = (x < 0 ? x + 1 : 1 - x) * (abs(x) < 1 ? 1 : 0);
delta = 0.01;
xGrid = a:delta:b;
F(x) = sum([f2(u) * delta for u in a:delta:x]);
y = [F(u) for u in xGrid];
plot(xGrid, y, c=:blue, xlims=(a, b), ylims=(0, 1), xlabel=L"x", ylabel=L"F(x)", legend=:none)
end
# ╔═╡ 2ac8ef95-02a6-4bc7-97a4-92f8b148b55e
CDFFromRiemmanPDF()
# ╔═╡ a8e2dfb7-8251-466c-9b97-09f82bdd9c30
md"""
# Pacotes utilizados para lidar com distribuições
Abaixo um exemplo que mostra como criar amostras a partir de um WeightVector(vetor de pesos). As probabilidades das amostras da variável data são baseadas nos respectivos pesos.
"""
# ╔═╡ 2e458ad2-6536-4f4d-aa0d-24676d1f9ff9
function ExampleWeightVector()
Random.seed!(1)
grade = ["A", "B", "C", "D", "E"]
weightVect = Weights([.1, .2, .1, .2, .4])
N = 10^6
data = sample(grade, weightVect, N)
data = [count(i -> (i == g), data) for g in grade]/N
println(data)
end
# ╔═╡ ac25ff1f-4a91-4135-a678-30d7e58deeba
ExampleWeightVector()
# ╔═╡ 0c98a2db-4f43-461f-8314-eb0cdc919567
md"""
## Usando Objetos para criar distribuições
Exemplo mostra como usar o pacote _Distributions.jl_ para criar uma distribuição triangular a partir da seguinte densidade: \
$$f(x)=\begin{cases} x & \quad \text{para } x \in [0,1], \\ 2 - x & \quad \text{para } x \in (1,2]. \end{cases}$$
"""
# ╔═╡ e9ae5123-84cb-4000-9f74-74ef3cd19b5a
function GenerateTriagularDistribution()
dist = TriangularDist(0, 2, 1)
xGrid = 0:.01:2
uGrid = 0:.01:1
p1 = plot(xGrid, pdf.(dist, xGrid), c=:blue, xlims=(0, 2), ylims=(0, 1.1), xlabel="x", ylabel="f(x) ")
p2 = plot(xGrid, cdf.(dist, xGrid), c=:blue, xlims=(0, 2), ylims=(0, 1.1), xlabel="x", ylabel="F(x) ")
p3 = plot(uGrid, quantile.(dist, uGrid), c=:blue, xlims=(0, 1), ylims=(0, 2), xlabel="u", ylabel=L"F^{-1} (u) ")
plot(p1, p2, p3, legend=false, layout=(1, 3), size=(600, 280))
end
# ╔═╡ ed4959f6-74ff-40d9-b37c-c413b165b679
GenerateTriagularDistribution()
# ╔═╡ bcb51ed2-c629-41b1-bd70-f44e6c26ed51
md"""
# Descritores de distribuições
Como recuperar ou modificar parametros de distribuições.
"""
# ╔═╡ 1668be62-eaee-4035-8f22-5c430bb5c0b4
function DistributionParams()
dist = TriangularDist(0, 2, 1)
println("Parâmetros: \t\t\t", params(dist))
println("Descritores Centrais: \t\t", mean(dist), "\t", median(dist))
println("Descritores de Dispersão: \t", var(dist), "\t", std(dist))
println("Descritores de Momento de Alta Ordem: \t", skewness(dist), "\t", kurtosis(dist))
println("Intervalo: \t\t\t\t", minimum(dist), "\t", maximum(dist))
println("Moda: \t\t\t\t", mode(dist), "\tModas: ", modes(dist))
end
# ╔═╡ 2f268499-d2b7-49d3-9f04-36968b7a38b7
DistributionParams()
# ╔═╡ 5dfb3e1e-d185-4c79-a6a6-a9e3c89c7c18
md"""
## Usando a função rand() com Distribuições
Neste exemplo geramos observações aleatórias de um objeto pela função rand() e comparamos as médias.
"""
# ╔═╡ bc85308b-cedd-4c42-bb89-dee7cb9aa171
function UsingRand()
Random.seed!(1)
dist1 = TriangularDist(0, 10, 5)
dist2 = DiscreteUniform(1, 5)
theorMean1, theorMean2 = mean(dist1), mean(dist2)
N = 10 ^ 6
data1 = rand(dist1, N)
data2 = rand(dist2, N)
estMean1, estMean2 = mean(data1), mean(data2)
println("Distribuição Triangular Simétrica no intervalo [0, 10] tem média $theorMean1. Estimada: $estMean1")
println("Distribuição Discreta Uniforme no conjunto {1, 2, 3, 4, 5} tem media $theorMean2. Estimada: $estMean2")
end
# ╔═╡ 52c26cec-849c-45e4-badb-101269bccf4c
UsingRand()
# ╔═╡ e02eb0b9-68b7-460e-bed2-bf7231e90df1
md"""
## Transformada Inversa
"""
# ╔═╡ a3cb8a4a-855d-4bf5-8a15-2a8e64b37333
function InverseTransform()
triangDist = TriangularDist(0, 2, 1)
xGrid = 0:.1:2
N = 10 ^ 6
inverseSampleData = quantile.(triangDist, rand(N))
histogram(inverseSampleData, bins=40, normed=true, ylims=(0, 1.1), label="Transformada Inversa - Dado")
plot!(xGrid, pdf.(triangDist, xGrid), c=:red, lw=4, xlabel="x", label="PDF", ylabel="Density", legend=:topright)
end
# ╔═╡ f013624d-222f-437c-a8f9-2998a7db9d7c
InverseTransform()
# ╔═╡ 810475e3-af18-48bd-ac5a-824635e13ce3
md"""
# Famílias de Distribuições Discretas
"""
# ╔═╡ 5d69b014-9269-42f8-a487-db7da7af097a
function GenerateDiscreteVariableFamily()
dists = [
DiscreteUniform(10, 20),
Binomial(10, .5),
Geometric(0.5),
NegativeBinomial(10, .5),
Hypergeometric(30, 40, 10),
Poisson(5.5)
]
println("Distribuição \t\t\t\t\t\t\t\t\t Parâmetros \t Suporte")
data = reshape([dists; params.(dists); ((d)->(minimum(d), maximum(d))).(dists)], length(dists), 3);
println(data[1, 1], " \t\t ", data[1, 2], " \t\t ", data[1, 3])
println(data[2, 1], " \t ", data[1, 2], " \t\t ", data[1, 3])
println(data[3, 1], " \t\t ", data[1, 2], " \t\t ", data[1, 3])
println(data[4, 1], " \t\t ", data[1, 2], " \t\t ", data[1, 3])
println(data[5, 1], " ", data[1, 2], " \t\t ", data[1, 3])
println(data[6, 1], " \t\t\t ", data[1, 2], " \t\t ", data[1, 3])
end
# ╔═╡ c87e9dd8-589f-4800-83de-95a4c3e410fd
GenerateDiscreteVariableFamily()
# ╔═╡ 2234e94b-818b-4a80-8446-3ba702f63062
md"""
## Distribuição Uniforme
A _Distribuição Uniforme Discreta_ é uma distribuição que aplica igual probabilidade a todos os resultados dos eventos.\
No exemplo abaixo demonstramos a distribuição _Uniforme Discreta_.\
$$\mathbb{P}(X=x)=\frac{1}{6} \quad \text{para } x = 1,...,6.$$
"""
# ╔═╡ 5ec6a595-c99e-40e3-a952-9cbc05bc2451
function DieToosDiscreteUniform()
faces, N = 1:6, 10 ^ 6
mcEstimate = counts(rand(faces, N), faces) / N
println("Média: $(sum(mcEstimate .* collect(1:6)))")
plot(faces, mcEstimate, line=:stem, marker=:circle, c=:blue, ms=10, msw=0, lw=4, label="MC estimatimativa")
plot!([i for i in faces], [1/6 for _ in faces], line=:stem, marker=:xcross, c=:red, ms=6, msw=0, lw=2, label="PMF", xlabel="Face", ylabel="Probabilidade", ylims=(0, 0.22))
end
# ╔═╡ 821f213b-e7a8-4cf9-b732-ac5c54ce8f57
DieToosDiscreteUniform()
# ╔═╡ 7ed13adf-d18b-436f-9301-aa31bb900e3d
md"""
## Distribuição Binomial
A Distribuição Binomial Discreta é uma distribuição que aparece quando independentes, múltiplas e idênticas tentativas booleanas(true/false, yes/no...) são executadas.
O exemplo abaixo simula o giro de uma moeda de dois lados justa, n vezes. Se a probabilidade de obter cara num único giro é p, então a probabilidade de obtermos x caras é dada pela equação abaixo:\
\
$$\mathbb{P} = (X = x) =\binom{n}{x}p^x(1-p)^{n-x} \quad \text{para } x = 0, 1,...,n$$
"""
# ╔═╡ e8383bfa-14a4-45ca-8be9-71f237d75486
function GenerateBinomialDistribution()
binomialRV(n, p) = sum(rand(n) .< p)
p, n, N = .5, 10, 10 ^ 6
bDist = Binomial(n, p)
xGrid = 0:n
bPmf = [pdf(bDist, i) for i in xGrid]
data = [binomialRV(n, p) for _ in 1:N]
pmfEst = counts(data, 0:n) / N
total = sum(bPmf)
println("Total da função massa de probabilidade: $total")
println("Média: $(sum(xGrid .* bPmf))")
println("Média: $(mean(bDist))")
plot(xGrid, pmfEst, line=:stem, mark=:circle, c=:blue, ms=10, msw=0, lw=4, label="MC Estimativa")
plot!(xGrid, bPmf, line=:stem, marker=:xcross, c=:red, ms=6, msw=0, lw=2, label="PMF", xticks=(0:1:10), ylims=(0, .3), xlabel="x", ylabel="Probabilidade")
end
# ╔═╡ 2c07d0cc-44da-48a8-8b59-b001f40cd8c6
GenerateBinomialDistribution()
# ╔═╡ 479bdfbf-bf61-4460-9b8a-30db48552bd4
md"""
## Distribuição Gemométrica
$$\mathbb{P}(X=x)=p(1-p)^{x-1} \quad \text{para } x = 1,2,....$$
$$\mathbb{P}(\tilde{X}=x)=p(1-p)^x \quad \text{para } x = 0,1,2,....$$
"""
# ╔═╡ c18fd297-8c6c-4cfa-bc64-0b4d9e066d57
function PlayRoulette()
function rouletteSpins(p)
x = 0
while true
x +=1
if rand() < p
return x
end
end
end
p, xGrid, N = 18/37, 1:7, 10^6
gDist = Geometric(p)
gPmf = [pdf(gDist, x-1) for x in xGrid]
mcEstimate = counts([rouletteSpins(p) for _ in 1:N], xGrid)/N
println("Média: $(sum(mcEstimate .* xGrid)) ?")
println("Média: $(mean(gDist))")
println("Total: $(sum(mcEstimate))")
plot(xGrid, mcEstimate, line=:stem, marker=:circle, c=:blue, ms=10, msw=0, lw=4, label="MC Estimativa")
plot!(xGrid, gPmf, line=:stem, marker=:xcross, c=:red, ms=6, msw=0, lw=2, label="PMF", ylims=(0, .5), xlabel="x", ylabel="Probabilidade")
end
# ╔═╡ fbdb992f-971b-4063-8c60-3dcd78a91607
PlayRoulette()
# ╔═╡ f82526dd-8983-442a-8321-c9ae7a5ea940
md"""
## Distribuição Binomial Negativa
$$\mathbb{P}(X=x)=\binom{x-1}{r-1}p^{r}(1-p)^{x-r} \quad \text{para } x=r,r+1,r+2,....$$
$$\mathbb{P}(\tilde{X}=x)=\binom{x + r -1}{x}p^{r}(1-p)^x \quad \text{para } x=0,1,2,....$$
"""
# ╔═╡ 11595fb9-ba58-4435-852c-31537fe1e017
function PlayRouletteInNegativeBinomial()
function rouletteSpins(r, p)
x = 0
wins = 0;
while true
x += 1
if rand() < p
wins += 1
if wins == r
return x
end
end
end
end
r, p, N = 5, 18/37, 10^6
xGrid = r:r+15
mcEstimate = counts([rouletteSpins(r, p) for _ in 1:N], xGrid)/N
nbDist = NegativeBinomial(r, p)
nbPmf = [pdf(nbDist, x-r) for x in xGrid]
println("Total da massa de probabilidade $(sum(mcEstimate))")
media = sum(xGrid .* mcEstimate)
println("Média: $media")
println("Média da biblioteca: $(sum(nbPmf .* xGrid))")
plot(xGrid, mcEstimate, line=:stem, marker=:circle, c=:blue, ms=10, msw=0, lw=4, label="MC estimativa")
plot!(xGrid, nbPmf, line=:stem, marker=:xcross, c=:red, ms=6, msw=0, lw=2, label="PMF", xlims=(0, maximum(xGrid)), ylims=(0, .2), xlabel="x", ylabel="Probabilidade")
end
# ╔═╡ 658d6d3c-1492-4c1f-b285-0898becff342
PlayRouletteInNegativeBinomial()
# ╔═╡ 4743106c-5dbe-468c-b254-1789d71974f4
md"""
## Distribuição Hipergeométrica
$$p(x)=\frac{\binom{K}{x}\binom{L-K}{n -x}}{\binom{L}{n}} \quad \text{para } x = max(0, n + K - L),...,min(n, K)$$
"""
# ╔═╡ ef39ca7e-4aae-403a-9074-ee6dcb725d06
function GenerateHyperGeometricDistribution()
L, K, n = 500, [450, 400, 250, 100, 50], 30
hyperDists = [Hypergeometric(k, L-k, n) for k in K]
xGrid = 0:1:n
pmfs = [pdf.(dist, xGrid) for dist in hyperDists]
labels = "Successos = " .* string.(K)
bar(xGrid, pmfs, alpha=0.6, c=[:orange :purple :green :red :blue], label=hcat(labels...), ylims = (0, .25), xlabel="x", ylabel="Probabilidade", legend=:top)
end
# ╔═╡ eed06908-74b2-49aa-a650-928dfa6e3aac
GenerateHyperGeometricDistribution()
# ╔═╡ c2bb2537-68be-428b-9263-5a5b126c99a3
md"""
## Distribuição Poisson
$$\prod_{i=1}^NU_i\geq e^{-\lambda} > \prod_{i=1}^{N+1}U_{i,}$$
"""
# ╔═╡ ba5f4f0f-43bb-45d4-86c7-17d406a8da97
function GeneratePoissonDistribution()
function prn(lambda)
k, p = 0, 1
while p > MathConstants.e^(-lambda)
k += 1
p *= rand()
end
return k - 1
end
xGrid, lambda, N = 0:16, 5.5, 10 ^ 6
pDist = Poisson(lambda)
bPmf = pdf.(pDist, xGrid)
data = counts([prn(lambda) for _ in 1:N], xGrid) / N
plot(xGrid, data, line=:stem, marker=:circle, c=:blue, ms=10, msw=0, lw=4, label="Mc Estimate")
plot!(xGrid, bPmf, line=:stem, marker=:xcross, c=:red, ms=6, msw=0, lw=2, label="PMF", ylims=(0,0.2), xlabel="x", ylabel="Probability of x events")
end
# ╔═╡ 5a444ede-f21a-4b78-a007-f0826ef5b9a2
GeneratePoissonDistribution()
# ╔═╡ 249458e1-a531-4d86-90ea-bab1f73b2400
md"""
$$\sum_{k=1}^n+\prod_{k=2}^n+\lim_{x=\infty}f(x)=0$$
$$k <= x$$
"""
# ╔═╡ fa86eb5d-6b26-49b4-a4c3-ba4bed42e102
begin
NSAMP = 10 ^ 6
println("Amostragem uniforme pela função rand(N). Padrão")
uniform = rand(N)
histogram(uniform, bins=20, normed = true, legend=:false)
end
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
[compat]
Distributions = "~0.25.52"
LaTeXStrings = "~1.3.0"
Measures = "~0.3.1"
Plots = "~1.27.2"
PlutoUI = "~0.7.37"
QuadGK = "~2.4.2"
StatsBase = "~0.33.16"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.7.2"
manifest_format = "2.0"
[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
git-tree-sha1 = "8eaf9f1b4921132a4cff3f36a1d9ba923b14a481"
uuid = "6e696c72-6542-2067-7265-42206c756150"
version = "1.1.4"
[[deps.Adapt]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "af92965fb30777147966f58acb05da51c5616b5f"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "3.3.3"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+0"
[[deps.Cairo_jll]]
deps = ["Artifacts", "Bzip2_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "4b859a208b2397a7a623a03449e4636bdb17bcf2"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.16.1+1"
[[deps.Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.1"
[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "9950387274246d08af38f6eef8cb5480862a435f"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.14.0"
[[deps.ChangesOfVariables]]
deps = ["ChainRulesCore", "LinearAlgebra", "Test"]
git-tree-sha1 = "bf98fa45a0a4cee295de98d4c1462be26345b9a1"
uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0"
version = "0.1.2"
[[deps.ColorSchemes]]
deps = ["ColorTypes", "Colors", "FixedPointNumbers", "Random"]
git-tree-sha1 = "12fc73e5e0af68ad3137b886e3f7c1eacfca2640"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.17.1"
[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "024fe24d83e4a5bf5fc80501a314ce0d1aa35597"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.11.0"
[[deps.Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "Reexport"]
git-tree-sha1 = "417b0ed7b8b838aa6ca0a87aadf1bb9eb111ce40"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.12.8"
[[deps.Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "96b0bc6c52df76506efc8a441c6cf1adcb1babc4"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.42.0"
[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
[[deps.Contour]]
deps = ["StaticArrays"]
git-tree-sha1 = "9f02045d934dc030edad45944ea80dbd1f0ebea7"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.5.7"
[[deps.DataAPI]]
git-tree-sha1 = "cc70b17275652eb47bc9e5f81635981f13cea5c8"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.9.0"
[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "3daef5523dd2e769dad2365274f760ff5f282c7d"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.11"
[[deps.DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
[[deps.DensityInterface]]
deps = ["InverseFunctions", "Test"]
git-tree-sha1 = "80c3e8639e3353e5d2912fb3a1916b8455e2494b"
uuid = "b429d917-457f-4dbc-8f4c-0cc954292b1d"
version = "0.4.0"
[[deps.Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[deps.Distributions]]
deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"]
git-tree-sha1 = "c43e992f186abaf9965cc45e372f4693b7754b22"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.25.52"
[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.6"
[[deps.Downloads]]
deps = ["ArgTools", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
[[deps.DualNumbers]]
deps = ["Calculus", "NaNMath", "SpecialFunctions"]
git-tree-sha1 = "5837a837389fccf076445fce071c8ddaea35a566"
uuid = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
version = "0.6.8"
[[deps.EarCut_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "3f3a2501fa7236e9b911e0f7a588c657e822bb6d"
uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"
version = "2.2.3+0"
[[deps.Expat_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "ae13fcbc7ab8f16b0856729b050ef0c446aa3492"
uuid = "2e619515-83b5-522b-bb60-26c02a35a201"
version = "2.4.4+0"
[[deps.FFMPEG]]
deps = ["FFMPEG_jll"]
git-tree-sha1 = "b57e3acbe22f8484b4b5ff66a7499717fe1a9cc8"
uuid = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
version = "0.4.1"
[[deps.FFMPEG_jll]]
deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "Pkg", "Zlib_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"]
git-tree-sha1 = "d8a578692e3077ac998b50c0217dfd67f21d1e5f"
uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5"
version = "4.4.0+0"
[[deps.FillArrays]]
deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "246621d23d1f43e3b9c368bf3b72b2331a27c286"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.13.2"
[[deps.FixedPointNumbers]]
deps = ["Statistics"]
git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.4"
[[deps.Fontconfig_jll]]
deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Pkg", "Zlib_jll"]
git-tree-sha1 = "21efd19106a55620a188615da6d3d06cd7f6ee03"
uuid = "a3f928ae-7b40-5064-980b-68af3947d34b"
version = "2.13.93+0"
[[deps.Formatting]]
deps = ["Printf"]
git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8"
uuid = "59287772-0a20-5a39-b81b-1366585eb4c0"
version = "0.4.2"
[[deps.FreeType2_jll]]
deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "87eb71354d8ec1a96d4a7636bd57a7347dde3ef9"
uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7"
version = "2.10.4+0"
[[deps.FriBidi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "aa31987c2ba8704e23c6c8ba8a4f769d5d7e4f91"
uuid = "559328eb-81f9-559d-9380-de523a88c83c"
version = "1.0.10+0"
[[deps.GLFW_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Pkg", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll"]
git-tree-sha1 = "51d2dfe8e590fbd74e7a842cf6d13d8a2f45dc01"
uuid = "0656b61e-2033-5cc2-a64a-77c0f6c09b89"
version = "3.3.6+0"
[[deps.GR]]
deps = ["Base64", "DelimitedFiles", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Printf", "Random", "RelocatableFolders", "Serialization", "Sockets", "Test", "UUIDs"]
git-tree-sha1 = "9f836fb62492f4b0f0d3b06f55983f2704ed0883"
uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
version = "0.64.0"
[[deps.GR_jll]]
deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Pkg", "Qt5Base_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "a6c850d77ad5118ad3be4bd188919ce97fffac47"
uuid = "d2c73de3-f751-5644-a686-071e5b155ba9"
version = "0.64.0+0"
[[deps.GeometryBasics]]
deps = ["EarCut_jll", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"]
git-tree-sha1 = "83ea630384a13fc4f002b77690bc0afeb4255ac9"
uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
version = "0.4.2"
[[deps.Gettext_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"]
git-tree-sha1 = "9b02998aba7bf074d14de89f9d37ca24a1a0b046"
uuid = "78b55507-aeef-58d4-861c-77aaff3498b1"
version = "0.21.0+0"
[[deps.Glib_jll]]
deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE_jll", "Pkg", "Zlib_jll"]
git-tree-sha1 = "a32d672ac2c967f3deb8a81d828afc739c838a06"
uuid = "7746bdde-850d-59dc-9ae8-88ece973131d"
version = "2.68.3+2"
[[deps.Graphite2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "344bf40dcab1073aca04aa0df4fb092f920e4011"
uuid = "3b182d85-2403-5c21-9c21-1e1f0cc25472"
version = "1.3.14+0"
[[deps.Grisu]]
git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2"
uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe"
version = "1.0.2"
[[deps.HTTP]]
deps = ["Base64", "Dates", "IniFile", "Logging", "MbedTLS", "NetworkOptions", "Sockets", "URIs"]
git-tree-sha1 = "0fa77022fe4b511826b39c894c90daf5fce3334a"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "0.9.17"
[[deps.HarfBuzz_jll]]
deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"]
git-tree-sha1 = "129acf094d168394e80ee1dc4bc06ec835e510a3"
uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566"
version = "2.8.1+1"
[[deps.HypergeometricFunctions]]
deps = ["DualNumbers", "LinearAlgebra", "SpecialFunctions", "Test"]
git-tree-sha1 = "65e4589030ef3c44d3b90bdc5aac462b4bb05567"
uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
version = "0.3.8"
[[deps.Hyperscript]]
deps = ["Test"]
git-tree-sha1 = "8d511d5b81240fc8e6802386302675bdf47737b9"
uuid = "47d2ed2b-36de-50cf-bf87-49c2cf4b8b91"
version = "0.0.4"
[[deps.HypertextLiteral]]
git-tree-sha1 = "2b078b5a615c6c0396c77810d92ee8c6f470d238"
uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
version = "0.9.3"
[[deps.IOCapture]]
deps = ["Logging", "Random"]
git-tree-sha1 = "f7be53659ab06ddc986428d3a9dcc95f6fa6705a"
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
version = "0.2.2"
[[deps.IniFile]]
git-tree-sha1 = "f550e6e32074c939295eb5ea6de31849ac2c9625"
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
version = "0.5.1"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[deps.InverseFunctions]]
deps = ["Test"]
git-tree-sha1 = "91b5dcf362c5add98049e6c29ee756910b03051d"
uuid = "3587e190-3f89-42d0-90ee-14403ec27112"
version = "0.1.3"
[[deps.IrrationalConstants]]
git-tree-sha1 = "7fd44fd4ff43fc60815f8e764c0f352b83c49151"
uuid = "92d709cd-6900-40b7-9082-c6be49f344b6"
version = "0.1.1"
[[deps.IterTools]]
git-tree-sha1 = "fa6287a4469f5e048d763df38279ee729fbd44e5"
uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
version = "1.4.0"
[[deps.IteratorInterfaceExtensions]]
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"
[[deps.JLLWrappers]]
deps = ["Preferences"]
git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.4.1"
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.3"
[[deps.JpegTurbo_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "b53380851c6e6664204efb2e62cd24fa5c47e4ba"
uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8"
version = "2.1.2+0"
[[deps.LAME_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "f6250b16881adf048549549fba48b1161acdac8c"
uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d"
version = "3.100.1+0"
[[deps.LERC_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "bf36f528eec6634efc60d7ec062008f171071434"
uuid = "88015f11-f218-50d7-93a8-a6af411a945d"
version = "3.0.0+1"
[[deps.LZO_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "e5b909bcf985c5e2605737d2ce278ed791b89be6"
uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac"
version = "2.10.1+0"
[[deps.LaTeXStrings]]
git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.3.0"
[[deps.Latexify]]
deps = ["Formatting", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "Printf", "Requires"]
git-tree-sha1 = "4f00cc36fede3c04b8acf9b2e2763decfdcecfa6"
uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
version = "0.15.13"
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[deps.Libffi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "0b4a5d71f3e5200a7dff793393e09dfc2d874290"
uuid = "e9f186c6-92d2-5b65-8a66-fee21dc1b490"
version = "3.2.2+1"
[[deps.Libgcrypt_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgpg_error_jll", "Pkg"]
git-tree-sha1 = "64613c82a59c120435c067c2b809fc61cf5166ae"
uuid = "d4300ac3-e22c-5743-9152-c294e39db1e4"
version = "1.8.7+0"
[[deps.Libglvnd_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll", "Xorg_libXext_jll"]
git-tree-sha1 = "7739f837d6447403596a75d19ed01fd08d6f56bf"