From c02453226245a5701f007d11570fe73ef3eae3e5 Mon Sep 17 00:00:00 2001 From: Meik Hellmund Date: Mon, 13 May 2024 00:38:46 +0200 Subject: [PATCH] more chapters adapted to julia engine --- _quarto.yml | 25 ++++++++++--------------- chapters/10_Strings.qmd | 11 +++++++++++ chapters/11_LinAlg.qmd | 22 ++++++++++++++++++++++ chapters/13_IO.qmd | 11 +++++++++++ chapters/14_Plot.qmd | 12 ++++++++++++ chapters/5_TricksHelp.qmd | 11 +++++++++++ chapters/6_ArraysEtcP1.qmd | 8 ++++++++ chapters/7_ArraysP2.qmd | 11 +++++++++++ chapters/9_functs.qmd | 10 ++++++++++ chapters/Erste_Bsp.qmd | 11 +++++++++++ chapters/Pi2.qmd | 32 ++++++-------------------------- chapters/first_contact.qmd | 11 +++++++++++ chapters/numerictypes.qmd | 7 +++++++ chapters/pcomplex.qmd | 10 ++++++++++ chapters/syntax.qmd | 7 +++++++ chapters/types.qmd | 9 +++++++++ index.qmd | 6 +++--- 17 files changed, 170 insertions(+), 44 deletions(-) diff --git a/_quarto.yml b/_quarto.yml index 2493df5..5569214 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -42,27 +42,23 @@ book: chapters: - index.qmd - chapters/entwicklungsumgebungen.qmd - # - chapters/first_contact.qmd - # - chapters/Erste_Bsp.qmd + - chapters/first_contact.qmd + - chapters/Erste_Bsp.qmd - chapters/syntax.qmd - chapters/5_TricksHelp.qmd - chapters/numerictypes.qmd - chapters/Pi2.qmd - # - chapters/types.qmd - # - chapters/pcomplex.qmd - # - chapters/9_functs.qmd + - chapters/types.qmd + - chapters/pcomplex.qmd + - chapters/9_functs.qmd - chapters/6_ArraysEtcP1.qmd - # - chapters/7_ArraysP2.qmd - # - chapters/11_LinAlg.qmd - # - chapters/10_Strings.qmd - # - chapters/14_Plot.qmd - # - chapters/13_IO.qmd + - chapters/7_ArraysP2.qmd + - chapters/11_LinAlg.qmd + - chapters/10_Strings.qmd + - chapters/14_Plot.qmd + - chapters/13_IO.qmd # - chapters/makie.qmd - # - chapters/ablaufsteuerung.qmd - # - chapters/example.qmd - # - chapters/intro.qmd - # - chapters/summary.qmd format: @@ -132,7 +128,6 @@ jupyter: julia-1.10 filters: - code-visibility - - julia - latex-environment environments: [quote,indentb] diff --git a/chapters/10_Strings.qmd b/chapters/10_Strings.qmd index f7bb049..0c06fc1 100644 --- a/chapters/10_Strings.qmd +++ b/chapters/10_Strings.qmd @@ -1,3 +1,14 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + # Zeichen, Strings und Unicode ## Zeichencodierungen (Frühgeschichte) diff --git a/chapters/11_LinAlg.qmd b/chapters/11_LinAlg.qmd index 5b604e1..ef11caf 100644 --- a/chapters/11_LinAlg.qmd +++ b/chapters/11_LinAlg.qmd @@ -1,3 +1,14 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + # Lineare Algebra in 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): + +```{julia} +#| error: false +#| echo: false +#| output: false + +using CairoMakie +CairoMakie.activate!(type = "svg") +# set_theme!(size=(1600, 360)) +``` + ```{julia} #| code-fold: true #| fig-cap: "Bild der Einheitskugel unter $v \\mapsto Av$ mit $||A||\\approx 2.088$" diff --git a/chapters/13_IO.qmd b/chapters/13_IO.qmd index 1d8760e..d6987c3 100644 --- a/chapters/13_IO.qmd +++ b/chapters/13_IO.qmd @@ -1,3 +1,14 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + # Ein- und Ausgabe I/O zahlreiche Varianten und Funktionen, das Folgende ist eine kleine Auswahl diff --git a/chapters/14_Plot.qmd b/chapters/14_Plot.qmd index fc5691d..177004e 100644 --- a/chapters/14_Plot.qmd +++ b/chapters/14_Plot.qmd @@ -1,3 +1,15 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + + # Plots, Datenvisualisierung und Grafik in Julia diff --git a/chapters/5_TricksHelp.qmd b/chapters/5_TricksHelp.qmd index 20e4406..30d81ae 100644 --- a/chapters/5_TricksHelp.qmd +++ b/chapters/5_TricksHelp.qmd @@ -1,5 +1,16 @@ +--- +engine: julia +--- + # Arbeit mit Julia: REPL, Pakete, Introspection +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + ## Dokumentation Die offizielle Julia-Dokumentation [https://docs.julialang.org/](https://docs.julialang.org/) enthält zahlreiche Übersichten, darunter: diff --git a/chapters/6_ArraysEtcP1.qmd b/chapters/6_ArraysEtcP1.qmd index c63df71..fd31646 100644 --- a/chapters/6_ArraysEtcP1.qmd +++ b/chapters/6_ArraysEtcP1.qmd @@ -2,6 +2,14 @@ engine: julia --- +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + + # Container Julia bietet eine große Auswahl von Containertypen mit weitgehend ähnlichem Interface an. diff --git a/chapters/7_ArraysP2.qmd b/chapters/7_ArraysP2.qmd index f49a92a..1632bf2 100644 --- a/chapters/7_ArraysP2.qmd +++ b/chapters/7_ArraysP2.qmd @@ -1,3 +1,14 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + # Vektoren, Matrizen, Arrays ## Allgemeines diff --git a/chapters/9_functs.qmd b/chapters/9_functs.qmd index 1b553e8..054e69b 100644 --- a/chapters/9_functs.qmd +++ b/chapters/9_functs.qmd @@ -1,3 +1,13 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` # Funktionen und Operatoren diff --git a/chapters/Erste_Bsp.qmd b/chapters/Erste_Bsp.qmd index 822244b..38f9e45 100644 --- a/chapters/Erste_Bsp.qmd +++ b/chapters/Erste_Bsp.qmd @@ -1,3 +1,14 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + # Erste Miniprogramme diff --git a/chapters/Pi2.qmd b/chapters/Pi2.qmd index 789b91e..9c24234 100644 --- a/chapters/Pi2.qmd +++ b/chapters/Pi2.qmd @@ -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(""" -
- - """)) -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 diff --git a/chapters/first_contact.qmd b/chapters/first_contact.qmd index 4433538..a880afc 100644 --- a/chapters/first_contact.qmd +++ b/chapters/first_contact.qmd @@ -1,3 +1,14 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + # First Contact Dieses Kapitel soll beim 'Loslegen' helfen. Es läßt viele Details weg und die Codebeispiele sind oft eher suboptimal. diff --git a/chapters/numerictypes.qmd b/chapters/numerictypes.qmd index cc12748..99e6e50 100644 --- a/chapters/numerictypes.qmd +++ b/chapters/numerictypes.qmd @@ -4,6 +4,13 @@ engine: julia # Maschinenzahlen +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + ```{julia} for x ∈ ( 3, 3.3e4, Int16(20), Float32(3.3e4), UInt16(9) ) @show x sizeof(x) typeof(x) diff --git a/chapters/pcomplex.qmd b/chapters/pcomplex.qmd index 60be000..243bf19 100644 --- a/chapters/pcomplex.qmd +++ b/chapters/pcomplex.qmd @@ -1,3 +1,13 @@ +--- +engine: julia +--- + +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` # Ein Fallbeispiel: Der parametrisierte Datentyp PComplex diff --git a/chapters/syntax.qmd b/chapters/syntax.qmd index 30477de..7ff5688 100644 --- a/chapters/syntax.qmd +++ b/chapters/syntax.qmd @@ -2,6 +2,13 @@ engine: julia --- +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + # Grundlagen der Syntax ## Namen von Variablen, Funktionen, Typen etc. diff --git a/chapters/types.qmd b/chapters/types.qmd index 197a5b6..29238e5 100644 --- a/chapters/types.qmd +++ b/chapters/types.qmd @@ -1,7 +1,16 @@ --- notebook-links: false +engine: julia --- +```{julia} +#| error: false +#| echo: false +#| output: false +using InteractiveUtils +``` + + # 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. diff --git a/index.qmd b/index.qmd index f521e9e..7c84fc7 100644 --- a/index.qmd +++ b/index.qmd @@ -14,8 +14,8 @@ Ein kleines Codebeispiel: #| output: false using CairoMakie -CairoMakie.activate!(type = "png") -set_theme!(size=(800, 180)) +CairoMakie.activate!(type = "svg") +set_theme!(size=(1600, 360)) ``` ```{julia} @@ -24,7 +24,7 @@ a = [3, 7, 5, 3] b = [1, 3, 7, 4] δ = π/2 t = LinRange(-π, π, 300) -f = Figure(size=(800, 180)) +f = Figure(size=(1600, 360)) for i in 1:4 x = sin.( a[i] .* t .+ δ ) y = sin.( b[i] .* t )