more chapters adapted to julia engine

This commit is contained in:
2024-05-13 00:38:46 +02:00
parent cc79833992
commit c024532262
17 changed files with 170 additions and 44 deletions

View File

@@ -2,38 +2,18 @@
engine: julia
---
# Ein Beispiel zur Stabilität von Gleitkommaarithmetik
```julia
```{julia}
#| error: false
#| echo: false
#| output: false
using PlotlyJS, Random
using HypertextLiteral
using JSON, UUIDs
using Base64
## see https://github.com/JuliaPlots/PlotlyJS.jl/blob/master/src/PlotlyJS.jl
## https://discourse.julialang.org/t/encode-a-plot-to-base64/27765/3
function Base.show(io::IO, mimetype::MIME"text/html", p::PlotlyJS.SyncPlot)
uuid = string(UUIDs.uuid4())
show(io,mimetype,@htl("""
<div style="height: auto" id=\"$(uuid)\"></div>
<script>
require(['../js/plotly-latest.min.js'], function(plotly) {
plotly.newPlot($(uuid),
$(HypertextLiteral.JavaScript(json(p.plot.data))),
$(HypertextLiteral.JavaScript(json(p.plot.layout))),{responsive: true});
});
</script>
"""))
end
using InteractiveUtils
```
# Ein Beispiel zur Stabilität von Gleitkommaarithmetik
## Berechnung von $\pi$ nach Archimedes
Eine untere Schranke für $2\pi$, den Umfang des Einheitskreises, erhält man durch die