more chapters adapted to julia engine

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

View File

@ -42,27 +42,23 @@ book:
chapters: chapters:
- index.qmd - index.qmd
- chapters/entwicklungsumgebungen.qmd - chapters/entwicklungsumgebungen.qmd
# - chapters/first_contact.qmd - chapters/first_contact.qmd
# - chapters/Erste_Bsp.qmd - chapters/Erste_Bsp.qmd
- chapters/syntax.qmd - chapters/syntax.qmd
- chapters/5_TricksHelp.qmd - chapters/5_TricksHelp.qmd
- chapters/numerictypes.qmd - chapters/numerictypes.qmd
- chapters/Pi2.qmd - chapters/Pi2.qmd
# - chapters/types.qmd - chapters/types.qmd
# - chapters/pcomplex.qmd - chapters/pcomplex.qmd
# - chapters/9_functs.qmd - chapters/9_functs.qmd
- chapters/6_ArraysEtcP1.qmd - chapters/6_ArraysEtcP1.qmd
# - chapters/7_ArraysP2.qmd - chapters/7_ArraysP2.qmd
# - chapters/11_LinAlg.qmd - chapters/11_LinAlg.qmd
# - chapters/10_Strings.qmd - chapters/10_Strings.qmd
# - chapters/14_Plot.qmd - chapters/14_Plot.qmd
# - chapters/13_IO.qmd - chapters/13_IO.qmd
# - chapters/makie.qmd # - chapters/makie.qmd
# - chapters/ablaufsteuerung.qmd
# - chapters/example.qmd
# - chapters/intro.qmd
# - chapters/summary.qmd
format: format:
@ -132,7 +128,6 @@ jupyter: julia-1.10
filters: filters:
- code-visibility - code-visibility
- julia
- latex-environment - latex-environment
environments: [quote,indentb] environments: [quote,indentb]

View File

@ -1,3 +1,14 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Zeichen, Strings und Unicode # Zeichen, Strings und Unicode
## Zeichencodierungen (Frühgeschichte) ## Zeichencodierungen (Frühgeschichte)

View File

