2 Commits

Author SHA1 Message Date
b4ee0760e3 typst added 2025-03-06 17:00:41 +01:00
9b4e271fdf one chapter only 2025-03-06 16:53:15 +01:00
16 changed files with 57 additions and 2680 deletions

1
.gitignore vendored
View File

@@ -31,4 +31,3 @@ xelatex.py
/.luarc.json
nb/*.qmd
nb/*.ipynb
.cache/

216
AGENTS.md
View File

@@ -1,216 +0,0 @@
# AGENTS.md - Guidelines for Agentic Coding in JuliaKurs23
This is a **Quarto-based Julia programming course book** in English. The book teaches scientific computing with Julia using interactive Jupyter notebooks rendered with Quarto.
**Translation Note:** The book was originally written in German and has been translated to professional, concise English suitable for mathematicians. All code, LaTeX equations, and formatting have been preserved during translation. Only text descriptions and code comments were translated to English.
## Project Overview
- **Type**: Educational book website/PDF generated from Quarto (.qmd) files
- **Language**: English (all content)
- **Build System**: Quarto with Julia Jupyter kernel
- **Julia Version**: 1.10
- **Output**: HTML website and PDF
- **License**: CC BY-NC-SA 4.0
---
## Build Commands
### Build the Book
```bash
# Build HTML website
quarto render
# Build only HTML
quarto render --to julia-color-html
# Build only PDF
quarto render --to julia-color-pdf
# Preview locally
quarto preview
```
### Development Commands
```bash
# Render a specific chapter
quarto render chapters/first_contact.qmd
# Build with specific output directory
quarto render --output-dir _book
# Run in daemon mode (faster rebuilds)
quarto render --execute-daemon 3600
```
### Deployment
```bash
# Deploy to web server (rsync _book/)
./deploy.sh
```
### Testing Individual Code Blocks
Quarto executes Julia code in Jupyter notebooks. To test individual code blocks:
1. Open the `.qmd` file in VS Code with Julia extension
2. Use Julia REPL to execute code blocks interactively
3. Or use IJulia/Jupyter to run specific cells
```julia
# In Julia REPL, test code from a cell:
include("path/to/notebook.jl")
```
### Julia Package Management
```bash
# Install dependencies (from Project.toml)
julia -e 'using Pkg; Pkg.instantiate()'
# Add a new package
julia -e 'using Pkg; Pkg.add("PackageName")'
```
---
## Code Style Guidelines
### General Structure (.qmd files)
- All `.qmd` files start with YAML front matter specifying `engine: julia`
- Code blocks use triple backticks with `julia` language identifier
- Use Quarto cell options in comments like `#| option: value`
- Common options: `eval:`, `echo:`, `output:`, `error:`, `hide_line:`
Example:
```markdown
---
engine: julia
---
```{julia}
#| eval: true
#| echo: true
#| output: true
using Statistics
mean([1, 2, 3])
```
```
### Julia Code Conventions
#### Imports
```julia
# Prefer using for packages with many exports
using Statistics, LinearAlgebra, Plots
# Use import when you need specific exports or module name
import Base: convert, show
```
#### Naming Conventions
- **Variables/functions**: lowercase with underscores (`my_variable`, `calculate_mean`)
- **Types**: CamelCase (`MyType`, `AbstractMatrix`)
- **Constants**: ALL_UPPERCASE (`MAX_ITER`, `PI`)
- **Modules**: PascalCase (`Statistics`, `LinearAlgebra`)
#### Formatting
- Use 4 spaces for indentation (Julia default)
- Limit lines to ~92 characters when practical
- Use spaces around operators: `a + b`, not `a+b`
- No spaces before commas: `f(a, b)`, not `f(a , b)`
#### Types
- Use explicit types when needed for performance or clarity
- Parameterize types when useful: `Vector{Float64}`, `Dict{Symbol, Int}`
- Prefer concrete types for fields in structs
#### Error Handling
```julia
# Use try-catch for expected errors
try
parse(Int, user_input)
catch e
println("Invalid input: $e")
end
# Use assertions for internal checks
@assert x >= 0 "x must be non-negative"
```
### Quarto-Specific Guidelines
#### Cell Options
Use these in code block comments:
- `#| eval: true/false` - whether to execute
- `#| echo: true/false` - show source code
- `#| output: true/false` - show output
- `#| error: true/false` - show errors
- `#| hide_line: true` - hide this line from output
- `#| fig-cap: "Caption"` - figure caption
#### Embedding Notebooks
```markdown
{{< embed notebooks/nb-types.ipynb#nb1 >}}
```
#### Conditional Content
```markdown
::: {.content-visible when-format="html"}
... HTML only content
:::
::: {.content-visible when-format="pdf"}
... PDF only content
:::
```
---
## File Organization
```
/
├── _quarto.yml # Quarto configuration
├── Project.toml # Julia dependencies
├── index.qmd # Book index
├── chapters/ # Chapter .qmd files
├── notebooks/ # Jupyter notebooks (.ipynb)
├── css/ # Custom styles
├── images/ # Images and logos
├── fonts/ # Custom fonts
└── _book/ # Built output (generated)
```
---
## VS Code Settings
The project uses VS Code with:
- Julia environment: `/home/hellmund/Julia/23`
- LTEx for spell checking (disabled for code blocks)
- Auto-exclude: `.ipynb`, `.md`, `.quarto_ipynb` files
---
## Important Notes
1. **All content is in English** - Comments, documentation, variable names in examples should be English (professional, concise, suitable for mathematicians)
2. **Code comments were translated** - German text and code comments were translated to English; all Julia code, LaTeX equations, and Quarto formatting were preserved
3. **Code execution is cached** - Use `#| eval: true` to execute cells
4. **ansi color codes** - The `julia-color` extension handles ANSI escape sequences in output
5. **Freeze mode** - Set to `auto` in _quarto.yml; use `freeze: false` to re-run all code
6. **Keep intermediate files** - `keep-ipynb`, `keep-tex`, `keep-md` are all true

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +0,0 @@
SoSe25:
14_Plot.html: die beiden Zeilen mit require.js, define jquery entfernen
für Plots/plotlyjs
Book25: Versuch ohne quarto-patch:
LaTeX: ansi in stdout not supported, Julia errors werden total
zerschossen
mit stdout-cell-support koennte ein eigener laufilter gehen, wenn der
vor dem quarto-latex-filter gerufen wird

View File

@@ -1,23 +0,0 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
PlotThemes = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
TreeView = "39424ebd-4cf3-5550-a685-96706a953f40"

View File

@@ -1,16 +1,12 @@
title: Julia-color
author: Meik Hellmund
version: 1.0.0
quarto-required: ">=99.9.0"
quarto-required: ">=1.6.0"
contributes:
formats:
common:
filters:
- "ansi2htmltex.lua"
html:
monofont: "JuliaMono"
css:
- "resources/css/ansicolor.css"
- "resources/css/juliamono.css"
pdf:
include-in-header:

View File

@@ -16,29 +16,28 @@
\DeclareRobustCommand{\lseries}{\fontseries{l}\selectfont}
\DeclareTextFontCommand{\textlight}{\lseries}
\DefineVerbatimEnvironment{OutputCell}{Verbatim}%
{xleftmargin=1.5em}
\DefineVerbatimEnvironment{AnsiOutputCell}{Verbatim}%
{commandchars=\\\{\}, xleftmargin=1.5em}
\DefineVerbatimEnvironment{StderrOutputCell}{Verbatim}%
{commandchars=\\\{\}, xleftmargin=1.5em,frame=single,rulecolor=\color{red}}
\definecolor{ansi-black}{HTML}{3E424D}
\definecolor{ansi-black-intense}{HTML}{282C36}
\definecolor{ansi-red}{HTML}{E75C58}
\definecolor{ansi-red-intense}{HTML}{B22B31}
\definecolor{ansi-green}{HTML}{00A250}
\definecolor{ansi-green-intense}{HTML}{007427}
\definecolor{ansi-yellow}{HTML}{DDB62B}
\definecolor{ansi-yellow-intense}{HTML}{B27D12}
\definecolor{ansi-blue}{HTML}{208FFB}
\definecolor{ansi-blue-intense}{HTML}{0065CA}
\definecolor{ansi-magenta}{HTML}{D160C4}
\definecolor{ansi-magenta-intense}{HTML}{A03196}
\definecolor{ansi-cyan}{HTML}{60C6C8}
\definecolor{ansi-cyan-intense}{HTML}{258F8F}
\definecolor{ansi-white}{HTML}{C5C1B4}
\definecolor{ansi-white-intense}{HTML}{A1A6B2}
\definecolor{ansi-default-inverse-fg}{HTML}{FFFFFF}
\definecolor{ansi-default-inverse-bg}{HTML}{000000}
%\DefineVerbatimEnvironment{OutputCell}{Verbatim}%
% {xleftmargin=1.5em}
%\DefineVerbatimEnvironment{AnsiOutputCell}{Verbatim}%
% {commandchars=\\\{\}, xleftmargin=1.5em}
%\DefineVerbatimEnvironment{StderrOutputCell}{Verbatim}%
% {commandchars=\\\{\}, xleftmargin=1.5em,frame=single,rulecolor=\color{red}}
%
%\definecolor{ansi-black}{HTML}{3E424D}
%\definecolor{ansi-black-intense}{HTML}{282C36}
%\definecolor{ansi-red}{HTML}{E75C58}
%\definecolor{ansi-red-intense}{HTML}{B22B31}
%\definecolor{ansi-green}{HTML}{00A250}
%\definecolor{ansi-green-intense}{HTML}{007427}
%\definecolor{ansi-yellow}{HTML}{DDB62B}
%\definecolor{ansi-yellow-intense}{HTML}{B27D12}
%\definecolor{ansi-blue}{HTML}{208FFB}
%\definecolor{ansi-blue-intense}{HTML}{0065CA}
%\definecolor{ansi-magenta}{HTML}{D160C4}
%\definecolor{ansi-magenta-intense}{HTML}{A03196}
%\definecolor{ansi-cyan}{HTML}{60C6C8}
%\definecolor{ansi-cyan-intense}{HTML}{258F8F}
%\definecolor{ansi-white}{HTML}{C5C1B4}
%\definecolor{ansi-white-intense}{HTML}{A1A6B2}
%\definecolor{ansi-default-inverse-fg}{HTML}{FFFFFF}
%\definecolor{ansi-default-inverse-bg}{HTML}{000000}

View File

@@ -40,22 +40,22 @@ book:
chapters:
- index.qmd
- chapters/entwicklungsumgebungen.qmd
- chapters/first_contact.qmd
- chapters/Erste_Bsp.qmd
- chapters/syntax.qmd
- chapters/5_TricksHelp.qmd
#- chapters/entwicklungsumgebungen.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/6_ArraysEtcP1.qmd
- chapters/7_ArraysP2.qmd
- chapters/11_LinAlg.qmd
- chapters/10_Strings.qmd
- chapters/13_IO.qmd
- chapters/14_Plot.qmd
#- chapters/Pi2.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/13_IO.qmd
#- chapters/14_Plot.qmd
# - chapters/makie.qmd
@@ -66,7 +66,8 @@ format:
dark: [superhero, css/dark.scss]
css:
- css/styles.css
- css/roboto-condensed.css
- css/roboto-condensed.css
highlight-style: github # arrow ?????
mainfont: "Roboto Condensed" # Ubuntu # "Atkinson Hyperlegible" # Verdana #Quicksand
toc: true # change for Vorlesung
@@ -104,7 +105,10 @@ format:
code-overflow: wrap
include-in-header:
- file: macros.tex
typst:
toc: true
latex-auto-install: false
execute:
@@ -116,13 +120,13 @@ execute:
eval: true
freeze: auto
daemon: 3600
preserve-ansi: true
#preserve-ansi: true
keep-ipynb: true
keep-tex: true
keep-md: true
jupyter: julia-1.10
#jupyter: julia-1.10
filters:
- code-visibility

View File

@@ -32,7 +32,7 @@ $ julia
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.4 (2025-03-10)
| | |_| | | | (_| | | Version 1.11.3 (2025-01-21)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

View File

@@ -321,7 +321,7 @@ Die Darstellung mit genau einer Ziffer ungleich Null vor dem Komma ist die __No
$$
(10)_b = b> m \ge 1.
$$
- Bei Binärzahlen `1.01101` ist diese Ziffer immer gleich Eins und man kann auf das Abspeichern dieser Ziffer verzichten. Diese tatsächlich abgespeicherte (gekürzte) Mantisse bezeichnen wir mit $M$, so dass
- Bei Binärzahlen `1.01101`: ist diese Ziffer immer gleich Eins und man kann auf das Abspeichern dieser Ziffer verzichten. Diese tatsächlich abgespeicherte (gekürzte) Mantisse bezeichnen wir mit $M$, so dass
$$m = 1 + M$$
gilt.

View File

@@ -17,6 +17,7 @@ Base.active_module() = myactive_module()
# https://github.com/JuliaLang/julia/blob/master/base/show.jl#L3073-L3077
```
# Ein Fallbeispiel: Der parametrisierte Datentyp PComplex
Wir wollen als neuen numerischen Typen **komplexe Zahlen in Polardarstellung $z=r e^{i\phi}=(r,ϕ)$** einführen.

View File

@@ -494,7 +494,7 @@ Wenn man solche Zuweisungen mit `const` für dauerhaft erklärt, entsteht ein
```{julia}
const MyCmplxF64 = MyComplex{Float64}
z = MyCmplxF64(1.1, 2.2)
z = MyComplex(1.1, 2.2)
typeof(z)
```

View File

@@ -5,8 +5,6 @@ $h3-font-size: 1.2rem !default;
$border-radius: 0;
$font-family-monospace: "JuliaMono";
/* bug in superhero theme? */
h1,h2,h3,h4,h5,h6 {color: #f0f0f0 !important;}
@@ -15,7 +13,6 @@ h1,h2,h3,h4,h5,h6 {color: #f0f0f0 !important;}
.cell-output code span {color: #000;}
/*-- scss:rules --*/
div.cell-output { background-color: #dbdbdb; }

View File

@@ -8,8 +8,6 @@ $border-radius: 0;
/* $code-block-bg: #f3f3f3; */
$code-block-bg: #f7f7f7;
$font-family-monospace: "JuliaMono";
/*-- scss:rules --*/
div.cell-output { background-color: #ffffff; }
code {color: #202020;}

View File

@@ -37,12 +37,12 @@ f
- 2009 Beginn der Entwicklung am *Computer Science and Artificial
Intelligence Laboratory* des MIT
- 2012 erste Release v0.1
- 2012 erste release v0.1
- 2018 Version v1.0
- aktuell: v1.11.4 vom 10. März 2025
- aktuell: v1.11.3 vom 21. Januar 2025
Zum ersten Release 2012 haben die Schöpfer von Julia ihre Ziele und Motivation in dem Blogbeitrag [Why we created Julia](https://julialang.org/blog/2012/02/why-we-created-julia/)
interessant zusammengefasst.
Zum ersten release 2012 haben die Schöpfer von Julia ihre Ziele und Motivation in dem Blogbeitrag [Why we created Julia](https://julialang.org/blog/2012/02/why-we-created-julia/)
interessant zusammengefasst.
Für ein Bild von *Stefan Karpinski, Viral Shah, Jeff
Bezanson* und *Alan Edelman* bitte hier klicken: <https://news.mit.edu/2018/julia-language-co-creators-win-james-wilkinson-prize-numerical-software-1226>.

View File

@@ -1,23 +0,0 @@
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"llama.cpp": {
"npm": "@ai-sdk/openai-compatible",
"name": "llama-server (local)",
"options": {
"baseURL": "http://127.0.0.1:8077/v1"
},
"models": {
"Qwen3-coder-next-100": {
"name": "Qwen3-coder-next-100",
"tool_call": true,
"reasoning": true,
"limit": {
"context": 128000,
"output": 65536
}
}
}
}
}
}