Platform
Resources
Pricing
Sign in
Get started
Vinícius Mello
Workspace
Fork
Public
By
Vinícius Mello
Edited
Feb 8, 2023
Paused
2 stars
21
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function
pdf
(
counts
)
{
let
sum
=
counts
.
reduce
(
(
s
,
a
)
=>
s
+
a
,
0
)
;
sum
=
sum
==
0
?
1
:
sum
;
return
counts
.
map
(
(
a
)
=>
a
/
sum
)
;
}
Insert cell
function
cdf
(
counts
)
{
let
sum
=
0
;
let
a
=
counts
.
map
(
(
x
)
=>
(
sum
+=
x
)
)
;
sum
=
sum
==
0
?
1
:
sum
;
return
a
.
map
(
(
x
)
=>
x
/
sum
)
;
}
Insert cell
function
Shannon
(
counts
)
{
let
p
=
pdf
(
counts
)
;
return
-
p
.
reduce
(
(
s
,
x
)
=>
s
+
(
x
==
0
?
0
:
x
*
Math
.
log
(
x
)
)
,
0
)
;
}
Insert cell
function
Tsallis
(
counts
,
q
)
{
let
p
=
pdf
(
counts
)
;
let
s
=
p
.
reduce
(
(
s
,
x
)
=>
s
+
x
**
q
,
0
)
;
return
s
==
0
?
0
:
(
1
-
s
)
/
(
q
-
1
)
;
}
Insert cell
function
Masi
(
counts
,
r
)
{
let
h
=
Shannon
(
counts
)
;
return
1
+
(
1
-
r
)
*
h
>
0
?
Math
.
log
(
1
+
(
1
-
r
)
*
h
)
/
(
1
-
r
)
:
0
;
// : Math.log(-1 - (1 - r) * h) / (1 - r);
//return Log(1 + (1 - r) * h) / (1 - r);
}
Insert cell
function
Hill
(
counts
,
q
)
{
let
p
=
pdf
(
counts
)
;
let
s
=
p
.
reduce
(
(
s
,
x
)
=>
s
+
x
**
q
,
0
)
;
return
s
**
(
1
/
(
1
-
q
)
)
;
}
Insert cell
function
Sine
(
counts
,
q
)
{
const
sin
=
Math
.
sin
;
const
PI
=
Math
.
PI
;
let
p
=
pdf
(
counts
)
;
let
s
=
p
.
reduce
(
(
s
,
x
)
=>
s
+
sin
(
PI
*
x
)
,
0
)
;
return
s
;
}
Insert cell
function
Normal
(
mu
,
sigma
,
x
)
{
return
(
(
1
/
(
sigma
*
Math
.
sqrt
(
2
*
Math
.
PI
)
)
)
*
Math
.
exp
(
-
0.5
*
(
(
x
-
mu
)
/
sigma
)
**
2
)
)
;
}
Insert cell
function
Cauchy
(
x0
,
gamma
,
x
)
{
return
gamma
/
Math
.
PI
/
(
(
x
-
x0
)
**
2
+
gamma
**
2
)
;
}
Insert cell
arr
=
{
const
n
=
256
;
return
new
Uint8ClampedArray
(
n
*
n
*
4
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
entropyA
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
entropyB
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
operator
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
histogramName
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
q
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
r
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
image
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topt
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
regl
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mu1
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mu2
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sigma1
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
sigma2
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
histogram
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
output
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
maxOutput
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
imageData
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
syntheticImage
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getPixel
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
setPixel
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getHistogram
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
pdf
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
cdf
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Shannon
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Tsallis
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Masi
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Hill
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Sine
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Normal
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Cauchy
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
arr
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
reglWrap
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
draw
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
lut
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML