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:
- 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]

View File

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

View File

@ -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$"

View File

@ -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

View File

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

View File

@ -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:

View File

@ -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.

View File

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

View File

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

View File

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

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

View File

@ -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.

View File

@ -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)

View File

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

View File

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

View File

@ -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.

View File

@ -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 )