@ -1,3 +1,14 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Lineare Algebra in Julia # Lineare Algebra in Julia
```{julia} ```{julia}
@ -190,6 +201,17 @@ A = [ 0 1
``` ```
Das folgende Bild zeigt die Wirkung von $A$ auf Einheitsvektoren. Vektoren gleicher Farbe werden aufeinander abgebildet. (Code durch anklicken sichtbar): Das folgende Bild zeigt die Wirkung von $A$ auf Einheitsvektoren. Vektoren gleicher Farbe werden aufeinander abgebildet. (Code durch anklicken sichtbar):
```{julia}
#| error: false
#| echo: false
#| output: false
using CairoMakie
CairoMakie.activate!(type = "svg")
# set_theme!(size=(1600, 360))
```
```{julia} ```{julia}
#| code-fold: true #| code-fold: true
#| fig-cap: "Bild der Einheitskugel unter $v \\mapsto Av$ mit $||A||\\approx 2.088$" #| fig-cap: "Bild der Einheitskugel unter $v \\mapsto Av$ mit $||A||\\approx 2.088$"

View File

@ -1,3 +1,14 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Ein- und Ausgabe I/O # Ein- und Ausgabe I/O
zahlreiche Varianten und Funktionen, das Folgende ist eine kleine Auswahl zahlreiche Varianten und Funktionen, das Folgende ist eine kleine Auswahl

View File

@ -1,3 +1,15 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Plots, Datenvisualisierung und Grafik in Julia # Plots, Datenvisualisierung und Grafik in Julia

View File

@ -1,5 +1,16 @@
---
engine: julia
---
# Arbeit mit Julia: REPL, Pakete, Introspection # Arbeit mit Julia: REPL, Pakete, Introspection
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
## Dokumentation ## Dokumentation
Die offizielle Julia-Dokumentation [https://docs.julialang.org/](https://docs.julialang.org/) enthält zahlreiche Übersichten, darunter: Die offizielle Julia-Dokumentation [https://docs.julialang.org/](https://docs.julialang.org/) enthält zahlreiche Übersichten, darunter:

View File

@ -2,6 +2,14 @@
engine: julia engine: julia
--- ---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Container # Container
Julia bietet eine große Auswahl von Containertypen mit weitgehend ähnlichem Interface an. Julia bietet eine große Auswahl von Containertypen mit weitgehend ähnlichem Interface an.

View File

@ -1,3 +1,14 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Vektoren, Matrizen, Arrays # Vektoren, Matrizen, Arrays
## Allgemeines ## Allgemeines

View File

@ -1,3 +1,13 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Funktionen und Operatoren # Funktionen und Operatoren

View File

@ -1,3 +1,14 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Erste Miniprogramme # Erste Miniprogramme

View File

@ -2,38 +2,18 @@
engine: julia engine: julia
--- ---
# Ein Beispiel zur Stabilität von Gleitkommaarithmetik ```{julia}
```julia
#| error: false #| error: false
#| echo: false #| echo: false
#| output: false #| output: false
using PlotlyJS, Random using InteractiveUtils
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
``` ```
# Ein Beispiel zur Stabilität von Gleitkommaarithmetik
## Berechnung von $\pi$ nach Archimedes ## Berechnung von $\pi$ nach Archimedes
Eine untere Schranke für $2\pi$, den Umfang des Einheitskreises, erhält man durch die Eine untere Schranke für $2\pi$, den Umfang des Einheitskreises, erhält man durch die

View File

@ -1,3 +1,14 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# First Contact # First Contact
Dieses Kapitel soll beim 'Loslegen' helfen. Es läßt viele Details weg und die Codebeispiele sind oft eher suboptimal. Dieses Kapitel soll beim 'Loslegen' helfen. Es läßt viele Details weg und die Codebeispiele sind oft eher suboptimal.

View File

@ -4,6 +4,13 @@ engine: julia
# Maschinenzahlen # Maschinenzahlen
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
```{julia} ```{julia}
for x ∈ ( 3, 3.3e4, Int16(20), Float32(3.3e4), UInt16(9) ) for x ∈ ( 3, 3.3e4, Int16(20), Float32(3.3e4), UInt16(9) )
@show x sizeof(x) typeof(x) @show x sizeof(x) typeof(x)

View File

@ -1,3 +1,13 @@
---
engine: julia
---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Ein Fallbeispiel: Der parametrisierte Datentyp PComplex # Ein Fallbeispiel: Der parametrisierte Datentyp PComplex

View File

@ -2,6 +2,13 @@
engine: julia engine: julia
--- ---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Grundlagen der Syntax # Grundlagen der Syntax
## Namen von Variablen, Funktionen, Typen etc. ## Namen von Variablen, Funktionen, Typen etc.

View File

@ -1,7 +1,16 @@
--- ---
notebook-links: false notebook-links: false
engine: julia
--- ---
```{julia}
#| error: false
#| echo: false
#| output: false
using InteractiveUtils
```
# Das Typsystem von Julia # Das Typsystem von Julia
Man kann umfangreiche Programme in Julia schreiben, ohne auch nur eine einzige Typdeklaration verwenden zu müssen. Das ist natürlich Absicht und soll die Arbeit der Anwender vereinfachen. Man kann umfangreiche Programme in Julia schreiben, ohne auch nur eine einzige Typdeklaration verwenden zu müssen. Das ist natürlich Absicht und soll die Arbeit der Anwender vereinfachen.

View File

@ -14,8 +14,8 @@ Ein kleines Codebeispiel:
#| output: false #| output: false
using CairoMakie using CairoMakie
CairoMakie.activate!(type = "png") CairoMakie.activate!(type = "svg")
set_theme!(size=(800, 180)) set_theme!(size=(1600, 360))
``` ```
```{julia} ```{julia}
@ -24,7 +24,7 @@ a = [3, 7, 5, 3]
b = [1, 3, 7, 4] b = [1, 3, 7, 4]
δ = π/2 δ = π/2
t = LinRange(-π, π, 300) t = LinRange(-π, π, 300)
f = Figure(size=(800, 180)) f = Figure(size=(1600, 360))
for i in 1:4 for i in 1:4
x = sin.( a[i] .* t .+ δ ) x = sin.( a[i] .* t .+ δ )
y = sin.( b[i] .* t ) y = sin.( b[i] .* t )