further work on translation

This commit is contained in:
2026-03-02 14:43:14 +01:00
parent 457873a31b
commit c6609d15f5
12 changed files with 254 additions and 110 deletions

2
.gitignore vendored
View File

@@ -32,3 +32,5 @@ xelatex.py
nb/*.qmd
nb/*.ipynb
.cache/
**/*.quarto_ipynb

View File

@@ -4,15 +4,15 @@ project:
- fonts/
- images/
lang: de
language:
title-block-published: "Updated"
title-block-author-single: "Autor"
toc-title-document: "Auf dieser Seite"
lang: en
#language:
# title-block-published: "Updated"
# title-block-author-single: "Autor"
# toc-title-document: "Auf dieser Seite"
book:
title: "Julia für Numerik"
subtitle: "Einführung in die wissenschaftliche Programmierung"
title: "Julia for Numerical Analysis"
subtitle: "Introduction to Scientific Computing"
author: "Meik Hellmund"
site-url: "https://www.math.uni-leipzig.de/~hellmund/juliabook"
favicon: "images/favicon-32x32.png"
@@ -23,7 +23,7 @@ book:
- icon: github
href: https://gitea.math.uni-leipzig.de/hellmund/JuliaKurs23
- icon: download
href: "Julia-f%C3%BCr-Numerik.pdf"
href: "Julia-for-Numerical-Analysis.pdf"
search: true
@@ -56,7 +56,7 @@ book:
- chapters/10_Strings.qmd
- chapters/13_IO.qmd
- chapters/14_Plot.qmd
# - chapters/makie.qmd
format:
@@ -82,12 +82,32 @@ format:
cap-location: bottom
html-math-method: mathjax
julia-color-pdf:
pdf-engine: xelatex
# julia-color-pdf:
# pdf-engine: xelatex
# papersize: a4
# documentclass: scrreprt
# classoption: [notitlepage,DIV=16,BCOR=5mm,10pt]
# toc: false
# number-depth: 2
# fig-cap-location: bottom
# fig-pos: H
# tbl-cap-location: bottom
# hyperrefoptions:
# - linktoc=all
# colorlinks: true
# linkcolor: "blue"
# keep-tex: true
# keep-ipynb: true
# keep-md: true
# code-block-bg: "#e0e0e0"
# code-block-border-left: "#e0e0e0"
# code-overflow: wrap
# include-in-header:
# - file: macros.tex
julia-color-typst:
papersize: a4
documentclass: scrreprt
classoption: [notitlepage,DIV=16,BCOR=5mm,10pt]
toc: false
toc: true
number-depth: 2
fig-cap-location: bottom
fig-pos: H
@@ -95,16 +115,12 @@ format:
hyperrefoptions:
- linktoc=all
colorlinks: true
linkcolor: "blue"
keep-tex: true
keep-ipynb: true
keep-md: true
code-block-bg: "#e0e0e0"
code-block-border-left: "#e0e0e0"
code-overflow: wrap
linkcolor: #0000FF
keep-typ: true
include-in-header:
- file: macros.tex
- file: macros.typ
latex-auto-install: false
execute:
@@ -122,8 +138,6 @@ keep-ipynb: true
keep-tex: true
keep-md: true
jupyter: julia-1.10
filters:
- code-visibility
- latex-environment

View File

@@ -93,14 +93,14 @@ A + 4I
To be able to study questions such as conditioning or convergence of an algorithm, we need a metric. For linear spaces, it is appropriate to define the metric via a norm:
$$
d(x,y) := ||x-y||
d(x,y) := \lVert x-y\rVert
$$
### $p$-Norms
A simple class of norms in $^n$ are the $p$-norms
$$
||\mathbf{x}||_p = \left(\sum |x_i|^p\right)^\frac{1}{p},
\lVert \mathbf{x} \rVert_p = \left(\sum |x_i|^p\right)^\frac{1}{p},
$$
which generalize the Euclidean norm $p=2$.
@@ -110,13 +110,13 @@ which generalize the Euclidean norm $p=2$.
## The Max-Norm $p=\infty$
Let $x_{\text{max}}$ be the _largest in absolute value_ component of $\mathbf{x}\in ^n$. Then always
$$ |x_{\text{max}}| \le ||\mathbf{x}||_p \le n^\frac{1}{p} |x_{\text{max}}|
$$ \lvert x_{\text{max}}\rvert \le \lVert\mathbf{x}\rVert_p \le n^\frac{1}{p} \lvert x_{\text{max}}\rvert
$$
(Consider a vector whose components are all equal to $x_{\text{max}}$ respectively a vector whose components are all equal to zero except $x_{\text{max}}$.)
Thus follows
$$
\lim_{p \rightarrow \infty} ||\mathbf{x}||_p = |x_{\text{max}}| =: ||\mathbf{x}||_\infty.
\lim_{p \rightarrow \infty} \lVert\mathbf{x}\rVert_p = \lvert x_{\text{max}}\rvert =: \lVert\mathbf{x}\rVert_\infty.
$$
:::
@@ -132,7 +132,7 @@ w = [-1, 2, 33.2]
- If the 2nd argument `p` is missing, `p=2` is set.
- The 2nd argument can also be `Inf` (i.e., $+\infty$).
- The 1st argument can be any container full of numbers. The sum $\sum |x_i|^p$ extends over *all* elements of the container.
- The 1st argument can be any container full of numbers. The sum $\sum \lvert x_i\rvert^p$ extends over *all* elements of the container.
- Thus, for a matrix `norm(A)` is equal to the _Frobenius norm_ of the matrix `A`.
```{julia}
@@ -145,7 +145,7 @@ norm(A) # Frobenius norm
Since norms are homogeneous under multiplication with scalars,
$||\lambda \mathbf{x}|| = |\lambda|\cdot||\mathbf{x}||$, they are completely determined by the specification of the unit ball. Subadditivity of the norm (triangle inequality) is equivalent to the convexity of the unit ball
$\lVert\lambda \mathbf{x}\rVert = |\lambda|\cdot\lVert\mathbf{x}\rVert$, they are completely determined by the specification of the unit ball. Subadditivity of the norm (triangle inequality) is equivalent to the convexity of the unit ball
(code visible by clicking).
```{julia}
#| code-fold: true
@@ -163,7 +163,7 @@ for p ∈ (0.8, 1, 1.5, 2, 3.001, 1000)
end
fig1
```
As one can see, $p\ge 1$ must hold so that the unit ball is convex and $||.||_p$ is a norm.
As one can see, $p\ge 1$ must hold so that the unit ball is convex and $\lVert.\rVert_p$ is a norm.
However, the Julia function `norm(v, p)` returns a result for arbitrary parameters `p`.
@@ -181,7 +181,7 @@ Due to the homogeneity of the norm under multiplication with scalars, it is suff
Let $V$ be a vector space with dimension $0<n<\infty$ and
$A$ an $n\times n$-matrix. Then
$$
||A||_p = \max_{||\mathbf{v}||_p=1} ||A\mathbf{v}||_p
\lVert A\rVert_p = \max_{\lVert\mathbf{v}\rVert_p=1} \lVert A\mathbf{v}\rVert_p
$$
:::
@@ -214,16 +214,10 @@ CairoMakie.activate!(type = "svg")
```{julia}
#| code-fold: true
#| fig-cap: "Image of the unit ball under $v \\mapsto Av$ with $||A||\\approx 2.088$"
#| fig-cap: "Image of the unit ball under $v \\mapsto Av$ with $\\lVert A\\rVert\\approx 2.088$"
using CairoMakie
# Makie bug https://github.com/MakieOrg/Makie.jl/issues/3255
# Workaround https://github.com/MakieOrg/Makie.jl/issues/2607#issuecomment-1385816645
tri = BezierPath([
MoveTo(Point2f(-0.5, -1)), LineTo(0, 0), LineTo(0.5, -1), ClosePath()
])
A = [ 0 1
1.2 1.5 ]
@@ -241,14 +235,14 @@ Auv = A * [u,v]
fig2 = Figure(size=(800, 400))
lines(fig2[1, 1], xs, ys, color=t, linewidth=5, colormap=:hsv, axis=(; aspect = 1, limits=(-2,2, -2,2),
title=L"$\mathbf{v}$", titlesize=30))
arrows!(fig2[1,1], x, y, u, v, arrowsize=10, arrowhead=tri, colormap=:hsv, linecolor=range(0,11), linewidth=3)
arrows2d!(fig2[1,1], x, y, u, v, tipwidth=10, colormap=:hsv, shaftcolor=range(0,11), shaftwidth=3)
Legend(fig2[1,2], MarkerElement[], String[], L"⟹", width=40, height=30, titlesize=30, framevisible=false)
lines(fig2[1,3], Axys[1], Axys[2], color=t, linewidth=5, colormap=:hsv, axis=(; aspect=1, limits=(-2,2, -2,2),
title=L"$A\mathbf{v}$", titlesize=30))
arrows!(fig2[1,3], x, y, Auv[1], Auv[2], arrowsize=10, arrowhead=tri, colormap=:hsv, linecolor=range(0,11),
linewidth=3)
arrows2d!(fig2[1,3], x, y, Auv[1], Auv[2], tipwidth=10, colormap=:hsv, shaftcolor=range(0,11),
shaftwidth=3)
fig2
```
@@ -257,7 +251,7 @@ fig2
For p = 1, p = 2 (default) or p = Inf, `cond(A,p)` returns the condition number in the $p$-norm
$$
\text{cond}_p(A) = ||A||_p \cdot ||A^{-1}||_p
\text{cond}_p(A) = \lVert A\rVert_p \cdot \lVert A^{-1}\rVert_p
$$
```{julia}
@@ -269,7 +263,7 @@ $$
Basic tasks of numerical linear algebra:
- Solve a system of linear equations $A\mathbf{x} = \mathbf{b}$.
- If no solution exists, find the best approximation, i.e., the vector $\mathbf{x}$ that minimizes $||A\mathbf{x} - \mathbf{b}||$.
- If no solution exists, find the best approximation, i.e., the vector $\mathbf{x}$ that minimizes $\lVert A\mathbf{x} - \mathbf{b}\rVert$.
- Find eigenvalues and eigenvectors $A\mathbf{x} = \lambda \mathbf{x}$ of $A$.
These tasks can be solved using matrix factorizations. Some fundamental matrix factorizations:
@@ -295,6 +289,8 @@ These tasks can be solved using matrix factorizations. Some fundamental matrix f
LU factorization is Gaussian elimination. The result of Gaussian elimination is the upper triangular matrix $U$. The lower triangular matrix $L$ contains ones on the diagonal and the non-diagonal entries $l_{ij}$ are equal to minus the coefficients by which row $Z_j$ is multiplied and added to row $Z_i$ in the Gaussian algorithm.
An example:
:::{.content-visible unless-format="typst"}
$$
A=\left[
\begin{array}{ccc}
@@ -325,6 +321,44 @@ A=\left[
& & 8
\end{array}\right] = U
$$
:::
:::{.content-hidden unless-format="typst"}
```{=typst}
$
A = mat(
1, 2, 2;
3, -4, 4;
-2, 1, 5; delim:"["
)
script(vec(
#h(0pt),#h(0pt),#h(0pt),
Z_2 arrow.bar Z_2 text(fill:#red, -) text(fill:#red, 3) Z_1,
Z_3 arrow.bar Z_3 + text(fill:#red, 2) Z_1, delim:#none
))
&arrow.double.long
mat(
1, 2, 2;
, -10, -2;
, 5, 9
)
script(vec(
#h(0pt),
#h(0pt),
#h(0pt),#h(0pt),
Z_3 arrow.bar Z_3 + text(fill:#red, 1/2) Z_2, delim:#none
))
&arrow.double.long
mat(
1, 2, 2;
, -10, -2;
, , 8
) = U
$
```
:::
:::{.content-visible unless-format="typst"}
$$
A = \left[
\begin{array}{ccc}
@@ -340,6 +374,24 @@ A = \left[
& & 8
\end{array}\right]
$$
:::
:::{.content-hidden unless-format="typst"}
```{=typst}
$
A = mat(
1,,;
text(fill:#red, +3),1,;
text(fill:#red, -2),text(fill:#red, -1/2),1
) dot.c
mat(
1,2,3;
,-10,-2;
,,8
)
$
```
:::
- Often in practice: $A\mathbf{x}=\mathbf{b}$ must be solved for one $A$ and many right-hand sides $\mathbf{b}$.
@@ -362,6 +414,8 @@ display(U)
#### Pivoting
Let's look at one step of Gaussian elimination:
:::{.content-visible unless-format="typst"}
$$
\left[
\begin{array}{cccccc}
@@ -375,12 +429,41 @@ $$
\end{array}
\right]
$$
The goal is to make the entry $a_{i+1,j}$ disappear by adding an appropriate multiple of row $Z_i$ to row $Z_{i+1}$. This only works if the _pivot element_ $\textcolor{red}{a_{ij}}$ is not zero. If $\textcolor{red}{a_{ij}}=0$, we must exchange rows to fix this.
:::
:::{.content-hidden unless-format="typst"}
```{=typst}
$
mat(
*, dots.c, *, *, dots.c, *;
, dots.down, dots.v, dots.v, , dots.v;
, , *, *, dots.c, *;
, , , text(fill: #red, a_(i j)), dots.c, a_(i n);
, , , text(fill: #blue, a_(i+1, j)), dots.c, a_(i+1, n);
, , , text(fill: #blue, dots.v), , dots.v;
, , , text(fill: #blue, a_(m j)), dots.c, a_(m n)
)
$
```
:::
The goal is to make the entry $a_{i+1,j}$ disappear by adding an appropriate multiple of row $Z_i$ to row $Z_{i+1}$. This only works if the _pivot element_ ${\color{red}a_{ij}}$ is not zero. If ${\color{red}a_{ij}}=0$, we must exchange rows to fix this.
Furthermore, the conditioning of the algorithm is best if we arrange the matrix at each step so that the pivot element is the largest in absolute value in the corresponding column of the remaining submatrix. In (row) pivoting, rows are exchanged at each step to ensure that
:::{.content-visible unless-format="typst"}
$$
|\textcolor{red}{a_{ij}}|=\max_{k=i,...,m} |\textcolor{blue}{a_{kj}}|
$$
:::
:::{.content-hidden unless-format="typst"}
```{=typst}
$
|text(fill:#red, a_(i j))| = max_(k=1,...,m) | text(fill:#blue, a_(k j)) |
$
```
:::
#### LU in Julia

View File

@@ -1,5 +1,7 @@
---
engine: julia
julia:
exeflags: ["--color=yes"]
---
```{julia}
@@ -106,12 +108,12 @@ An important part of the _Julia ecosystem_ is the numerous packages that extend
- The _package manager_ `Pkg` is used for this purpose.
- It can be used in two ways:
- as normal Julia statements that can also be in a `.jl` program file:
```
```{.Julia}
using Pkg
Pkg.add("PackageXY")
```
- in the special pkg-mode of the Julia REPL:
```
```{.julia}
] add PackageXY
```
- Afterward, the package can be used with `using PackageXY`.

View File

@@ -1,5 +1,7 @@
---
engine: julia
julia:
exeflags: ["--color=yes"]
---
```{julia}
@@ -9,8 +11,7 @@ engine: julia
using InteractiveUtils
```
# First Small Programs
# A small Example Program
## What Skills Are Needed for Programming?

View File

@@ -87,10 +87,10 @@ s_B = s_A = sqrt(2) # initial value
is = Float64[]
@printf """Approx. value of π
$n$-gon Iteration A Iteration B
n-gon Iteration A Iteration B
"""
for $i$ in $3:35$
for i in 3:35
push!(is, i)
s_A = iterationA(s_A)
s_B = iterationB(s_B)

View File

@@ -9,7 +9,7 @@ For long-term work, a personal installation is recommended.
1. Install Julia with the installation and update manager **juliaup**: <https://github.com/JuliaLang/juliaup/>
2. Install **Visual Studio Code** as editor/IDE: <https://code.visualstudio.com/>
3. Install the **Julia language extension** in VS Code: <https://www.julia-vscode.org/docs/stable/gettingStarted/>
3. Install the **Julia language extension** in VS Code: <https://www.julia-vscode.org/docs/stable/gettingstarted/>
Entry point:
@@ -32,7 +32,7 @@ $ julia
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.11.4 (2025-03-10)
| | |_| | | | (_| | | Version 1.12.5 (2026-02-09)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
@@ -88,7 +88,7 @@ This can be used to:
In text cells, the markup language [Markdown](https://en.wikipedia.org/wiki/Markdown) can be used for formatting and LaTeX for mathematical equations.
::: {.callout-tip }
Please check the `User Interface Tour` and `Keyboard Shortcuts` points in the `Help` menu!
Please check the `User Interface Tour` and `Keyboard Shortcuts` topics in the `Help` menu!
:::
The cell currently being worked on can be in `command mode` or `edit mode`.

View File

@@ -1,5 +1,7 @@
---
engine: julia
julia:
exeflags: ["--color=yes"]
---
```{julia}
@@ -36,7 +38,7 @@ function Tab(s)
return # return nothing, since broadcast println produces empty vector
end
= |>
= |>
# IJulia.set_verbose(true)
```
@@ -57,7 +59,7 @@ Note that:
## The most important keys: `Tab` and `?` {#sec-tab}
When programming, repeatedly press the Tab key as soon as 23 letters of a word have been typed. Potential completions are then displayed or completed if the completion is unique. This saves time and is extremely helpful.
When programming, press the Tab key as soon as 23 letters of a word have been typed. Potential completions are then displayed or completed if the completion is unique. This saves time and you learn a lot about Julia.
```{julia}
lo = "lo" #| hide_line
@@ -71,11 +73,14 @@ pri ▷ Tab
The built-in Julia help `?name` for all functions and constructs is very comprehensive. Here is a rather brief example:
:::{.content-visible unless-format="typst"}
```{julia}
?for
```
:::
:::{.content-hidden unless-format="xxx"}
:::{.content-hidden unless-format="typst"}
::: {.cell }
```{.julia .cell-code}
@@ -84,18 +89,23 @@ The built-in Julia help `?name` for all functions and constructs is very compreh
::: {.cell-output .cell-output-stdout}
```
search: for foreach foldr floor mapfoldr factorial EOFError OverflowError
search: for nor xor foldr floor Core sort
for loops repeatedly evaluate a block of statements while iterating over a sequence of values.
for
Examples
for loops repeatedly evaluate a block of statements while iterating over a sequence of values.
julia> for i in [1, 4, 0]
println(i)
end
1
4
0
The iteration variable is always a new variable, even if a variable of the same name exists in the enclosing scope. Use outer to reuse an existing local variable for iteration.
Examples
========
julia> for i in [1, 4, 0]
println(i)
end
1
4
0
```
:::
@@ -105,7 +115,7 @@ julia> for i in [1, 4, 0]
## Variables and Assignments
Variables are created through assignment with the assignment operator `=`. Afterwards, they can be used in further statements.
Variables are created through assignment with the assignment operator `=`.
```{julia}
x = 1 + sqrt(5)
@@ -124,10 +134,11 @@ Expressions like `x + y = sin(2)` are therefore invalid. Only a variable name ma
:::
## Data types
## Data types
Julia is a [strongly typed](https://en.wikipedia.org/wiki/Strong_and_weak_typing) language
where every object possesses a type. Among the fundamental types are:
Julia is a [strongly typed](https://en.wikipedia.org/wiki/Strong_and_weak_typing) language. All objects have a type.
Among other things, there are the basic types
- Integers,
- Floating-point numbers,
@@ -139,7 +150,7 @@ The type of a variable can be determined using the `typeof()` function.
#| warning: true
#| error: true
for x ∈ (42, 12.0, 3.3e4, "Hello!", true)
println("x = ", x, " ..... Type: ", typeof(x))
println("x = ", x, " ... Type: ", typeof(x))
end
```
The standard floating-point number has a size of 64 bits, which corresponds to a `double` in C/C++/Java.
@@ -159,7 +170,7 @@ println( typeof(x), " - Value of x = $x" )
```
## Print statements
The `println()` function differs from `print()` in that it outputs a line break at the end.
The `println()` function puts a line break at the end, `print()` doesn't.
```{julia}
print(y)
print("...the line continues...")
@@ -168,14 +179,15 @@ println(y)
println("New line")
println("New line")
```
Both functions can accept a list of *strings* and variables as arguments. Variables can also be embedded in *strings* by prefixing the variable name with a dollar sign *(string interpolation)*.
Both functions can accept a list of strings and variables as arguments. Variables can also be embedded in strings by prefixing the variable name with a dollar sign *(string interpolation)*.
```{julia}
x = 23
y = 3x + 5
zz = "Done!"
println("x= ", x, " ...and y= ", y, "...", zz) # 1. variant
println("x= $x ...and y= $y...$zz") # variant with string interpolation
println("x= ", x, " ... and y= ", y, "...", zz) # 1. variant
println("x= $x ... and y= $y...$zz") # variant with string interpolation
```
@@ -189,7 +201,7 @@ println("One dollar: 1\$ and three backslashes: \\\\\\ ")
:::
## Functions
Function definitions begin with the keyword `function` and end with the keyword `end`. Typically, they have one or more arguments and return a computed result via the `return` statement.
Function definitions start with the keyword `function` and end with the keyword `end`. Typically, they have one or more arguments and return a computed result via a `return` statement.
```{julia}
function hypotenuse(a, b) # particularly cumbersome today
c2 = a^2 + b^2
@@ -206,7 +218,7 @@ println("z = $z")
println("c = $c")
```
Very simple functions can also be defined as single-line functions.
Very simple functions can also be defined as one-liners:
```{julia}
hypotenuse(a, b) = sqrt(a^2+b^2)
```
@@ -219,7 +231,7 @@ x = 3^2
x < 2^3
```
In addition to the usual arithmetic comparisons `==, !=, <, <= ,> ,>=`
there are many other tests. Of course, the result of a test can also be assigned to a variable, which is then of type `Bool`. The logical operators `&&`, `||` and negation `!` can be used in tests.
there are many other tests. The result of a test can also be assigned to a variable, which is then of type `Bool`. The logical operators `&&`, `||` and negation `!` can be used in tests.
```{julia}
test1 = "Car" in ["Bicycle", "Car", "Train"]
@@ -229,9 +241,9 @@ println("$test1 $test2 $test3")
```
## Branches
Branches (conditional statements) have the form
## Conditional Evaluation
A simple `if` has the form
```default
if <test>
<statement1>
@@ -240,7 +252,7 @@ if <test>
end
```
An `else` branch and `elseif` branches are possible.
There can one or several `elseif` blocks and a final `else` block.
```{julia}
x = sqrt(100)
@@ -252,13 +264,12 @@ else
end
```
Indentation improves readability but is optional. Line breaks separate statements, and this can also be done with semicolons. The above code block is identical to the following line in Julia:
Indentation enhances readability but is optional. Line breaks separate statements, as do semicolons. The above code block is equivalent to the following line in Julia:
```{julia}
# Please don't program like this! You will regret it!
x=sqrt(100); if x > 20 println("Strange!") else println("OK"); y = x + 3 end
```
It is strongly recommended to format your own code from the beginning with clear indentation!
## Simple `for` loops
@@ -283,7 +294,7 @@ sum
## Arrays
1-dimensional arrays (vectors) are a simple form of containers. They can be created with square brackets
One-dimensional arrays (vectors) are a simple form of containers. They can be created with square brackets
and accessed by index. Indexing starts at 1.
```{julia}

View File

@@ -1,5 +1,7 @@
---
engine: julia
julia:
exeflags: ["--color=yes"]
---
```{julia}

View File

@@ -2,7 +2,7 @@
engine: julia
---
# A Case Study: The Parametric Data Type PComplex
# Example: The Parametric Data Type `PComplex`
```{julia}
#| error: false
@@ -109,9 +109,19 @@ z2 = PComplex(2.0, 0.3)
Julia uses `//` as an infix constructor for the type `Rational`. We want something equally nice.
In electronics/electrical engineering, [AC quantities are described by complex numbers.](https://en.wikipedia.org/wiki/Phasor_analysis) A representation of complex numbers by "magnitude" and "phase" is common and is often represented in so-called [phasor form](https://en.wikipedia.org/wiki/Phasor):
:::{.content-visible unless-format="typst"}
$$
z= r\enclose{phasorangle}{\phi} = 3.4\;\enclose{phasorangle}{45^\circ}
$$
:::
:::{.content-hidden unless-format="typst"}
```{=typst}
$ z = r angle.acute phi = 3.4 angle.acute 45 degree $
```
:::
where the angle is usually noted in degrees.
:::{.callout-note .titlenormal collapse="true"}

View File

@@ -1,5 +1,7 @@
---
engine: julia
julia:
exeflags: ["--color=yes"]
---
```{julia}
@@ -513,7 +515,7 @@ end
-------
The C semantics of `for(i=1; i<5; i++)` corresponds to the `while` loop:
```
```{.julia}
i = 1
while i<5
*loop body* # here one can also mess with i effectively

View File

@@ -1,13 +1,20 @@
---
engine: julia
julia:
exeflags: ["--color=yes"]
---
# What is Julia? {.unnumbered}
```{=typst}
#set math.equation(numbering: none)
// some things need to be here, to counter the typst style
```
Julia is a relatively young, modern programming language designed for *scientific computing*.
A small code example:
A code example:
```{julia}
#| error: false
@@ -40,12 +47,16 @@ f
Intelligence Laboratory* of MIT
- 2012 first release v0.1
- 2018 Version v1.0
- current: v1.11.4 from March 10, 2025
- February 2026: Version v1.12.5
For the first release in 2012, the creators of Julia summarized their goals and motivation in a blog post [Why we created Julia](https://julialang.org/blog/2012/02/why-we-created-julia) interestingly.
In their 2012 inaugural blog post [Why we created Julia](https://julialang.org/blog/2012/02/why-we-created-julia),
the developers provide an insightful and funny overview of their objectives and motivations for creating Julia.
For a picture of *Stefan Karpinski, Viral Shah, Jeff
Bezanson*, and *Alan Edelman*, please click here: <https://news.mit.edu/2018/julia-language-co-creators-win-james-wilkinson-prize-numerical-software-1226>.
Bezanson*, and *Alan Edelman*, please
click here: <https://news.mit.edu/2018/julia-language-co-creators-win-james-wilkinson-prize-numerical-software-1226>.
@@ -95,39 +106,45 @@ Julia has a built-in package manager."
:::
*open source*
: - open development on [GitHub](https://github.com/JuliaLang/julia)
***open source***
- open development on [GitHub](https://github.com/JuliaLang/julia)
- implementations for all common operating systems
*high-performance programming language for technical computing*
: - many functions for *scientific computing* built-in,
***high-performance programming language for technical computing***
- many functions for *scientific computing* built-in,
- (intentional) similarity to Python, R and Matlab,
- complex calculations in a few lines
- simple interface to other languages like C or Python
*a JIT compiler*
: - interactive work possible: `read-eval-print loop (REPL)` with
***a JIT compiler***
- interactive work possible: `read-eval-print loop (REPL)` with
- just-in-time (JIT) compilation
- thereby runtimes comparable to static languages like C/C++, Fortran or Rust
*a built-in package manager*
: - huge *ecosystem* of easily installable packages, e.g.
- [Mathematical Optimization](https://jump.dev/)
- [Machine Learning](https://fluxml.ai/)
- [Data Visualization](https://docs.makie.org/stable/)
- [Differential Equations](https://docs.sciml.ai/DiffEqDocs/stable/)
- [Mathematical Modeling](https://sciml.ai/)
***a built-in package manager***
- huge *ecosystem* of easily installable packages, e.g.
- [Mathematical Optimization](https://jump.dev/)
- [Machine Learning](https://fluxml.ai/)
- [Data Visualization](https://docs.makie.org/stable/)
- [Differential Equations](https://docs.sciml.ai/DiffEqDocs/stable/)
- [Mathematical Modeling](https://sciml.ai/)
## A Small Selection of Online Materials on Julia {.unnumbered}
## Selected Links {.unnumbered}
- [Documentation](https://docs.julialang.org/en/v1/) - the official documentation
- [Cheat Sheet](https://cheatsheet.juliadocs.org/) - "a quick & dirty overview"
- [Introducing Julia](https://en.wikibooks.org/wiki/Introducing_Julia)-- a WikiBook
- [The Julia Express](http://bogumilkaminski.pl/files/julia_express.pdf) - short version, Julia in 16 pages
- [Think Julia](https://benlauwens.github.io/ThinkJulia.jl/latest/book.html) - introduction to programming with Julia as a language
- [Documentation](https://docs.julialang.org/en/v1/) -- the official documentation
- [Cheat Sheet](https://cheatsheet.juliadocs.org/) -- "a quick & dirty overview"
- [Introducing Julia](https://en.wikibooks.org/wiki/Introducing_Julia) -- a WikiBook
- [The Julia Express](http://bogumilkaminski.pl/files/julia_express.pdf) -- Julia in 16 pages
- [Think Julia](https://benlauwens.github.io/ThinkJulia.jl/latest/book.html) -- introduction to programming using Julia as first language
- The [Julia Forum](https://discourse.julialang.org/)
- For the eyes: [Examples for the Julia graphics package `Makie`](https://beautiful.makie.org/)