Platform
Resources
Pricing
Sign in
Get started
Sami Safadi
Workspace
Fork
Public
By
Sami Safadi
Edited
Dec 26, 2021
1 fork
Insert cell
Insert cell
viewof
x
=
Inputs
.
number
(
{
value
:
4
,
label
:
"Enter the number:"
}
)
Insert cell
jazr
(
x
)
Insert cell
function
averageDamp
(
f
)
{
let
average
=
(
q
,
w
)
=>
(
q
+
w
)
/
2
;
return
x
=>
average
(
x
,
f
(
x
)
)
;
}
Insert cell
function
fixedPoint
(
f
,
current
)
{
let
threshold
=
current
/
1e6
;
let
next
=
f
(
current
)
;
if
(
Math
.
abs
(
next
-
current
)
<
threshold
)
return
current
;
else
return
fixedPoint
(
f
,
next
)
;
}
Insert cell
function
jazr
(
x
)
{
if
(
x
==
0.0
)
return
0.0
else
return
fixedPoint
(
averageDamp
(
y
=>
x
/
y
)
,
1.0
)
;
}
Insert cell
Insert cell
range
=
[
...
Array
(
11
)
.
keys
(
)
]
;
Insert cell
a1
=
range
.
map
(
jazr
)
Insert cell
a2
=
range
.
map
(
Math
.
sqrt
)
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
x
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
averageDamp
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fixedPoint
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
jazr
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
range
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
a1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
a2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML