Platform
Resources
Pricing
Sign in
Get started
David
I'm a Mechanical Engineer. I do Mechanical Design, Simulation, 3D Printing, Teaching and numerical programming in GNU Octave, Python and JavaScript.
Workspace
Fork
Public
By
David
Edited
Feb 12, 2024
Insert cell
Insert cell
viewof
mathInput
=
Inputs
.
textarea
(
{
label
:
"Mathjs Input"
,
spellcheck
:
false
,
value
:
"2+2\n2 m + 10 mm"
}
)
Insert cell
showResults
(
evalResults
)
Insert cell
showResults
=
math
.
typed
(
{
"ResultSet"
:
x
=>
htl
.
html
`${
math
.
typed
.
referToSelf
(
f
=>
(
x
=>
x
.
entries
.
join
(
)
)
)
}`
,
"Unit"
:
x
=>
tex
`${
math
.
parse
(
x
.
toString
(
)
)
.
toTex
(
)
}`
,
"any"
:
x
=>
x
}
)
Insert cell
function
resultToText
(
expr
)
{
return
tex
`${
math
.
parse
(
expr
)
.
toTex
(
)
}`
}
Insert cell
evalResults
=
math
.
evaluate
(
mathInput
)
Insert cell
math
=
require
(
"mathjs@12"
)
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
mathInput
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
showResults
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
resultToText
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
evalResults
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
math
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML