Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • stammbn/julia-seminar
1 result
Select Git revision
Show changes
Commits on Source (13)
......@@ -8,3 +8,4 @@
*.jl.*.cov
.ipynb_checkpoints
*.gif
Manifest.toml
%% Cell type:markdown id:7aad3586-d57e-4000-8688-aa5b53d48416 tags:
# Basics
%% Cell type:markdown id:aff6c2f6-3d10-412e-82aa-c199c98edbd7 tags:
# Grundlagen
%% Cell type:markdown id:bf904dbe-3197-4a91-bbb8-05e1c7f7dfee tags:
## Variables and elementary types
Defining variables in Julia works like in most languages:
%% Cell type:markdown id:3be02b91-9619-4cfd-b463-2add42babbcc tags:
## Variablen und elementare Datentypen
Das Definieren von Variablen in Julia funktioniert wie in den meisten Sprachen:
%% Cell type:code id:3c44023b-06c9-4420-9af3-da2ec37b02da tags:
``` julia
int = 4 # An integer
```
%% Cell type:code id:b2f9ba27-bf65-40d8-b0ac-e3d86c99dd40 tags:
``` julia
str = "Hi" # A string
```
%% Cell type:code id:87a83355-5088-47d3-b698-2c6902aaa6a0 tags:
``` julia
float = 1.2 # A floating-point number
```
%% Cell type:code id:597523f1-4041-4fc6-9be2-2c94a93fd633 tags:
``` julia
bool = true # A boolean (also false)
```
%% Cell type:markdown id:0c538bdb-f995-4589-bee7-0989c922090c tags:
The type is automatically inferred:
%% Cell type:markdown id:816bc593-70cc-4e0f-b461-c9022d9587f6 tags:
Der Typ wird automatisch abgeleitet:
%% Cell type:code id:b80c6777-3dea-4f45-98b3-0a3eee196183 tags:
``` julia
typeof(int)
```
%% Cell type:code id:1fb6cbd2-871f-40a4-ae84-e7ee46e75a61 tags:
``` julia
typeof(str)
```
%% Cell type:code id:a16a6f08-f19a-42e0-baac-aaa88ebba1af tags:
``` julia
typeof(float)
```
%% Cell type:markdown id:09d035eb-22aa-49f5-9fd1-a5b16973f386 tags:
Julia supports a large range of integer and floating-point types out of the box, for example:
%% Cell type:markdown id:d5e586cc-874a-46d5-9c7c-d1136d73492e tags:
Julia unterstützt von Haus aus eine große Bandbreite von Ganzzahl- und Gleitkommazahlentypen, zum Beispiel:
%% Cell type:code id:88f24b01-f4a5-4030-af2c-a5d30223d047 tags:
``` julia
x = UInt8(1) # 8-bit wide unsigned integer
y = Int32(-1) # 32-bit wide signed integer
z = Float32(0.2) # single precision
α = Float16(-1.0) # half precision
β = ComplexF64(2. + 8im) # Complex number (composed of two Float64)
```
%% Cell type:markdown id:a615bbc0-732e-461f-8c4c-a972fa2be731 tags:
If you give a variable an illegal name, you get a syntax error:
%% Cell type:markdown id:bf9f6efc-6b47-415c-8504-35a2b1a80f18 tags:
Wenn Sie einer Variable einen ungültigen Namen geben, erhalten Sie einen Syntaxfehler:
%% Cell type:code id:1ca20515-6d66-40c3-84f1-2e24ece096cd tags:
``` julia
1test = "hello"
```
%% Cell type:code id:2c61f59e-2c2f-4049-8624-35e0712b2cf1 tags:
``` julia
more@ = 1000000
```
%% Cell type:code id:85040b19-b0a9-4baa-8748-5ea62f8b5633 tags:
``` julia
struct = "another illegale variable name"
```
%% Cell type:markdown id:cc36688b-c983-43f8-8bdf-9b82aae59909 tags:
It turns out that `struct` is one of Julia’s keywords, and they cannot be used as variable names.
- For more Julia's keywords, see [https://docs.julialang.org/en/v1/base/base/#Keywords](https://docs.julialang.org/en/v1/base/base/#Keywords).
- For more details on `Variable`, see [https://docs.julialang.org/en/v1/manual/variables/](https://docs.julialang.org/en/v1/manual/variables/).
%% Cell type:markdown id:2e5659b9-9e66-448a-a768-23d7085d7dac tags:
Es stellt sich heraus, dass `struct` eines der Schlüsselwörter von Julia ist und nicht als Variablennamen verwendet werden kann.
- Für weitere Schlüsselwörter von Julia, siehe [https://docs.julialang.org/en/v1/base/base/#Keywords](https://docs.julialang.org/en/v1/base/base/#Keywords).
- Für weitere Details über `Variable`, siehe [https://docs.julialang.org/en/v1/manual/variables/](https://docs.julialang.org/en/v1/manual/variables/).
%% Cell type:markdown id:de111dbe-f7ed-4e1a-8ec0-c5e65bd63bbf tags:
### Strings
%% Cell type:markdown id:e099c88a-5848-4730-be7d-b7651bc3db29 tags:
### Zeichenketten
%% Cell type:markdown id:1b3531e9-33db-4c51-b394-c1def6621519 tags:
In general, you can’t perform mathematical operations on strings, even if the strings look like numbers, so the following are illegal:
%% Cell type:markdown id:925cbca6-cce3-4084-96a2-fe0a5acdb1e9 tags:
Im Allgemeinen können Sie mathematische Operationen nicht auf Zeichenketten ausführen, auch wenn die Zeichenketten wie Zahlen aussehen. Daher sind die folgenden Operationen nicht erlaubt:
%% Cell type:code id:246f1db8-d734-413d-9237-b2434e071914 tags:
``` julia
"2" - "1"
"eggs" / "easy"
"third" + "a charm"
```
%% Cell type:markdown id:c94f1187-67f8-473e-910c-2eb145ed59dd tags:
But there are two exceptions, * and ^.
%% Cell type:markdown id:c2c39aa8-d98b-42dd-8e7c-09463f78d22c tags:
Es gibt jedoch zwei Ausnahmen, * und ^.
%% Cell type:code id:b3a0f6e1-e28b-4fb7-baa3-bb003de3dc24 tags:
``` julia
"Hello " * "world"
```
%% Cell type:code id:0c963c3c-47c7-4805-8be6-621b72fdb62e tags:
``` julia
"hello! "^5
```
%% Cell type:markdown id:362f9d04-eff9-4594-aa22-a9c8d601fb1e tags:
For more details: [https://docs.julialang.org/en/v1/manual/strings/](https://docs.julialang.org/en/v1/manual/strings/).
%% Cell type:markdown id:7b7ff4e3 tags:
Für weitere Details: [https://docs.julialang.org/en/v1/manual/strings/](https://docs.julialang.org/en/v1/manual/strings/).
%% Cell type:markdown id:61ff8194-669c-4ece-ba31-44e88ed808ac tags:
### Exercises
%% Cell type:markdown id:43fe0add-b90d-4ed4-862e-37a4361d2354 tags:
### Übungen
%% Cell type:markdown id:e0aecc9c-e77f-449e-8aff-e1ffcf5d7833 tags:
Practice using Julia as a calculator:
- The volume of a sphere with radius r is 4/3πr^3. What is the volume of a sphere with radius 5?
%% Cell type:markdown id:3e392c67-df83-49fc-831d-12e157e4a85c tags:
Üben Sie, Julia als Taschenrechner zu verwenden:
- Die Formel für das Volumen einer Kugel mit Radius r lautet 4/3πr^3. Was ist das Volumen einer Kugel mit Radius 5?
%% Cell type:code id:fc538246-418c-4ebe-b487-81feba4383c8 tags:
``` julia
```
%% Cell type:markdown id:10f1604d-8e81-4f96-8b6f-95753f0b5c4f tags:
- Suppose the cover price of a book is 24.95, but bookstores get a 40 % discount. Shipping costs 3 for the first copy and 75 cents for each additional copy. What is the total wholesale cost for 60 copies?
%% Cell type:markdown id:32f7a6f1-6a19-4ebe-bd1b-846f861dc721 tags:
- Angenommen, der Listenpreis eines Buches beträgt 24,95, aber Buchhandlungen erhalten einen Rabatt von 40 %. Der Versand kostet 3 für das erste Exemplar und 75 Cent für jedes zusätzliche Exemplar. Was sind die gesamten Großhandelskosten für 60 Exemplare?
%% Cell type:code id:bd4150cf-005a-4087-aa92-5f4b18e4d197 tags:
``` julia
```
%% Cell type:markdown id:dc9cddb9-717d-4ba0-b478-beb00afc46c8 tags:
## Conditionals and Boolean Expressions
A boolean expression is an expression that is either true or false. The following examples use the operator ==, which compares two operands and produces true if they are equal and false otherwise:
%% Cell type:markdown id:53e26ee8-c10d-42e4-bbb9-cb5f696139ba tags:
## Bedingungen und boolesche Ausdrücke
Ein boolescher Ausdruck ist ein Ausdruck, der entweder wahr oder falsch ist. Die folgenden Beispiele verwenden den Operator ==, der zwei Operanden vergleicht und true zurückgibt, wenn sie gleich sind, andernfalls false:
%% Cell type:code id:7de4ffe9-4730-47dd-b074-1525bf9937b1 tags:
``` julia
5 == 5
```
%% Cell type:code id:c02939dd-6f25-4916-8394-a5f95d0200df tags:
``` julia
5 == 6
```
%% Cell type:markdown id:9a108e63-7d58-489d-b7ef-49629c879d29 tags:
The == operator is one of the relational operators; the others are:
%% Cell type:markdown id:4722b7b7-3f80-454f-bd8b-f67912105f79 tags:
Der == Operator ist einer der relationalen Operatoren; die anderen sind:
%% Cell type:code id:b59cd314-fd03-4609-ac1b-7329a2c3cc38 tags:
``` julia
x = 3; y = 4
x != y # x is not equal to y
x ≠ y # (to get the ≠ symbol, type \ne and then press TAB)
x > y # x is greater than y
x < y # x is less than y
x >= y # x is greater than or equal to y
x ≥ y # (to get the ≥ symbol, type \ge and then press TAB)
x <= y # x is less than or equal to y
x ≤ y # (to get the ≤ symbol, type \le and then press TAB)
```
%% Cell type:markdown id:15e20f55-1a43-4d0d-94bc-d2de0ee2fe8c tags:
There are three logical operators: && (and), || (or), and ! (not). The semantics (meaning) of these operators is similar to their meaning in English. For example, x > 0 && x < 10 is true only if x is greater than 0 and less than 10.
%% Cell type:markdown id:01c9f186-294f-4659-bc32-cee3b6ff4f40 tags:
Es gibt drei logische Operatoren: && (und), || (oder) und ! (nicht). Die Bedeutung dieser Operatoren entspricht weitgehend ihrer Bedeutung im Englischen. Zum Beispiel ist x > 0 && x < 10 nur dann wahr, wenn x größer als 0 und kleiner als 10 ist.
%% Cell type:code id:d1e6e2ce-bb0c-4776-80b6-22ceb9c68397 tags:
``` julia
x = 4
x > 0 && x < 10
```
%% Cell type:markdown id:da591654-6360-4f56-956b-07493d1d2247 tags:
It is also worth mentioning that in combined logical expression not all conditions are necessarily executed.
%% Cell type:markdown id:857cde91-3430-480c-9f24-bb9c465248d9 tags:
Es ist auch erwähnenswert, dass bei kombinierten logischen Ausdrücken nicht alle Bedingungen notwendigerweise ausgeführt werden.
%% Cell type:code id:e92abf7b-5414-4aee-abaf-a4e52b1c06d3 tags:
``` julia
true || println("The RHS of || is only run")
false || println("if the LHS is false")
```
%% Cell type:code id:c8a9d8ac-5378-4ebb-810b-9ae3194d670c tags:
``` julia
iseven(3) && println("The RHS of || is only run")
isodd(3) && println("if the LHS is true")
```
%% Cell type:markdown id:be0c63e0-35a9-43c7-9b30-d04072ee6904 tags:
Finally, the ! operator negates a boolean expression, so !(x > y) is true if x > y is false, that is, if x is less than or equal to y.
%% Cell type:markdown id:d8db49a8-6c6c-4abf-9a5b-5d27765ab1c7 tags:
Schließlich kehrt der ! Operator einen booleschen Ausdruck um, sodass !(x > y) wahr ist, wenn x > y falsch ist, das heißt, wenn x kleiner oder gleich y ist.
%% Cell type:code id:e43ab736-03e2-4040-a15e-48305037ba23 tags:
``` julia
x = 4
!(x > 0 && x < 10)
```
%% Cell type:markdown id:7064ae20-6d63-40fc-85c5-080ace54e7b6 tags:
Unsurprisingly Julia has the standard conditionals.
%% Cell type:markdown id:fbe0d04d-29c9-4bd0-9cfb-0c57a3b3f877 tags:
Es überrascht nicht, dass Julia die üblichen Bedingungsanweisungen hat.
%% Cell type:code id:4f140e2c-a240-496d-904c-c60778397bcf tags:
``` julia
x = 3; y = 5
if x < y
println("x is less than y")
elseif x > y
println("x is greater than y")
else
println("x is equal to y")
end
```
%% Cell type:markdown id:4c57139e-da0c-48ef-a86f-4de80e1d7ca4 tags:
There is also an inline conditional.
%% Cell type:markdown id:64a3bf26-156f-40a8-8d8c-d4b2f838ef95 tags:
Es gibt auch eine bedingte Inline-Anweisung.
%% Cell type:code id:9d0801fd-b0d3-41e0-8b54-19a6b4539231 tags:
``` julia
x = 3
x < 5 ? "smaller than 5" : "larger or equal 5"
```
%% Cell type:markdown id:b597c363-8066-470e-b1c8-edd00b114317 tags:
For more details: [https://docs.julialang.org/en/v1/manual/control-flow/](https://docs.julialang.org/en/v1/manual/control-flow/).
%% Cell type:markdown id:2539a6ec-e950-4b76-ad13-4ac9bb28ec26 tags:
Für weitere Details siehe: [https://docs.julialang.org/en/v1/manual/control-flow/](https://docs.julialang.org/en/v1/manual/control-flow/)
%% Cell type:markdown id:e4510840-0890-4217-8a8c-c24aa5d3405b tags:
## Iterations
Julia implements the standard for and while constructs.
%% Cell type:markdown id:7c8eb301-3404-4d13-bc5d-f4e2f71cfa12 tags:
## Iterationen
Julia implementiert die üblichen for- und while-Strukturen.
%% Cell type:code id:9632f210-c713-4829-8187-cf5554adad87 tags:
``` julia
for i in 1:5
println("Hello from number $i")
end
```
%% Cell type:markdown id:f00caf15-4992-4c0a-8324-9d2be966346d tags:
Where the `1:5` is a `Range`-object, but it could be any iterable. There are a few syntax variations, including:
%% Cell type:markdown id:d0933cf7-b409-4c40-8184-70d0770a06b1 tags:
Dabei ist `1:5` ein `Range`-Objekt, aber es könnte jede Art von iterierbarem Objekt sein. Es gibt einige syntaktische Variationen, einschließlich:
%% Cell type:code id:70a9f620-e4ce-4367-b0f5-de37db3f48b5 tags:
``` julia
result = 0
# To get ∈ write \in and then press TAB
for j ∈ 1:0.5:3 # Note the step parameter
result += j
end
println(result)
```
%% Cell type:code id:e83b2d88-b0f2-43f1-9187-65fbc75f0d3b tags:
``` julia
n = 10
while n > 0
print(n, " ")
n = n - 1
end
```
%% Cell type:markdown id:f19d5051-ce82-49cc-80aa-2434a6adc9d0 tags:
The loops can be further controlled with the `break` and `continue` keywords.
%% Cell type:markdown id:76563c39-4e45-4daf-b703-575909f70787 tags:
Die Schleifen können mit den Schlüsselwörtern `break` und `continue` weiter gesteuert werden.
%% Cell type:markdown id:d0ebce97-3054-4eba-821d-92f27793d752 tags:
Sometimes you don’t know it’s time to end a loop until you get half way through the body. In that case you can use the `break` statement to jump out of the loop.
%% Cell type:markdown id:b38f525d-db83-4fbf-808c-bf39080650f5 tags:
Manchmal weiß man nicht, wann es an der Zeit ist, eine Schleife zu beenden, bis man sich bereits in der Mitte des Schleifenkörpers befindet. In diesem Fall können Sie das `break`-Statement verwenden, um aus der Schleife auszubrechen.
%% Cell type:code id:9bb642e3-e3b1-488d-939f-6932feb62479 tags:
``` julia
while true
print("> ")
line = readline()
if line == "done"
break
end
println(line)
end
println("Done!")
```
%% Cell type:markdown id:98eee547-21fe-4022-bde5-b02ababa26dd tags:
The `break` statement exits the loop. When a `continue` statement is encountered inside a loop, control jumps to the beginning of the loop for the next iteration, skipping the execution of statements inside the body of the loop for the current iteration. For example:
%% Cell type:markdown id:873c3625-3b99-48e5-9821-9b696a8f8a12 tags:
Das `break`-Statement beendet die Schleife. Wenn ein `continue`-Statement in einer Schleife auftritt, springt die Kontrolle zum Anfang der Schleife für die nächste Iteration, wobei die Ausführung der Anweisungen im Körper der Schleife für die aktuelle Iteration übersprungen wird. Zum Beispiel:
%% Cell type:code id:7f1c2595-8836-4308-9769-f4140d402582 tags:
``` julia
for i in 1:10
if i % 3 == 0
continue
end
print(i, " ")
end
```
%% Cell type:markdown id:b8eac9e9-dff9-4b86-88a7-e14f27b7f677 tags:
For more detials: [https://docs.julialang.org/en/v1/base/collections/#lib-collections-iteration](https://docs.julialang.org/en/v1/base/collections/#lib-collections-iteration).
%% Cell type:markdown id:d2e93721 tags:
Für weitere Details: [https://docs.julialang.org/en/v1/base/collections/#lib-collections-iteration](https://docs.julialang.org/en/v1/base/collections/#lib-collections-iteration).
%% Cell type:markdown id:990cefae-abfe-4649-8d68-3fac1b1e268b tags:
### Exercises
%% Cell type:markdown id:625f1e1b-ab4d-425d-b848-94385ddcb690 tags:
### Übungen
%% Cell type:markdown id:bdb2eef9-bdee-4cf3-8bab-d6c1d46ecc2f tags:
The mathematician Srinivasa Ramanujan found an infinite series that can be used to generate a numerical approximation of 1/π
$$ \frac{1}{\pi} = \frac{2\sqrt{2}}{9801} \sum_{k=0}^\infty \frac{(4k)! (1103 + 26390 k)}{(k!)^4 396^{4 k}}$$
Use this formula to compute an estimate of π. It should use a while loop ot compute terms of the summation untile the last term is smaller than 1e-15. Afterwards, you can check the result by comparing it to π (to get π in Julia, write \pi and then press TAB).
%% Cell type:markdown id:6a0dcd06-0926-4529-ac33-0aee315f85cf tags:
Der Mathematiker Srinivasa Ramanujan fand eine unendliche Reihe, die verwendet werden kann, um eine numerische Näherung von 1/π zu generieren:
$$ \frac{1}{\pi} = \frac{2\sqrt{2}}{9801} \sum_{k=0}^\infty \frac{(4k)! (1103 + 26390 k)}{(k!)^4 396^{4 k}}$$
Verwenden Sie diese Formel, um eine Schätzung von π zu berechnen. Sie sollte eine While-Schleife verwenden, um die Terme der Summation zu berechnen, bis der letzte Term kleiner als 1e-15 ist. Anschließend können Sie das Ergebnis überprüfen, indem Sie es mit π vergleichen (um π in Julia zu erhalten, schreiben Sie \pi und drücken dann die TAB-Taste).
%% Cell type:code id:9243c8ee-b3b9-4e23-a829-d20fc8bf0b16 tags:
``` julia
```
%% Cell type:markdown id:d4a870c3-7679-4775-94ce-4e7266a2bebe tags:
## Functions
%% Cell type:markdown id:e2072b09-53e0-4354-984b-13813e93fef1 tags:
## Funktionen
%% Cell type:markdown id:682a3feb-0b82-479d-9803-3011a1e6e521 tags:
We have already seen one example of a function call:
%% Cell type:markdown id:8fde350c-f73a-44b7-9459-b8f6d79120cf tags:
Wir haben bereits ein Beispiel für einen Funktionsaufruf gesehen:
%% Cell type:code id:addaa346-7a88-4c18-9f1e-295665959a9d tags:
``` julia
println("Hello, World!")
```
%% Cell type:markdown id:3434842c-2af0-4f6a-a70b-a59fb8fcc4af tags:
The name of the function is println. The expression in parentheses is called the argument of the function.
It is common to say that a function “takes” an argument and “returns” a result. The result is also called the return value.
%% Cell type:markdown id:ef1e8206-add5-49f9-ab4c-4b730164aee6 tags:
Der Name der Funktion ist println. Der Ausdruck in Klammern wird als Argument der Funktion bezeichnet.
Es ist üblich zu sagen, dass eine Funktion ein Argument "nimmt" und ein Ergebnis "zurückgibt". Das Ergebnis wird auch als Rückgabewert bezeichnet.
%% Cell type:markdown id:f63d270a-7149-4ffd-bc31-f746560a37ac tags:
Julia provides functions that convert values from one type to another. The parse function takes a string and converts it to any number type, if it can, or complains otherwise:
%% Cell type:markdown id:bd083417-b51a-4f0e-a150-56a0f9c33569 tags:
Julia bietet Funktionen, die Werte von einem Typ in einen anderen konvertieren. Die Funktion `parse` nimmt einen String und wandelt ihn in jeden Zahlen-Typ um, wenn es möglich ist, oder gibt andernfalls eine Fehlermeldung aus:
%% Cell type:code id:1f05465a-4863-4205-9c73-26f0e93f049b tags:
``` julia
parse(Int64, "32")
```
%% Cell type:code id:e6ac9994-9cbb-4004-889d-a657b8396063 tags:
``` julia
parse(Int64, "Hello")
```
%% Cell type:markdown id:793c9620-7b6e-443c-8765-8136fbfcb071 tags:
Julia provides several mathematical functions.
- abs, sqrt, cbrt, exp, log, log10, log2
- sin, cos, tan, asin, acos, atan
- sinh, cosh, tanh, asinh, acosh, atanh
- floor: Largest integer not greater than x.
- ceil: Smallest integer not less than x.
- round: Nearest integer to x.
- trunc: Integer part of x.
For more details: [https://docs.julialang.org/en/v1/base/math/#Mathematical-Functions](https://docs.julialang.org/en/v1/base/math/#Mathematical-Functions).
%% Cell type:markdown id:9176592b-e9f3-46fd-9909-8b73da750434 tags:
Julia stellt verschiedene mathematische Funktionen zur Verfügung:
- abs, sqrt, cbrt, exp, log, log10, log2
- sin, cos, tan, asin, acos, atan
- sinh, cosh, tanh, asinh, acosh, atanh
- floor: Größte ganze Zahl, die nicht größer als x ist.
- ceil: Kleinste ganze Zahl, die nicht kleiner als x ist.
- round: Nächstgelegene ganze Zahl zu x.
- trunc: Ganzzahliger Teil von x.
Für weitere Details: [https://docs.julialang.org/en/v1/base/math/#Mathematical-Functions](https://docs.julialang.org/en/v1/base/math/#Mathematical-Functions).
%% Cell type:markdown id:d048851b-8eac-4dc3-81b7-ea1d625a1db2 tags:
So far, we have only been using the functions that come with Julia, but it is also possible to add new functions.
Defining functions follows a rather intuitive syntax. The value obtained by evaluating the last expression of a `function` block will be automatically returned:
%% Cell type:markdown id:f43cb468-832a-4cab-b8a3-15bb9bcbfb0d tags:
Bisher haben wir nur die Funktionen verwendet, die mit Julia geliefert werden, aber es ist auch möglich, neue Funktionen hinzuzufügen.
Die Definition von Funktionen folgt einer recht intuitiven Syntax. Der Wert, der durch Auswerten des letzten Ausdrucks eines `function`-Blocks erhalten wird, wird automatisch zurückgegeben:
%% Cell type:code id:fd2f4828-47f5-4df4-b5bd-a42625487b5a tags:
``` julia
function mymult(x, y)
x * y
end
```
%% Cell type:markdown id:08bab11e-df61-4906-a925-b93184e5c600 tags:
For one-line functions one may also use a convenient short-hand:
%% Cell type:markdown id:e8dfb238-54be-4a95-9eda-4ce1fa5cfd74 tags:
Für Einzeiler-Funktionen kann man auch eine praktische Kurzschreibweise verwenden:
%% Cell type:code id:5ed8292a-96e2-49ad-8f00-3c07b9483637 tags:
``` julia
mysquare(x) = mymult(x, x)
```
%% Cell type:markdown id:13b7892e-df8a-462f-a84c-107276d8e499 tags:
Both such functions are fully generic in the argument types
%% Cell type:markdown id:9b688bbf-08b6-4fba-babe-b16b6e1119be tags:
Für Einzeiler-Funktionen kann man auch eine praktische Kurzschreibweise verwenden:
%% Cell type:code id:49ceeeff-5291-460d-800d-5ed11a03b13e tags:
``` julia
@show mysquare(2) # Use integer arithmetic
@show mymult(-1, 3. + 2im) # Use complex arithmetic
@show mysquare(" abc "); # Use string concatenation
```
%% Cell type:markdown id:15ece147-0384-4c1b-a8c3-d11a795bd1b7 tags:
Notice, that for each type combination a separate piece of code will be compiled even though we only *defined* the functionality a single time. This compilation takes place on first use of a particular tuple of types.
%% Cell type:markdown id:6add8ab6-7f66-431b-9e9e-e52d45379483 tags:
Beachten Sie, dass für jede Kombination von Typen ein separater Codeabschnitt kompiliert wird, obwohl wir die Funktionalität nur einmal *definiert* haben. Diese Kompilierung findet beim ersten Gebrauch eines bestimmten Tupels von Typen statt.
%% Cell type:code id:7e5dcfeb-960a-47f3-b2f8-f6f0906d2f24 tags:
``` julia
mymult
```
%% Cell type:markdown id:934dc8e8-564b-4566-9eb0-a96df39f0870 tags:
and may be passed around to other functions, for example:
%% Cell type:markdown id:3be89ab5-16f3-4633-bb8d-fd74cf39ddec tags:
und können an andere Funktionen übergeben werden, zum Beispiel:
%% Cell type:code id:171b1a83-c076-4ac4-a309-9d607ea0b5a4 tags:
``` julia
"""The fold function, applying f from the left and accumulating the results"""
function myfold(f, x, y, z)
f(f(x, y), z)
end
myfold(mymult, "Hello", " Julia ", "World")
```
%% Cell type:markdown id:f31327e4-5d69-4dfb-a4bf-ed1e419b1be3 tags:
Julia makes a distinction between **functions** and **methods**. Roughly speaking **function**s specify *what* is done and **methods** specify *how* this is done.
Methods are concrete implementations in form of a list of Julia expressions to be executed, when the function name is used in the code. Multiple methods may be defined for the same function name. They differ in the number of arguments or in the supported argument types (more on this in the next notebook). When a particular function name is used in the code, Julia looks at the types of the arguments and uses this information to **dispatch** to the best-fitting method.
For our `myfold` example, one could easily imagine a few more method implementations, for example:
%% Cell type:markdown id:09a40182-e59f-42e4-b11e-0c3aedd0e7a6 tags:
Julia unterscheidet zwischen **Funktionen** und **Methoden**. Grob gesagt geben **Funktionen** an, *was* gemacht wird, und **Methoden** geben an, *wie* dies gemacht wird.
Methoden sind konkrete Implementierungen in Form von einer Liste von Julia-Ausdrücken, die ausgeführt werden, wenn der Funktionsname im Code verwendet wird. Für den gleichen Funktionsnamen können mehrere Methoden definiert werden. Sie unterscheiden sich in der Anzahl der Argumente oder in den unterstützten Argumenttypen (dazu mehr im nächsten Notebook). Wenn ein bestimmter Funktionsname im Code verwendet wird, betrachtet Julia die Typen der Argumente und verwendet diese Informationen, um zur am besten passenden Methode zu **dispatchen**.
Für unser `myfold`-Beispiel könnte man sich leicht einige weitere Methodenimplementierungen vorstellen, zum Beispiel:
%% Cell type:code id:c249f818-6544-42fe-b387-34058e5f5890 tags:
``` julia
myfold(f, x) = x
myfold(f, x, y) = f(x, y)
```
%% Cell type:code id:88f62159-2a1b-4a5a-8434-0e91810f2c69 tags:
``` julia
methods(myfold)
```
%% Cell type:markdown id:879d9441-ece1-4f07-a496-6aef71fd2e91 tags:
So now `myfold` works transparently with 1, 2 or 3 arguments:
%% Cell type:markdown id:cc818df4-a037-4ba2-8588-1afe4a6de222 tags:
Nun funktioniert `myfold` transparent mit 1, 2 oder 3 Argumenten:
%% Cell type:code id:d67f9c21-2c5c-43fd-a7e4-a4ce74281bf0 tags:
``` julia
@show myfold(mymult, 2., 3.)
@show myfold(+, 1)
@show myfold(==, false, false, true)
```
%% Cell type:markdown id:59fa4c2a-a1fa-4a1b-9529-68f821589206 tags:
We can also check which method is actually employed using the `@which` macro:
%% Cell type:markdown id:5a9a652b-80c4-482f-80b8-2c5340e61a21 tags:
Wir können auch überprüfen, welche Methode tatsächlich verwendet wird, indem wir das `@which`-Makro verwenden:
%% Cell type:code id:0fa105fb-b3ad-405a-85f1-598a12cbc655 tags:
``` julia
@which myfold(*, 1, 2)
```
%% Cell type:markdown id:73fa3be7-67a8-4817-9d94-e04765513dd3 tags:
Standard functions (like `+` or `*`) are by no means special and behave exactly the same way as custom functions ... including the ability to define new methods for them:
%% Cell type:markdown id:4046d2e8-2018-4f4f-b816-2a6156301f39 tags:
Standardfunktionen (wie `+` oder `*`) sind keineswegs speziell und verhalten sich genau wie benutzerdefinierte Funktionen ... einschließlich der Möglichkeit, neue Methoden für sie zu definieren:
%% Cell type:code id:d771af33-5174-4a95-b8e3-ac1c29eb71e9 tags:
``` julia
import Base: + # we have to import functions to override/extend them
+(x::String, y::String) = x * " " * y
```
%% Cell type:code id:32429003-4879-4a37-ad3c-153857a360dd tags:
``` julia
"Hello" + "World!"
```
%% Cell type:markdown id:8fdf6362-7ca3-4d32-a542-26df56b83108 tags:
(**Important note:** Since we neither own the `+` function nor the `String` type, this is known as **type piracy** and should in general be avoided!)
%% Cell type:markdown id:ee25eff6-f56e-4230-b52d-6020dcc29bb2 tags:
(**Wichtiger Hinweis:** Da wir weder die `+` Funktion noch den `String` Typ besitzen, handelt es sich hierbei um **Typenpiraterie** und sollte im Allgemeinen vermieden werden!)
%% Cell type:markdown id:89ffcdef-cf06-438f-8448-4bf6dfd1af7e tags:
Now standard functions relying on `+` just magically work:
%% Cell type:markdown id:a2c9d8cf-0462-415c-a466-edb33b3aadec tags:
Nun funktionieren Standardfunktionen, die auf `+` angewiesen sind, einfach magisch:
%% Cell type:code id:75b4afeb-a3f4-40d7-8b23-b961b01c41bc tags:
``` julia
sum(["a", "b", "c", "d", "e"])
```
%% Cell type:markdown id:d8edaaf0-3de7-4a63-b0bd-bff53ba060f4 tags:
Variables and parameters are local, they exist only inside the functions where they are defined:
%% Cell type:markdown id:013b3faf-5f12-482b-956e-de97a2a4830d tags:
Variablen und Parameter sind lokal, sie existieren nur innerhalb der Funktionen, in denen sie definiert sind:
%% Cell type:code id:d02e6bca-6723-4a05-82ee-1f30ba127bd5 tags:
``` julia
function multiply_and_print(a, b)
product = a * b
println(product)
end
multiply_and_print(2, 3)
println(product)
```
%% Cell type:markdown id:29968f96-5766-4cb7-8538-3bef9aeb8cc9 tags:
It may not be clear why it is worth the trouble to divide a program into functions. There are several reasons:
- Creating a new function gives you an opportunity to name a group of statements, which makes your program easier to read and debug.
- Functions can make a program smaller by eliminating repetitive code. Later, if you make a change, you only have to make it in one place.
- Dividing a long program into functions allows you to debug the parts one at a time and then assemble them into a working whole.
- Well-designed functions are often useful for many programs. Once you write and debug one, you can reuse it.
- In Julia, functions can improve performance a lot.
%% Cell type:markdown id:0a398295-22e0-45dc-b43c-5f1915a16364 tags:
Es mag nicht klar sein, warum es sich lohnt, ein Programm in Funktionen zu unterteilen. Es gibt mehrere Gründe dafür:
- Das Erstellen einer neuen Funktion bietet Ihnen die Möglichkeit, eine Gruppe von Anweisungen zu benennen, was Ihr Programm leichter lesbar und einfacher zu debuggen macht.
- Funktionen können ein Programm kleiner machen, indem sie wiederholten Code eliminieren. Später, wenn Sie eine Änderung vornehmen, müssen Sie sie nur an einer Stelle vornehmen.
- Das Aufteilen eines langen Programms in Funktionen ermöglicht es Ihnen, die Teile nacheinander zu debuggen und dann zu einem funktionierenden Ganzen zusammenzufügen.
- Gut gestaltete Funktionen sind oft für viele Programme nützlich. Sobald Sie eine geschrieben und debuggt haben, können Sie sie wiederverwenden.
- In Julia können Funktionen die Leistung erheblich verbessern.
%% Cell type:markdown id:7780ae66-db68-48c1-ba62-a883406f1f1c tags:
More details: [https://docs.julialang.org/en/v1/manual/methods/](https://docs.julialang.org/en/v1/manual/methods/)
%% Cell type:markdown id:dfa722c2-bd4c-4162-b10d-24c0f8e990e0 tags:
Weitere Details finden Sie unter: [https://docs.julialang.org/en/v1/manual/methods/](https://docs.julialang.org/en/v1/manual/methods/)
%% Cell type:markdown id:d914b36b-8b05-4c68-bf57-1fc74aeb26df tags:
### Exercises
%% Cell type:markdown id:a4eafce6-b493-470f-86a3-93319684ee40 tags:
### Übungen
%% Cell type:markdown id:247215e4-47e1-4eb6-978b-a09f14478bb8 tags:
- Write a function `printgrid` that draws a grid like the following:
%% Cell type:markdown id:08fe364b-e611-419b-97f2-e806881d6227 tags:
- Schreiben Sie eine Funktion `printgrid`, die ein Raster wie folgt zeichnet:
%% Cell type:markdown id:1704f451-9500-41c5-b74b-4a2b4a7b910f tags:
+ - - - - + - - - - +
| | |
| | |
| | |
| | |
+ - - - - + - - - - +
| | |
| | |
| | |
| | |
+ - - - - + - - - - +
%% Cell type:code id:58ef3248-f85e-4825-bf10-02cee3e068cb tags:
``` julia
```
%% Cell type:markdown id:e6a58742-9d24-47a5-aa68-73d44ca05127 tags:
- Write a function that draws a similar grid with four rows and four columns.
%% Cell type:markdown id:41f2bf0f-73f4-4671-b059-1118c35ec76f tags:
- Schreiben Sie eine Funktion, die ein ähnliches Raster mit vier Zeilen und vier Spalten zeichnet.
%% Cell type:markdown id:b953857f-e8d7-47aa-bc8d-8e2bd1cd20fd tags:
Tips:
- To print more than one value on a line, you can print a comma-separated sequence of values: println("+", "-").
- The function print does not advance to the next line.
%% Cell type:markdown id:2e606498-6553-4037-a9f9-3b519ffc64c9 tags:
Tipps:
- Um mehr als einen Wert in einer Zeile auszugeben, können Sie eine kommagetrennte Sequenz von Werten ausgeben: println("+", "-").
- Die Funktion print springt nicht zur nächsten Zeile.
%% Cell type:code id:1ca1789d-eddb-4f41-9ad9-9259c6f22a14 tags:
``` julia
```
%% Cell type:markdown id:2ebc911c-7fe0-4d7f-ab5d-d8084f25a93d tags:
### Recursive functions
It is legal for one function to call another; it is also legal for a function to call itself. It may not be obvious why that is a good thing, but it turns out to be one of the most magical things a program can do. For example, look at the following function:
%% Cell type:markdown id:53edcb8b-2f37-404f-8df6-d84b2327e96e tags:
### Rekursive Funktionen
Es ist erlaubt, dass eine Funktion eine andere aufruft; es ist auch erlaubt, dass eine Funktion sich selbst aufruft. Es mag nicht offensichtlich sein, warum das eine gute Sache ist, aber es stellt sich heraus, dass es eine der magischsten Dinge ist, die ein Programm tun kann. Schauen Sie sich zum Beispiel die folgende Funktion an:
%% Cell type:code id:e578011e-d0de-4f86-8c2c-a8408454d3ac tags:
``` julia
function countdown(n)
if n ≤ 0
println("Blastoff!")
else
print(n, " ")
countdown(n-1)
end
end
```
%% Cell type:code id:3af51513-c92e-4488-b2fe-243e2fef6b95 tags:
``` julia
countdown(10)
```
%% Cell type:markdown id:c59c0f54-d967-4416-b57c-e855dfc2c350 tags:
If a recursion never reaches a base case, it goes on making recursive calls forever, and the program never terminates. This is known as infinite recursion, and it is generally not a good idea. Here is a minimal program with an infinite recursion:
%% Cell type:markdown id:73ea203a-3919-4e14-b50f-22c8362eb771 tags:
Wenn eine Rekursion niemals einen Basisfall erreicht, macht sie unendliche rekursive Aufrufe, und das Programm terminiert nie. Dies wird als unendliche Rekursion bezeichnet und ist im Allgemeinen keine gute Idee. Hier ist ein minimales Programm mit einer unendlichen Rekursion:
%% Cell type:code id:13a4a762-6584-47ab-9fb5-428557770d15 tags:
``` julia
function recurse()
recurse()
end
```
%% Cell type:code id:0dde579f-6b12-4072-aa62-aeee3a970503 tags:
``` julia
recurse()
```
%% Cell type:markdown id:22c8c79d-6d41-4758-9550-aaab4f1dc1b1 tags:
### Exercises
- Write a recursive function to compute the factorial of a number.
%% Cell type:markdown id:a0402c3d-95fa-44a1-86ab-ca229508f68f tags:
### Übungen
- Schreiben Sie eine rekursive Funktion zur Berechnung der Fakultät einer Zahl.
%% Cell type:code id:f4102487-011e-474f-ab79-3d7db1d3bbd9 tags:
``` julia
```
%% Cell type:markdown id:d9c31712-941c-4611-99e5-b33cdb12e28f tags:
- Then write a function that computes bynomial coefficients
$$ \left(\begin{array}{c} n \\ k \end{array}\right) = \frac{n!}{k! (n-k)!} $$
by calling the function of the previous points.
%% Cell type:markdown id:a24cdaef-98b8-46f5-a809-992547882a4b tags:
- Schreiben Sie dann eine Funktion, die die Binomialkoeffizienten berechnet
$$ \left(\begin{array}{c} n \\ k \end{array}\right) = \frac{n!}{k! (n-k)!} $$
indem sie die Funktion aus den vorherigen Punkten aufruft.
%% Cell type:code id:b54c877e-5494-4657-ba7f-208bdc301225 tags:
``` julia
```
%% Cell type:markdown id:4509db3f-8060-46ca-89ac-824c16f5751c tags:
- Use the two functions to compute
$$ 15! \qquad \left(\begin{array}{c} 5 \\ 2 \end{array}\right) \qquad \left(\begin{array}{c} 5 \\ 3 \end{array}\right) $$
%% Cell type:markdown id:a32900cc-c244-4d63-8ff6-4d11cee83eee tags:
- Verwenden Sie die beiden Funktionen, um zu berechnen
$$ 15! \qquad \left(\begin{array}{c} 5 \\ 2 \end{array}\right) \qquad \left(\begin{array}{c} 5 \\ 3 \end{array}\right) $$
%% Cell type:code id:fb02aad5-d9d4-4f0d-8118-b02b73506b89 tags:
``` julia
```
%% Cell type:markdown id:240cc4bd-3e45-45b8-ad98-170dbb68f78d tags:
### Keywords argument
Function arguments can be either position based (like what we saw so far) or keyword based, like in the following example.
%% Cell type:markdown id:b5944412-0d39-4c0b-a0d5-fbeee22e1432 tags:
### Schlüsselwortargumente
Funktionsargumente können entweder positionsbasiert (wie wir bisher gesehen haben) oder schlüsselwortbasiert sein, wie im folgenden Beispiel.
%% Cell type:code id:30ddeb3b-be35-40eb-8491-1269a4e19f62 tags:
``` julia
function greet(name; greeting="Hello")
println("$(greeting), $(name)!")
end
```
%% Cell type:code id:b39f22b1-4a1b-4afd-b6db-041bd7150b66 tags:
``` julia
greet("Michele")
greet("Lambert"; greeting="Hallo")
```
%% Cell type:markdown id:52b90aa8-4b19-4371-8fae-2121a78fbb96 tags:
This is quite convenient in the following cases:
- to set a default behavior of the function, while retaining the possibility to finely control it.
- to add at a later point in time new functionality, without breaking retrocompatibility.
%% Cell type:markdown id:07e76016-d5a9-4616-b0b9-2dc9b6f3c8f6 tags:
Dies ist in den folgenden Fällen sehr praktisch:
- um ein Standardverhalten der Funktion festzulegen, während die Möglichkeit besteht, es fein zu steuern.
- um zu einem späteren Zeitpunkt neue Funktionalitäten hinzuzufügen, ohne die Abwärtskompatibilität zu brechen.
%% Cell type:markdown id:c939f951-2aaf-4e39-a60f-df7600af1d8f tags:
## Further Exercises
%% Cell type:markdown id:883b3945-d30a-4f27-928f-458c9ad74e9b tags:
## Weitere Übungen
%% Cell type:markdown id:59e2e997-42f7-426c-bfd0-233724704117 tags:
- Create a function called `fibonacci_sum` that takes a positive integer n as input. This function should return the sum of the first n terms of the Fibonacci sequence.
%% Cell type:markdown id:54537041-60eb-4961-9805-1d7d405fde1a tags:
- Erstellen Sie eine Funktion namens `fibonacci_sum`, die eine positive ganze Zahl n als Eingabe erhält. Diese Funktion sollte die Summe der ersten n Terme der Fibonacci-Folge zurückgeben.
%% Cell type:code id:7ca7c936-fb80-4aed-9788-75a55bb207ad tags:
``` julia
```
%% Cell type:markdown id:49fd546f-009d-46ff-af61-6954000bce5f tags:
- Write a function that converts a Celsius temperature in Fahrenheit and returns the result. Additionally, if the temperature is below freezing (0°C), the program should print a message indicating that it's below freezing.
%% Cell type:markdown id:70dacb25-360f-4a7a-8c03-73cd0d75dc3e tags:
- Schreiben Sie eine Funktion, die eine Celsius-Temperatur in Fahrenheit umrechnet und das Ergebnis zurückgibt. Zusätzlich sollte das Programm, wenn die Temperatur unter dem Gefrierpunkt (0°C) liegt, eine Meldung ausgeben, die anzeigt, dass es unter dem Gefrierpunkt liegt.
%% Cell type:code id:a30a1812-6116-4441-8786-7450c60ef354 tags:
``` julia
```
%% Cell type:markdown id:e2c81cc5-7d0d-4a5a-ba69-81686648df90 tags:
- Write a function which analyzes a sentence. The function should then count and display the number of vowels (both upper and lower case) in the sentence.
%% Cell type:markdown id:8cabe824-c7eb-46fc-afb8-e039528d2d2a tags:
- Schreiben Sie eine Funktion, die einen Satz analysiert. Die Funktion sollte dann die Anzahl der Vokale (sowohl in Groß- als auch in Kleinbuchstaben) im Satz zählen und anzeigen.
%% Cell type:code id:af0e28bd-2b3f-41af-aa92-456e29d50679 tags:
``` julia
```
......
%% Cell type:markdown id:4fe99eff-729a-4d93-ab82-487e5143bae5 tags:
# Advanced Data Types
%% Cell type:markdown id:5de78ecc-bbde-49ff-b618-b8c8c440ce47 tags:
# Fortgeschrittene Datentypen
%% Cell type:markdown id:7969b8f9-335a-4bd2-82f7-1d9795234ed5 tags:
## Dictionaries
%% Cell type:markdown id:8ffb53e2-1813-4fdf-962e-e066bc9b737c tags:
## Wörterbücher
%% Cell type:markdown id:ea8518c1-8e1d-4532-8055-e04c3aa3e7c4 tags:
A dictionary contains a collection of indices, which are called keys, and a collection of values. Each key is associated with a single value. The association of a key and a value is called a key-value pair or sometimes an item.
The function `Dict` creates a new dictionary with no items. Because Dict is the name of a built-in function, you should avoid using it as a variable name.
%% Cell type:markdown id:548487ed-dc9d-4404-a2ab-451c0ea742e4 tags:
Ein Wörterbuch enthält eine Sammlung von Indizes, die als Schlüssel bezeichnet werden, und eine Sammlung von Werten. Jeder Schlüssel ist mit einem einzigen Wert verbunden. Die Zuordnung eines Schlüssels und eines Wertes wird als Schlüssel-Wert-Paar oder manchmal als Element bezeichnet.
Die Funktion `Dict` erstellt ein neues Wörterbuch ohne Elemente. Da Dict der Name einer integrierten Funktion ist, sollte man ihn vermeiden, als Variablenname zu verwenden.
%% Cell type:code id:59ae8d17-a6f6-4210-95bc-0e7492bc8a7a tags:
``` julia
eng2de = Dict()
```
%% Cell type:code id:28490ea3-c4d3-4e4d-915f-612ad36c9472 tags:
``` julia
eng2de["one"] = "ein";
```
%% Cell type:markdown id:f2aff40c-6dcb-421a-b67f-1662c5bf4702 tags:
You can also initialize a dictionary with items as:
%% Cell type:markdown id:09b62b4d-748b-4e1d-91f2-7db610ad02ac tags:
Du kannst auch ein Wörterbuch mit Elementen initialisieren, wie folgt:
%% Cell type:code id:92fc203b-4ba8-432a-a541-c4ccf3292195 tags:
``` julia
eng2de = Dict("one" => "ein", "two" => "zwei", "three" => "drei")
```
%% Cell type:markdown id:c52d24af-ec90-4b8c-bdd9-988129a7fa81 tags:
Dictionaries are mutable, meaning that it is always possible to modify their elements, add new key-value pairs or removing existing ones.
%% Cell type:markdown id:809e7c99-22f0-4440-921d-e5904cadc8a4 tags:
Wörterbücher sind veränderbar, was bedeutet, dass es immer möglich ist, ihre Elemente zu ändern, neue Schlüssel-Wert-Paare hinzuzufügen oder bestehende zu entfernen.
%% Cell type:code id:22b295dc-994e-4bbc-ac8d-da5ab9e73493 tags:
``` julia
eng2de["four"] = "VIER"
@show eng2de
eng2de["four"] = "vier"
@show eng2de
delete!(eng2de, "four")
@show eng2de;
```
%% Cell type:markdown id:01513ad2-3083-4c89-adca-ccc8a88d93d4 tags:
In general, the order of the key-value pairs is unpredictable. However this is not important, as the values are always accessed using the keys.
%% Cell type:markdown id:d8b4ee03-5592-4567-883b-e0842fefeff4 tags:
Im Allgemeinen ist die Reihenfolge der Schlüssel-Wert-Paare unvorhersehbar. Dies ist jedoch nicht wichtig, da die Werte immer mithilfe der Schlüssel abgerufen werden.
%% Cell type:code id:e9e4c5b9-9539-4294-a6ec-0a29fb76bf7b tags:
``` julia
eng2de["two"]
```
%% Cell type:markdown id:9944dbbd-478b-4ae1-ac89-e16be08a0868 tags:
If the key isn’t in the dictionary, you get an exception:
%% Cell type:markdown id:84cf8b52-f061-4b28-a327-bc527820517c tags:
Wenn der Schlüssel nicht im Wörterbuch vorhanden ist, tritt eine Ausnahme auf:
%% Cell type:code id:8221269b-7a8f-4cfd-ab8e-0aa4fd6c962d tags:
``` julia
eng2de["four"]
```
%% Cell type:markdown id:a545abaa-78dc-4625-84e9-03b1c8beaaf8 tags:
The `length` function works on dictionaries; it returns the number of key-value pairs:
%% Cell type:markdown id:f83d51c5-2c1d-4449-8cd5-e80f224b9a76 tags:
Die Funktion `length` funktioniert auch bei Wörterbüchern; sie gibt die Anzahl der Schlüssel-Wert-Paare zurück:
%% Cell type:code id:0e242667-b921-4242-bdcc-cbcac14909b2 tags:
``` julia
length(eng2de)
```
%% Cell type:markdown id:8e42655b-f2a0-41f0-be90-015ebfeafdb9 tags:
The function `keys` returns a collection with the keys of the dictionary:
%% Cell type:markdown id:b4ac7b46-9fc0-47fd-b6c0-c97791517b51 tags:
Die Funktion `keys` gibt eine Sammlung mit den Schlüsseln des Wörterbuchs zurück:
%% Cell type:code id:3236f973-d3fa-42ba-a1c0-41e0002446cb tags:
``` julia
keys(eng2de)
```
%% Cell type:markdown id:acfa7044-5695-4af8-b4bc-320c8a48a220 tags:
Now you can use the `∈` operator to see whether something appears as a key in the dictionary:
%% Cell type:markdown id:f9bc6fe5-3f7a-458e-942a-11bd3e83dcc6 tags:
Nun kannst du den Operator `∈` verwenden, um zu sehen, ob etwas als Schlüssel im Wörterbuch vorhanden ist:
%% Cell type:code id:1fdeb10c-0d84-4c22-b734-d68e2eafe375 tags:
``` julia
@show "one" keys(eng2de)
@show "four" keys(eng2de);
```
%% Cell type:markdown id:986919d6-4f27-4fad-b222-20697bf6af40 tags:
To see whether something appears as a value in a dictionary, you can use the function `values`, which returns a collection of values, and then use the `∈` operator:
%% Cell type:markdown id:864d141e-6cd2-45e6-95fe-e84cca35cf70 tags:
Um zu überprüfen, ob etwas als Wert in einem Wörterbuch vorhanden ist, kannst du die Funktion `values` verwenden, die eine Sammlung von Werten zurückgibt, und dann den Operator `∈` verwenden:
%% Cell type:code id:ab90dad1-61d0-4dbd-b829-a354c13fcb71 tags:
``` julia
@show "ein" values(eng2de)
@show "vier" values(eng2de);
```
%% Cell type:markdown id:049c9dfd-1e51-4898-98e5-a4b812d0bba2 tags:
### Loops over dictionaries
You can traverse the keys of the dictionary in a `for` statement.
%% Cell type:markdown id:5b255b31-8aca-49b4-a95f-302c59baa975 tags:
### Schleifen über Wörterbücher
Du kannst die Schlüssel des Wörterbuchs in einer `for`-Schleife durchlaufen.
%% Cell type:code id:e7062d3f-2125-4ecd-ab13-d04944a71fe1 tags:
``` julia
function print_dictionary(dic)
for key in keys(dic)
println(key, " ", dic[key])
end
end
print_dictionary(eng2de)
```
%% Cell type:markdown id:cf27195c-e601-49ca-b03d-63162bf59bce tags:
Again, the keys are in no particular order. To traverse the keys in alphabetically sorted order, you can combine `sort` and `collect`:
%% Cell type:markdown id:a6b3285a-58f6-41b6-8755-2732a367424e tags:
Auch hier sind die Schlüssel in keiner bestimmten Reihenfolge. Um die Schlüssel in alphabetisch sortierter Reihenfolge zu durchlaufen, kannst du `sort` und `collect` kombinieren:
%% Cell type:code id:6d52aeba-3c7e-405c-bcfe-d76e37e94f51 tags:
``` julia
function print_dictionary_sorted(dic)
for key in sort(collect(keys(dic)))
println(key, " ", dic[key])
end
end
print_dictionary_sorted(eng2de)
```
%% Cell type:markdown id:8daa9d3e-19de-4415-ba6c-6aeb174b38fa tags:
### Exercises
- Write a function that given a string as input counts how many times each letter appears. Use a dictionary.
%% Cell type:markdown id:964165ee-4d0d-4122-b6b2-d3926101cab2 tags:
### Übungen
- Schreibe eine Funktion, die bei Eingabe eines Strings zählt, wie oft jeder Buchstabe vorkommt. Verwende ein Wörterbuch.
%% Cell type:code id:aba1978b-e675-48a7-89aa-75553db70537 tags:
``` julia
```
%% Cell type:markdown id:3a9b281f-6cc0-4d39-b9e2-d816823f9873 tags:
## Tuples and named tuples
%% Cell type:markdown id:0acaa2f9-372c-4a3e-be01-27cfe2853fdb tags:
## Tupel und benannte Tupel
%% Cell type:markdown id:a722109e-86cc-44e3-9256-a3e93a1668f5 tags:
A tuple is a sequence of values. The values can be of any type, and they are indexed by integers. The tuples are immutable and each element can have its own type.
%% Cell type:markdown id:68ea4303-ce3c-4647-8e9f-89afd0a6a670 tags:
Ein Tupel ist eine Sequenz von Werten. Die Werte können beliebigen Typs sein und sie werden durch Ganzzahlen indexiert. Die Tupel sind unveränderlich und jedes Element kann seinen eigenen Typ haben.
%% Cell type:code id:8502cf2e-8bea-4707-811c-f4e6e1de3c8f tags:
``` julia
t = 'a', 'b', 'c', 'd', 'e'
```
%% Cell type:markdown id:d01f5647-a240-4620-9a3a-782835aca39c tags:
Although it is not necessary, it is common to enclose tuples in parentheses:
%% Cell type:markdown id:2632b11b-de4b-4f21-bcc6-06a32517c121 tags:
Obwohl es nicht notwendig ist, ist es üblich, Tupel in Klammern zu setzen:
%% Cell type:code id:bfa31b99-bf9d-49bb-babc-fe8a65248429 tags:
``` julia
t = ('a', 'b', 'c', 'd', 'e')
```
%% Cell type:markdown id:3fa935e0-0611-4b8a-982c-329c33a74f99 tags:
To create a tuple with a single element, you have to include a final comma:
%% Cell type:markdown id:86fa8b6b-bbbf-4c9c-a5c0-63b00b2c59cb tags:
Um ein Tupel mit einem einzigen Element zu erstellen, musst du ein abschließendes Komma setzen:
%% Cell type:code id:cb1bea15-2b80-43b2-be8e-27507d550fca tags:
``` julia
t1 = ('a',)
@show typeof(t1)
t2 = ('a')
@show typeof(t2);
```
%% Cell type:markdown id:193457ac-4e4b-4e58-8c28-6d8b4331d532 tags:
Another way to create a tuple is the built-in function tuple. With no argument, it creates an empty tuple:
%% Cell type:markdown id:d6f34b5b-2aaa-49db-b2a8-d5891fe33ee1 tags:
Eine andere Möglichkeit, ein Tupel zu erstellen, ist die integrierte Funktion `tuple`. Ohne Argument erstellt sie ein leeres Tupel:
%% Cell type:code id:952acafe-ca5d-4b58-8969-224b0fe3a28f tags:
``` julia
t3 = tuple()
@show typeof(t3)
t4 = tuple(1, 'a', π, 12.0)
@show typeof(t4);
```
%% Cell type:markdown id:729c3597-1a35-4a26-ae7a-6dadee31daeb tags:
Using the bracket operator it is possible to access an element. Note, differently from other programming languages (for example C, C++, Python) in Julia the first element is 1.
%% Cell type:markdown id:efc3d061-7e93-4863-a802-a7cdb869af7e tags:
Mit dem eckigen Klammern-Operator ist es möglich, auf ein Element zuzugreifen. Beachte, dass in Julia das erste Element, anders als in anderen Programmiersprachen (zum Beispiel C, C++, Python), mit 1 indexiert wird.
%% Cell type:code id:9817c28f-428d-4d5b-8384-608f9b4d763d tags:
``` julia
t4[2]
```
%% Cell type:markdown id:2519be57-8c10-4878-a772-017b099f6a4c tags:
It is also possible to get multiple elements by using slices.
%% Cell type:markdown id:17a0f0ee-e03f-4669-a5f1-889d875577d9 tags:
Es ist auch möglich, mehrere Elemente mithilfe von Slices zu erhalten.
%% Cell type:code id:c48ac07f-3a4e-4bb8-9551-2973ea8d2f9c tags:
``` julia
@show t4[1:3];
```
%% Cell type:markdown id:aeda8602-f9da-4173-a692-54e2e9a0e178 tags:
But if you try to modify one of the elements of the tuple, you get an error:
%% Cell type:markdown id:d0f25a1f-0a4c-4ab4-a339-f5ba64806681 tags:
Aber wenn du versuchst, eines der Elemente des Tupels zu ändern, tritt ein Fehler auf:
%% Cell type:code id:cfc94cc9-832c-45d2-85b8-aaf789f33f6a tags:
``` julia
t4[2] = 'b'
```
%% Cell type:markdown id:b9f13b5c-9e61-46b9-a47d-f90199bd7bd2 tags:
Because tuples are immutable, you can’t modify the elements.
%% Cell type:markdown id:d956168e-36e4-4abb-a3d6-3c53a857e78d tags:
Da Tupel unveränderlich sind, kannst du die Elemente nicht ändern.
%% Cell type:markdown id:a10cb9a7-8f44-44f8-831f-178b780e4ac9 tags:
Strictly speaking, a function can only return one value, but if the value is a tuple, the effect is the same as returning multiple values. For example, if you want to divide two integers and compute the quotient and remainder, it is inefficient to compute x ÷ y and then x % y. It is better to compute them both at the same time.
The built-in function `divrem` takes two arguments and returns a tuple of two values, the quotient and remainder. You can store the result as a tuple:
%% Cell type:markdown id:6a115819-54fd-4550-b097-59fea3ecb523 tags:
Genau genommen kann eine Funktion nur einen Wert zurückgeben, aber wenn der Wert ein Tupel ist, hat dies den gleichen Effekt wie das Zurückgeben mehrerer Werte. Zum Beispiel, wenn du zwei Ganzzahlen teilen und den Quotienten und den Rest berechnen möchtest, ist es ineffizient, zuerst x ÷ y und dann x % y zu berechnen. Es ist besser, beides gleichzeitig zu berechnen.
Die integrierte Funktion `divrem` nimmt zwei Argumente entgegen und gibt ein Tupel aus zwei Werten zurück, dem Quotienten und dem Rest. Du kannst das Ergebnis als Tupel speichern:
%% Cell type:code id:d1dde137-036f-4b93-8010-13b3e835ebd8 tags:
``` julia
t = divrem(7, 3)
```
%% Cell type:markdown id:ea615dbd-effb-4442-b160-20e7c9b6c22e tags:
Alternatively, we can use tuple assignment to store the elements separately:
%% Cell type:markdown id:9cd48d9c-cf1d-4546-a2c0-4bb54a42e1e8 tags:
Alternativ können wir die Zuweisung als Tupel verwenden, um die Elemente getrennt zu speichern:
%% Cell type:code id:c4969556-7945-43c9-8b96-1ea1032cbb3c tags:
``` julia
q, r = divrem(7, 3)
@show q r;
```
%% Cell type:markdown id:4574e191-aaa8-4834-8837-54947d6ddf30 tags:
### Gather and scatter
Functions can take a variable number of arguments. A parameter name that ends with `...` gathers arguments into a tuple. For example, `printall` takes any number of arguments and prints them one by line:
%% Cell type:markdown id:e4177fab-a386-4274-8657-bbc6698ec1e5 tags:
### Sammeln und verteilen
Funktionen können eine variable Anzahl von Argumenten entgegennehmen. Ein Parametername, der mit `...` endet, sammelt die Argumente in ein Tupel. Zum Beispiel nimmt `printall` eine beliebige Anzahl von Argumenten entgegen und gibt sie nacheinander aus:
%% Cell type:code id:43f8c7ad-5ac2-425e-a50f-c45624bb3d8a tags:
``` julia
function printall(args...)
for arg in args
println(arg)
end
end
printall(1)
printall(1, 2.0, '3')
```
%% Cell type:markdown id:eb662374-fe83-49d7-a5be-d9582d037ad1 tags:
The complement of gather is scatter. If you have a sequence of values and you want to pass it to a function as multiple arguments, you can use the `...` operator. For example, `divrem` takes exactly two arguments; it doesn’t work with a tuple:
%% Cell type:markdown id:28b3cd91-bf05-43bc-a253-2bee077a1df1 tags:
Das Gegenstück zu "sammeln" ist "verteilen". Wenn du eine Sequenz von Werten hast und sie als mehrere Argumente an eine Funktion übergeben möchtest, kannst du den Operator `...` verwenden. Zum Beispiel nimmt `divrem` genau zwei Argumente an; es funktioniert nicht mit einem Tupel:
%% Cell type:code id:bf55fc10-8432-41e3-bd6c-2244c8c96513 tags:
``` julia
t = (7, 3)
divrem(t)
```
%% Cell type:markdown id:d05def39-3244-4acd-a082-a7ee532f8f1d tags:
But if you scatter the tuple, it works:
%% Cell type:markdown id:db3cd00d-d41c-4f68-95d4-c4e5b283734a tags:
Aber wenn du das Tupel verteilst, funktioniert es:
%% Cell type:code id:e7df53bc-6b2d-4501-9ca8-61e3cb79eb1a tags:
``` julia
t = (7, 3)
divrem(t...)
```
%% Cell type:markdown id:2cf01c32-9d1b-4e83-9375-f737e51c58ed tags:
### Dictionaries and Tuples
%% Cell type:markdown id:dad5d7bf-0dd5-450b-90f3-7768f2d91c18 tags:
### Wörterbücher und Tupel
%% Cell type:markdown id:00e97ccc-8e64-4eef-84be-85a266eb3490 tags:
Dictionaries can be used as iterators that iterate the key-value pairs. You can use it in a `for` loop like this:
%% Cell type:markdown id:3a38cabd-b056-4140-a75c-e0fa383a2a74 tags:
Wörterbücher können als Iteratoren verwendet werden, um die Schlüssel-Wert-Paare zu durchlaufen. Du kannst es in einer `for`-Schleife wie folgt verwenden:
%% Cell type:code id:ed483334-36d0-4700-b178-cd9dc5f12189 tags:
``` julia
d = Dict('a'=>1, 'b'=>2, 'c'=>3);
for (key, value) in d
println(key, " ", value)
end
```
%% Cell type:markdown id:dcb05236-810a-410b-aaa0-0cb431e3e64f tags:
It is common to use tuples as keys in dictionaries. For example, a telephone directory might map from last-name, first-name pairs to telephone numbers. Assuming that we have defined last, first and number, we could write:
%% Cell type:markdown id:5a012731-cf42-487b-9d02-4a4b1d0475c0 tags:
Es ist üblich, Tupel als Schlüssel in Wörterbüchern zu verwenden. Zum Beispiel könnte ein Telefonverzeichnis Nachname-Vorname-Paare auf Telefonnummern abbilden. Angenommen, wir haben last, first und number definiert, könnten wir schreiben:
%% Cell type:markdown id:e5462d35-fa68-42d8-ba00-c5dd1747c557 tags:
`directory[last, first] = number`
%% Cell type:markdown id:9980d710-392b-4716-b44d-98e6c5c8b838 tags:
### Named tuples
%% Cell type:markdown id:7bd0a942-de38-4c9e-96df-a786fa814254 tags:
### Benannte Tupel
%% Cell type:markdown id:e514c4bd-c17c-44f4-a89f-88154cc1bf6c tags:
Named tuples are a special type of tuple in Julia where each element has a specific name associated with it. This allows you to access elements by their names, making the code more readable and self-explanatory.
%% Cell type:markdown id:2284786f-cb8b-4173-944a-e50d79ceca2d tags:
Benannte Tupel sind ein besonderer Tupeltyp in Julia, bei dem jedem Element ein spezifischer Name zugeordnet ist. Dies ermöglicht es dir, auf Elemente anhand ihrer Namen zuzugreifen, was den Code lesbarer und selbsterklärender macht.
%% Cell type:code id:78fb5959-407a-4128-9287-bb9d455f22dc tags:
``` julia
person = (name = "Michele", age = 28, city = "Stuttgart")
```
%% Cell type:markdown id:63075b2d-ef86-48e4-8f84-981f81fdece0 tags:
Named tuples are immutable, however it is possible to update the content, or to add new elements, by creating a new version. For example:
%% Cell type:markdown id:01e99a5c-f331-4ad6-95e0-e403b8ad327b tags:
Benannte Tupel sind unveränderlich, aber es ist möglich, den Inhalt zu aktualisieren oder neue Elemente hinzuzufügen, indem eine neue Version erstellt wird. Zum Beispiel:
%% Cell type:code id:ecd22e07-5ba3-4f11-bc77-d967a6fc3fe8 tags:
``` julia
updated_person = (person..., age = 29)
updated_person = (person..., number = "0711 ...")
```
%% Cell type:markdown id:347fe4ea-5b63-4fb8-91bc-2b7b8a0c6a30 tags:
### Exercises
- Write a function `swap_first_last` that takes a tuple and returns a new tuple with the first and last elements swapped. Tip: use a combination of the `...` operator and of this slice `[2:end-1]`.
%% Cell type:markdown id:70061322-9435-496a-ac0d-c026f41e5936 tags:
### Exercises
- Write a function `swap_first_last` that takes a tuple and returns a new tuple with the first and last elements swapped. Tip: use a combination of the `...` operator and of this slice `[2:end-1]`.
%% Cell type:code id:3721b654-b182-426d-b799-a69e0b53a550 tags:
``` julia
```
%% Cell type:markdown id:647530cd-480a-414f-a8ec-1375e05a9e1b tags:
## Structs
## Objects and structs
%% Cell type:markdown id:5629a477-5d19-43a2-8bb4-e10b10f2ffde tags:
## Objekte und Strukturen
%% Cell type:markdown id:00b9bdb1-86ad-47f6-b8c3-88e85878eaff tags:
At this point you know how to use functions to organize code and built-in types to organize data. The next step is to learn how to build your own types to organize both code and data.
We have used many of Julia’s built-in types; now we are going to define a new type. As an example, we will create a type called Point that represents a point in two-dimensional space.
There are several ways we might represent points in Julia:
- We could store the coordinates separately in two variables, x and y.
- We could store the coordinates as elements in an tuple.
- We could create a new type to represent points as objects.
Here we will investigate the third option.
%% Cell type:markdown id:18412e4f-e5fb-4a92-a083-ac2e5b58cde3 tags:
Zu diesem Zeitpunkt weißt du bereits, wie man Funktionen verwendet, um Code zu organisieren, und integrierte Typen, um Daten zu organisieren. Der nächste Schritt ist zu lernen, wie man eigene Typen erstellt, um sowohl Code als auch Daten zu organisieren.
Wir haben viele der integrierten Typen von Julia verwendet; jetzt werden wir einen neuen Typ definieren. Als Beispiel werden wir einen Typ namens Punkt erstellen, der einen Punkt im zweidimensionalen Raum repräsentiert.
Es gibt verschiedene Möglichkeiten, wie wir Punkte in Julia darstellen könnten:
- Wir könnten die Koordinaten separat in zwei Variablen, x und y, speichern.
- Wir könnten die Koordinaten als Elemente in einem Tupel speichern.
- Wir könnten einen neuen Typ erstellen, um Punkte als Objekte darzustellen.
Hier werden wir die dritte Option untersuchen.
%% Cell type:markdown id:9aa53d46-033b-4559-a5d8-e95357a257a5 tags:
A programmer-defined composite type is also called a struct. The struct definition for a point looks like this:
%% Cell type:markdown id:270c430a-4157-4e54-bb27-660c4028e5c6 tags:
Ein vom Programmierer definierter zusammengesetzter Typ wird auch als Struktur (engl. struct) bezeichnet. Die Strukturdefinition für einen Punkt sieht so aus:
%% Cell type:code id:c2e3f646-2d82-46a4-a265-01b919412c6d tags:
``` julia
struct Point
x::Real
y::Real
end
```
%% Cell type:markdown id:fb9be134-9730-4dbd-9e05-51dd94e9d8e0 tags:
The header indicates that the new struct is called Point. The body defines the attributes or fields of the struct. The Point struct has two fields: x and y.
A struct is like a factory for creating objects. To create a point, you call Point as if it were a function having as arguments the values of the fields. When Point is used as a function, it is called a constructor. The constructor returns an instance of the object.
%% Cell type:markdown id:6b99219f-70ba-41a7-8c52-e3803a360087 tags:
Die Kopfzeile zeigt an, dass die neue Struktur Point genannt wird. Der Körper definiert die Attribute oder Felder der Struktur. Die Point-Struktur hat zwei Felder: x und y.
Eine Struktur ist wie eine Fabrik zur Erzeugung von Objekten. Um einen Punkt zu erstellen, rufst du Point auf, als wäre es eine Funktion, und übergibst die Werte der Felder als Argumente. Wenn Point als Funktion verwendet wird, wird dies Konstruktor genannt. Der Konstruktor gibt eine Instanz des Objekts zurück.
%% Cell type:code id:197339a2-0d8b-4882-bab2-80ba56410f21 tags:
``` julia
p = Point(3.0, 4.0)
@show p;
```
%% Cell type:markdown id:b0134aa7-f356-4d71-9d46-959bd3cfe89a tags:
The type speficication (`::Real`) is optional, but can be helpful to enforce correct usage of the struct.
%% Cell type:markdown id:e35cbbf5-491e-44ff-b2c0-0cf6a8853083 tags:
Die Typangabe (`::Real`) ist optional, kann aber hilfreich sein, um die korrekte Verwendung der Struktur zu erzwingen.
%% Cell type:code id:849f1460-d228-4b22-a797-1077d75d1a2d tags:
``` julia
p = Point("a", 4.0)
```
%% Cell type:markdown id:e3011b23-816d-4aa2-be61-7eb8f4aee9d1 tags:
The values of the fields can be accessed using the `.` operator.
%% Cell type:markdown id:b86615f4-592f-41f7-b9d1-f5d1573cfd86 tags:
Die Werte der Felder können mithilfe des `.` Operators abgerufen werden.
%% Cell type:code id:00d090e4-d74d-4fad-ae8b-369c1046e48b tags:
``` julia
@show p.x p.y;
@show distance = sqrt(p.x^2 + p.y^2);
```
%% Cell type:markdown id:08748a8c-f76c-4f14-b3d2-9db99fb28e87 tags:
Structs are however by default immutable, after construction the fields can not change value:
%% Cell type:markdown id:7c6baa9c-56e2-4595-9e6b-c798d9cea002 tags:
Die Werte der Felder können mithilfe des `.` Operators abgerufen werden.
%% Cell type:code id:91bd6248-a358-43e3-90cc-6b8398445aaf tags:
``` julia
p.x = 2
```
%% Cell type:markdown id:629c1004-5d0f-4093-b546-473c94c91b44 tags:
Where required, mutable composite types can be declared with the keyword mutable struct. Here is the definition of a mutable point:
%% Cell type:markdown id:48b46edb-b8fd-46ca-a2ec-4aa0acbf6c01 tags:
Wenn erforderlich, können veränderbare zusammengesetzte Typen mit dem Schlüsselwort `mutable struct` deklariert werden. Hier ist die Definition eines veränderbaren Punkts:
%% Cell type:code id:804c2c32-7a84-4261-88d8-1bad6ba5e18c tags:
``` julia
mutable struct MPoint
x::Real
y::Real
end
p = MPoint(3.0, 4.0)
p.x = 2.0
@show p;
```
%% Cell type:markdown id:1bd558dd-e6c3-4dc0-9476-768c59178708 tags:
A third option is to let some fields of an unmutable struct to be mutable. For example a dictionary inside an unmutable struct can be modified.
%% Cell type:markdown id:06f44f63-bf8e-45f5-9495-006e21fc7560 tags:
Eine dritte Option ist es, einige Felder einer unveränderlichen Struktur als veränderbar zu definieren. Zum Beispiel kann ein Wörterbuch innerhalb einer unveränderlichen Struktur geändert werden.
%% Cell type:code id:62cab9ae-5e58-401c-bc93-17720914e530 tags:
``` julia
struct Book
title::String
author::String
properties::Dict{String, Any}
end
book = Book("Der Hobbit", "J.R.R. Tolkien", Dict("available" => false))
@show book
book.properties["available"] = true
@show book;
```
%% Cell type:markdown id:31e2098b-5079-4cb5-bf64-a7a78754af32 tags:
You can pass an instance as an argument in the usual way. For example:
%% Cell type:markdown id:53aa5851-35c2-4dd0-a1e0-b5bc8e21b9f6 tags:
Du kannst eine Instanz auf die übliche Weise als Argument übergeben. Zum Beispiel:
%% Cell type:code id:e6113221-0c03-484a-99e0-f7d4fab70f03 tags:
``` julia
function printpoint(p)
function print_point(p)
println("($(p.x), $(p.y))")
end
printpoint(p)
print_point(p)
```
%% Cell type:code id:d5c6fa9e-c31d-4aff-a3fd-db3449904519 tags:
``` julia
function printbook(book)
function print_book(book)
println("Title: $(book.title)")
println("Author: $(book.author)")
available = book.properties["available"]
println("Available: $(available)")
end
printbook(book)
print_book(book)
```
%% Cell type:markdown id:3b12a004-81d9-4bbc-9e2e-d2c281dcbe18 tags:
Functions can return instances as return values.
%% Cell type:markdown id:916562a2-3402-41bb-b15d-01333915df99 tags:
Funktionen können Instanzen als Rückgabewerte zurückgeben.
%% Cell type:code id:9c57c9f7-c4fd-4263-a55f-62f123aaaa8a tags:
``` julia
function find_center(point1, point2)
x = (point1.x + point2.x)/2.0
y = (point1.y + point2.y)/2.0
return Point(x, y)
end
point1 = Point(0.0, 0.0)
point2 = Point(10.0, 10.0)
@show find_center(point1, point2);
```
%% Cell type:markdown id:078b31ab-11e1-4596-8271-f0d33418eab8 tags:
### Exercise
- Write a function called `point_distance` which takes two points as arguments and returns the Euclidean distance between them.
%% Cell type:markdown id:4afa9ca0-e6cd-4713-8caa-689c9dfdee42 tags:
### Übung
- Schreibe eine Funktion namens `point_distance`, die zwei Punkte als Argumente entgegennimmt und die euklidische Distanz zwischen ihnen zurückgibt.
%% Cell type:code id:b5957a05-e396-41c3-9b8f-f14f089115ab tags:
``` julia
```
%% Cell type:markdown id:0fb1f6bc-e6e5-4897-bbb6-880e40e3bf20 tags:
### References and values
Each object (instance of a struct) is stored at some memory address. The operator `===` checks if two variables point to the same memory address of the object. For example
%% Cell type:markdown id:eecb6161-768e-4ae6-a600-d892894f8824 tags:
### Referenzen und Werte
Jedes Objekt (Instanz einer Struktur) wird an einer bestimmten Speicheradresse gespeichert. Der Operator `===` überprüft, ob zwei Variablen auf die gleiche Speicheradresse des Objekts zeigen. Zum Beispiel
%% Cell type:code id:ed713d91-17f4-4010-a7d3-d39826cffc97 tags:
``` julia
book_copy = book
@show book_copy === book;
```
%% Cell type:markdown id:636b6713-f4ed-4220-a159-2918bd44f78e tags:
This means that any change made to `book_copy` will also modify `book`.
%% Cell type:markdown id:582e0ac0-2304-429e-a678-c37ab157d5d6 tags:
Das bedeutet, dass jede Änderung, die an `book_copy` vorgenommen wird, auch `book` modifiziert.
%% Cell type:code id:a9c46bac-d234-4616-a604-63bdf03b1393 tags:
``` julia
book.properties["available"] = true
book_copy.properties["available"] = false
@show book;
```
%% Cell type:markdown id:6bcbf983-40fa-4fc8-8eca-7cd7c45778dc tags:
If a new, distinct, object is needed (in other words, a copy by value), we can use the function `deepcopy`.
%% Cell type:markdown id:79339467-8994-4a5c-8987-3420d14cb290 tags:
If a new, distinct, object is needed (in other words, a copy by value), we can use the function `deepcopy`.
%% Cell type:code id:c36d23c8-2292-4568-aef4-7416c6f3e538 tags:
``` julia
book_copy = deepcopy(book)
@show book_copy === book;
```
%% Cell type:markdown id:02cc3ec7-e712-4c4b-abf5-9bfc98e68a91 tags:
Finally, the `==` operator between structs defaults to the `===` operator as Julia has no way of knowing how to compare custom structs. However, it is always possible to reimplement the `==` operator for our custom types.
%% Cell type:markdown id:4cc4c096-d856-4d43-8808-94edcd3ad906 tags:
Schließlich entspricht der `==` Operator zwischen Strukturen standardmäßig dem `===` Operator, da Julia nicht weiß, wie benutzerdefinierte Strukturen verglichen werden sollen. Es ist jedoch immer möglich, den `==` Operator für unsere benutzerdefinierten Typen neu zu implementieren.
%% Cell type:code id:3372eb89-cde6-4040-aa51-b4e76af97851 tags:
``` julia
import Core
import Base: ==
function ==(book1::Book, book2::Book)
return book1.title == book2.title && book1.author == book2.author
end
@show book_copy == book;
@show book_copy === book;
```
%% Cell type:markdown id:87c1e4fb-d4e2-4ada-a97f-61273012146c tags:
With this we can compare if two books are the same, even if they are two distinct instances of the same struct.
%% Cell type:markdown id:02b533ba-2325-488a-838b-94cdf5ca25bb tags:
Damit können wir vergleichen, ob zwei Bücher gleich sind, auch wenn es sich um zwei unterschiedliche Instanzen desselben Typs handelt.
%% Cell type:markdown id:9263a1ae-52ee-4afc-9d9f-0f1341b64bc0 tags:
## Pure and impure functions
%% Cell type:markdown id:4e457ee2-813a-42a8-8ee0-600bb4b50812 tags:
## Reine und unreine Funktionen
%% Cell type:markdown id:f638e9b3-9926-46fc-81e0-d49c877a3bbb tags:
We have seen that it is quite convenient to pass objects to functions. So far we have seen functions that print the content or that create a new object. None of these functions are modifying the content of the input objects.
- A function that does not modify the input it is also said **pure**.
- A function which modifies the input it is said **impure**. In Julia impure functions are highlighted by adding a `!` as the last character of the name.
Let's consider a modified version of the book for an example.
%% Cell type:markdown id:fb008ae0-a457-45db-8f77-425d56e95b30 tags:
Wir haben gesehen, dass es ziemlich praktisch ist, Objekte an Funktionen zu übergeben. Bisher haben wir Funktionen gesehen, die den Inhalt ausgeben oder ein neues Objekt erstellen. Keine dieser Funktionen ändert den Inhalt der Eingabeobjekte.
- Eine Funktion, die die Eingabe nicht ändert, wird auch als **rein** bezeichnet.
- Eine Funktion, die die Eingabe ändert, wird als **unrein** bezeichnet. In Julia werden unreine Funktionen durch Hinzufügen eines `!` als letztem Zeichen des Namens hervorgehoben.
Betrachten wir eine modifizierte Version des Buchs als Beispiel.
%% Cell type:code id:7f892e07-a601-4cba-b58d-40be9c8e93ab tags:
``` julia
book = Book("Der Hobbit", "J.R.R. Tolkien", Dict("available" => true, "copies_in_stock" => 10))
@show book;
```
%% Cell type:markdown id:99f4d6c9-2633-4394-b6a0-e0ce0c05e0db tags:
Then we could think of a function which updates the database whenever we order new copies.
%% Cell type:markdown id:7dac83b5-1086-4ca9-9b36-827497825be6 tags:
Dann könnten wir über eine Funktion nachdenken, die die Datenbank aktualisiert, wenn wir neue Exemplare bestellen.
%% Cell type:code id:04937488-a556-44ad-97be-98b017f293fd tags:
``` julia
function order_book!(book, number_of_copies)
if number_of_copies <= 0
return
end
book.properties["copies_in_stock"] += number_of_copies
book.properties["available"] = true
end
order_book!(book, 5)
@show book;
```
%% Cell type:markdown id:b30bd560-5ff3-4706-9f53-e6a5158651e9 tags:
### Exercise
- Write an inpure function `sell_book!` for updating the book object whenever we sell a single copy. The function should complain if there are no copies available.
%% Cell type:markdown id:93bc2e46-8530-4d1e-b7fa-55a74d1831c8 tags:
### Übung
- Schreibe eine unreine Funktion `sell_book!`, um das Buchobjekt zu aktualisieren, wenn wir ein Exemplar verkaufen. Die Funktion sollte eine Meldung ausgeben, wenn keine Exemplare verfügbar sind.
%% Cell type:code id:6e79fe95-767d-4b3e-af58-623db6dc0712 tags:
``` julia
```
%% Cell type:markdown id:5ed4d4e0-0454-4298-9a56-8fb32634aa24 tags:
## Further exercises
%% Cell type:markdown id:d5bb0b58-e85e-4edb-80b6-19d2c7d49ac3 tags:
## Weitere Übungen
%% Cell type:markdown id:8446f1db-d40f-4311-9597-3b3b4d913151 tags:
- Create a time struct which stores the time of the day (hour, minute and second). Write a function which takes as input the time object and prints it. Then write a function which sums together two time objects and returns a new time object. If the total is more than 24 hours, it should reset as if it was the next day.
%% Cell type:markdown id:15fd6da2-f862-40ef-a58d-5e7be488565f tags:
- Erstelle eine Zeitstruktur, die die Uhrzeit des Tages (Stunde, Minute und Sekunde) speichert. Schreibe eine Funktion, die als Eingabe das Zeitobjekt nimmt und es ausgibt. Schreibe dann eine Funktion, die zwei Zeitobjekte zusammenzählt und ein neues Zeitobjekt zurückgibt. Wenn die Summe mehr als 24 Stunden beträgt, sollte sie wie am nächsten Tag zurückgesetzt werden.
%% Cell type:code id:5335e035-62ee-4d0f-acfc-a9e24ac26d99 tags:
``` julia
```
%% Cell type:markdown id:32844b6f-518a-4174-83c6-0d7ebeabe4e4 tags:
- Create a custom version of the `==` function which checks if two time objects are the same.
%% Cell type:markdown id:2e0fde12-1214-4709-a7cb-5ebfaa0af17a tags:
- Erstelle eine benutzerdefinierte Version der `==` Funktion, die überprüft, ob zwei Zeitobjekte identisch sind.
%% Cell type:code id:966d4db1-c95a-4531-8209-a869519599ea tags:
``` julia
```
%% Cell type:code id:03594f56-48ee-4152-a42f-8e3588c3ab2e tags:
%% Cell type:markdown id:baa7e06f-e183-4ee7-912a-e22255e18e21 tags:
- Create a custom version of the `<` and `<=` functions for time objects.
%% Cell type:markdown id:4e8c3c1e-14fb-439f-97c7-076196f7e5b4 tags:
- Erstelle eine benutzerdefinierte Version der `<` und `<=` Funktionen für Zeitobjekte.
%% Cell type:code id:c9b76667-731b-4ec2-aaf4-e94496f65b1a tags:
``` julia
```
%% Cell type:markdown id:1bdbd748-7482-4f54-99a7-3d6e74b65575 tags:
- Create a custom version of the `>` and `>=` functions for time objects.
%% Cell type:markdown id:b79aad8c-647e-46d0-9b04-6a77cd219953 tags:
- Erstelle eine benutzerdefinierte Version der `>` und `>=` Funktionen für Zeitobjekte.
%% Cell type:code id:7df56050-686e-4a87-aa86-9b7f61315aa2 tags:
``` julia
```
......
# This file is machine-generated - editing it directly is not advised
julia_version = "1.9.3"
manifest_format = "2.0"
project_hash = "de06a4084cc927261aea28cc342de88540b5a0c4"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[deps.BitFlags]]
git-tree-sha1 = "43b1a4a8f797c1cddadf60499a8a077d4af2cd2d"
uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35"
version = "0.1.7"
[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+0"
[[deps.Cairo_jll]]
deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "4b859a208b2397a7a623a03449e4636bdb17bcf2"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.16.1+1"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "02aa26a4cf76381be7f66e020a3eddeb27b0a092"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.2"
[[deps.ColorSchemes]]
deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"]
git-tree-sha1 = "67c1f244b991cad9b0aa4b7540fb758c2488b129"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.24.0"
[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "eb7f0f8307f71fac7c606984ea5fb2817275d6e4"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.11.4"
[[deps.ColorVectorSpace]]
deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"]
git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249"
uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4"
version = "0.10.0"
[deps.ColorVectorSpace.extensions]
SpecialFunctionsExt = "SpecialFunctions"
[deps.ColorVectorSpace.weakdeps]
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
[[deps.Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "Reexport"]
git-tree-sha1 = "fc08e5930ee9a4e03f84bfb5211cb54e7769758a"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.12.10"
[[deps.Compat]]
deps = ["UUIDs"]
git-tree-sha1 = "8a62af3e248a8c4bad6b32cbbe663ae02275e32c"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.10.0"
weakdeps = ["Dates", "LinearAlgebra"]
[deps.Compat.extensions]
CompatLinearAlgebraExt = "LinearAlgebra"
[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.0.5+0"
[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "5372dbbf8f0bdb8c700db5367132925c0771ef7e"
uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.2.1"
[[deps.Conda]]
deps = ["Downloads", "JSON", "VersionParsing"]
git-tree-sha1 = "8c86e48c0db1564a1d49548d3515ced5d604c408"
uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d"
version = "1.9.1"
[[deps.Contour]]
git-tree-sha1 = "d05d9e7b7aedff4e5b51a029dced05cfb6125781"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.6.2"
[[deps.DataAPI]]
git-tree-sha1 = "8da84edb865b0b5b0100c0666a9bc9a0b71c553c"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.15.0"
[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "3dbd312d370723b6bb43ba9d02fc36abade4518d"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.15"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.DelimitedFiles]]
deps = ["Mmap"]
git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae"
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
version = "1.9.1"
[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.9.3"
[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
version = "1.6.0"
[[deps.EpollShim_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "8e9441ee83492030ace98f9789a654a6d0b1f643"
uuid = "2702e6a9-849d-5ed8-8c21-79e8b8f9ee43"
version = "0.0.20230411+0"
[[deps.ExceptionUnwrapping]]
deps = ["Test"]
git-tree-sha1 = "e90caa41f5a86296e014e148ee061bd6c3edec96"
uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
version = "0.1.9"
[[deps.Expat_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "4558ab818dcceaab612d1bb8c19cee87eda2b83c"
uuid = "2e619515-83b5-522b-bb60-26c02a35a201"
version = "2.5.0+0"
[[deps.FFMPEG]]
deps = ["FFMPEG_jll"]
git-tree-sha1 = "b57e3acbe22f8484b4b5ff66a7499717fe1a9cc8"
uuid = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
version = "0.4.1"
[[deps.FFMPEG_jll]]
deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "PCRE2_jll", "Pkg", "Zlib_jll", "libaom_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"]
git-tree-sha1 = "74faea50c1d007c85837327f6775bea60b5492dd"
uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5"
version = "4.4.2+2"
[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
[[deps.FixedPointNumbers]]
deps = ["Statistics"]
git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.4"
[[deps.Fontconfig_jll]]
deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Pkg", "Zlib_jll"]
git-tree-sha1 = "21efd19106a55620a188615da6d3d06cd7f6ee03"
uuid = "a3f928ae-7b40-5064-980b-68af3947d34b"
version = "2.13.93+0"
[[deps.Formatting]]
deps = ["Printf"]
git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8"
uuid = "59287772-0a20-5a39-b81b-1366585eb4c0"
version = "0.4.2"
[[deps.FreeType2_jll]]
deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Zlib_jll"]
git-tree-sha1 = "d8db6a5a2fe1381c1ea4ef2cab7c69c2de7f9ea0"
uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7"
version = "2.13.1+0"
[[deps.FriBidi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "aa31987c2ba8704e23c6c8ba8a4f769d5d7e4f91"
uuid = "559328eb-81f9-559d-9380-de523a88c83c"
version = "1.0.10+0"
[[deps.GLFW_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Pkg", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll"]
git-tree-sha1 = "d972031d28c8c8d9d7b41a536ad7bb0c2579caca"
uuid = "0656b61e-2033-5cc2-a64a-77c0f6c09b89"
version = "3.3.8+0"
[[deps.GR]]
deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Preferences", "Printf", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "UUIDs", "p7zip_jll"]
git-tree-sha1 = "27442171f28c952804dede8ff72828a96f2bfc1f"
uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
version = "0.72.10"
[[deps.GR_jll]]
deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "FreeType2_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Qt6Base_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "025d171a2847f616becc0f84c8dc62fe18f0f6dd"
uuid = "d2c73de3-f751-5644-a686-071e5b155ba9"
version = "0.72.10+0"
[[deps.Gettext_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"]
git-tree-sha1 = "9b02998aba7bf074d14de89f9d37ca24a1a0b046"
uuid = "78b55507-aeef-58d4-861c-77aaff3498b1"
version = "0.21.0+0"
[[deps.Glib_jll]]
deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"]
git-tree-sha1 = "e94c92c7bf4819685eb80186d51c43e71d4afa17"
uuid = "7746bdde-850d-59dc-9ae8-88ece973131d"
version = "2.76.5+0"
[[deps.Graphite2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "344bf40dcab1073aca04aa0df4fb092f920e4011"
uuid = "3b182d85-2403-5c21-9c21-1e1f0cc25472"
version = "1.3.14+0"
[[deps.Grisu]]
git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2"
uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe"
version = "1.0.2"
[[deps.HTTP]]
deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"]
git-tree-sha1 = "5eab648309e2e060198b45820af1a37182de3cce"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "1.10.0"
[[deps.HarfBuzz_jll]]
deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"]
git-tree-sha1 = "129acf094d168394e80ee1dc4bc06ec835e510a3"
uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566"
version = "2.8.1+1"
[[deps.IJulia]]
deps = ["Base64", "Conda", "Dates", "InteractiveUtils", "JSON", "Libdl", "Logging", "Markdown", "MbedTLS", "Pkg", "Printf", "REPL", "Random", "SoftGlobalScope", "Test", "UUIDs", "ZMQ"]
git-tree-sha1 = "47ac8cc196b81001a711f4b2c12c97372338f00c"
uuid = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
version = "1.24.2"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[deps.IrrationalConstants]]
git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2"
uuid = "92d709cd-6900-40b7-9082-c6be49f344b6"
version = "0.2.2"
[[deps.JLFzf]]
deps = ["Pipe", "REPL", "Random", "fzf_jll"]
git-tree-sha1 = "f377670cda23b6b7c1c0b3893e37451c5c1a2185"
uuid = "1019f520-868f-41f5-a6de-eb00f4b6a39c"
version = "0.1.5"
[[deps.JLLWrappers]]
deps = ["Artifacts", "Preferences"]
git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.5.0"
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.4"
[[deps.JpegTurbo_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "6f2675ef130a300a112286de91973805fcc5ffbc"
uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8"
version = "2.1.91+0"
[[deps.LAME_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "f6250b16881adf048549549fba48b1161acdac8c"
uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d"
version = "3.100.1+0"
[[deps.LERC_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "bf36f528eec6634efc60d7ec062008f171071434"
uuid = "88015f11-f218-50d7-93a8-a6af411a945d"
version = "3.0.0+1"
[[deps.LLVMOpenMP_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "f689897ccbe049adb19a065c495e75f372ecd42b"
uuid = "1d63c593-3942-5779-bab2-d838dc0a180e"
version = "15.0.4+0"
[[deps.LZO_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "e5b909bcf985c5e2605737d2ce278ed791b89be6"
uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac"
version = "2.10.1+0"
[[deps.LaTeXStrings]]
git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.3.0"
[[deps.Latexify]]
deps = ["Formatting", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "OrderedCollections", "Printf", "Requires"]
git-tree-sha1 = "f428ae552340899a935973270b8d98e5a31c49fe"
uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
version = "0.16.1"
[deps.Latexify.extensions]
DataFramesExt = "DataFrames"
SymEngineExt = "SymEngine"
[deps.Latexify.weakdeps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8"
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
version = "0.6.3"
[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "7.84.0+0"
[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
version = "1.10.2+0"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[deps.Libffi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "0b4a5d71f3e5200a7dff793393e09dfc2d874290"
uuid = "e9f186c6-92d2-5b65-8a66-fee21dc1b490"
version = "3.2.2+1"
[[deps.Libgcrypt_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgpg_error_jll", "Pkg"]
git-tree-sha1 = "64613c82a59c120435c067c2b809fc61cf5166ae"
uuid = "d4300ac3-e22c-5743-9152-c294e39db1e4"
version = "1.8.7+0"
[[deps.Libglvnd_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll", "Xorg_libXext_jll"]
git-tree-sha1 = "6f73d1dd803986947b2c750138528a999a6c7733"
uuid = "7e76a0d4-f3c7-5321-8279-8d96eeed0f29"
version = "1.6.0+0"
[[deps.Libgpg_error_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "c333716e46366857753e273ce6a69ee0945a6db9"
uuid = "7add5ba3-2f88-524e-9cd5-f83b8a55f7b8"
version = "1.42.0+0"
[[deps.Libiconv_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "f9557a255370125b405568f9767d6d195822a175"
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
version = "1.17.0+0"
[[deps.Libmount_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "9c30530bf0effd46e15e0fdcf2b8636e78cbbd73"
uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9"
version = "2.35.0+0"
[[deps.Libtiff_jll]]
deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "XZ_jll", "Zlib_jll", "Zstd_jll"]
git-tree-sha1 = "2da088d113af58221c52828a80378e16be7d037a"
uuid = "89763e89-9b03-5906-acba-b20f662cd828"
version = "4.5.1+1"
[[deps.Libuuid_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "7f3efec06033682db852f8b3bc3c1d2b0a0ab066"
uuid = "38a345b3-de98-5d2b-a5d3-14cd9215e700"
version = "2.36.0+0"
[[deps.LinearAlgebra]]
deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[deps.LogExpFunctions]]
deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"]
git-tree-sha1 = "7d6dd4e9212aebaeed356de34ccf262a3cd415aa"
uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
version = "0.3.26"
[deps.LogExpFunctions.extensions]
LogExpFunctionsChainRulesCoreExt = "ChainRulesCore"
LogExpFunctionsChangesOfVariablesExt = "ChangesOfVariables"
LogExpFunctionsInverseFunctionsExt = "InverseFunctions"
[deps.LogExpFunctions.weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0"
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[deps.LoggingExtras]]
deps = ["Dates", "Logging"]
git-tree-sha1 = "0d097476b6c381ab7906460ef1ef1638fbce1d91"
uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36"
version = "1.0.2"
[[deps.MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.11"
[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[deps.MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "Random", "Sockets"]
git-tree-sha1 = "03a9b9718f5682ecb107ac9f7308991db4ce395b"
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
version = "1.1.7"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.2+0"
[[deps.Measures]]
git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102"
uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
version = "0.3.2"
[[deps.Missings]]
deps = ["DataAPI"]
git-tree-sha1 = "f66bdc5de519e8f8ae43bdc598782d35a25b1272"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "1.1.0"
[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2022.10.11"
[[deps.NaNMath]]
deps = ["OpenLibm_jll"]
git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4"
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "1.0.2"
[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
version = "1.2.0"
[[deps.Ogg_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "887579a3eb005446d514ab7aeac5d1d027658b8f"
uuid = "e7412a2a-1a6e-54c0-be00-318e2571c051"
version = "1.3.5+1"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.21+4"
[[deps.OpenLibm_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "05823500-19ac-5b8b-9628-191a04bc5112"
version = "0.8.1+0"
[[deps.OpenSSL]]
deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"]
git-tree-sha1 = "51901a49222b09e3743c65b8847687ae5fc78eb2"
uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c"
version = "1.4.1"
[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "a12e56c72edee3ce6b96667745e6cbbe5498f200"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "1.1.23+0"
[[deps.Opus_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "51a08fb14ec28da2ec7a927c4337e4332c2a4720"
uuid = "91d4177d-7536-5919-b921-800302f37372"
version = "1.3.2+0"
[[deps.OrderedCollections]]
git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.6.2"
[[deps.PCRE2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
version = "10.42.0+0"
[[deps.Parsers]]
deps = ["Dates", "PrecompileTools", "UUIDs"]
git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.7.2"
[[deps.Pipe]]
git-tree-sha1 = "6842804e7867b115ca9de748a0cf6b364523c16d"
uuid = "b98c9c47-44ae-5843-9183-064241ee97a0"
version = "1.3.0"
[[deps.Pixman_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "Libdl"]
git-tree-sha1 = "64779bc4c9784fee475689a1752ef4d5747c5e87"
uuid = "30392449-352a-5448-841d-b1acce4e97dc"
version = "0.42.2+0"
[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.9.2"
[[deps.PlotThemes]]
deps = ["PlotUtils", "Statistics"]
git-tree-sha1 = "1f03a2d339f42dca4a4da149c7e15e9b896ad899"
uuid = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
version = "3.1.0"
[[deps.PlotUtils]]
deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "Statistics"]
git-tree-sha1 = "f92e1315dadf8c46561fb9396e525f7200cdc227"
uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
version = "1.3.5"
[[deps.Plots]]
deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Preferences", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"]
git-tree-sha1 = "ccee59c6e48e6f2edf8a5b64dc817b6729f99eb5"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
version = "1.39.0"
[deps.Plots.extensions]
FileIOExt = "FileIO"
GeometryBasicsExt = "GeometryBasics"
IJuliaExt = "IJulia"
ImageInTerminalExt = "ImageInTerminal"
UnitfulExt = "Unitful"
[deps.Plots.weakdeps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[[deps.PrecompileTools]]
deps = ["Preferences"]
git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f"
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
version = "1.2.0"
[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.4.1"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[deps.Qt6Base_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Vulkan_Loader_jll", "Xorg_libSM_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_cursor_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "libinput_jll", "xkbcommon_jll"]
git-tree-sha1 = "7c29f0e8c575428bd84dc3c72ece5178caa67336"
uuid = "c0090381-4147-56d7-9ebc-da0b1113ec56"
version = "6.5.2+2"
[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[deps.Random]]
deps = ["SHA", "Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[deps.RecipesBase]]
deps = ["PrecompileTools"]
git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.3.4"
[[deps.RecipesPipeline]]
deps = ["Dates", "NaNMath", "PlotUtils", "PrecompileTools", "RecipesBase"]
git-tree-sha1 = "45cf9fd0ca5839d06ef333c8201714e888486342"
uuid = "01d81517-befc-4cb6-b9ec-a95719d0359c"
version = "0.6.12"
[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.2.2"
[[deps.RelocatableFolders]]
deps = ["SHA", "Scratch"]
git-tree-sha1 = "90bc7a7c96410424509e4263e277e43250c05691"
uuid = "05181044-ff0b-4ac5-8273-598c1e38db00"
version = "1.0.0"
[[deps.Requires]]
deps = ["UUIDs"]
git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7"
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
version = "1.3.0"
[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
version = "0.7.0"
[[deps.Scratch]]
deps = ["Dates"]
git-tree-sha1 = "30449ee12237627992a99d5e30ae63e4d78cd24a"
uuid = "6c6a2e73-6563-6170-7368-637461726353"
version = "1.2.0"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[deps.Showoff]]
deps = ["Dates", "Grisu"]
git-tree-sha1 = "91eddf657aca81df9ae6ceb20b959ae5653ad1de"
uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f"
version = "1.0.3"
[[deps.SimpleBufferStream]]
git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1"
uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7"
version = "1.1.0"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[deps.SoftGlobalScope]]
deps = ["REPL"]
git-tree-sha1 = "986ec2b6162ccb95de5892ed17832f95badf770c"
uuid = "b85f4697-e234-5449-a836-ec8e2f98b302"
version = "1.1.0"
[[deps.SortingAlgorithms]]
deps = ["DataStructures"]
git-tree-sha1 = "c60ec5c62180f27efea3ba2908480f8055e17cee"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "1.1.1"
[[deps.SparseArrays]]
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
version = "1.9.0"
[[deps.StatsAPI]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed"
uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
version = "1.7.0"
[[deps.StatsBase]]
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"]
git-tree-sha1 = "1d77abd07f617c4868c33d4f5b9e1dbb2643c9cf"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.34.2"
[[deps.SuiteSparse_jll]]
deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "5.10.1+6"
[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.3"
[[deps.Tar]]
deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
version = "1.10.0"
[[deps.TensorCore]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "1feb45f88d133a655e001435632f019a9a1bcdb6"
uuid = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50"
version = "0.1.1"
[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[deps.TranscodingStreams]]
deps = ["Random", "Test"]
git-tree-sha1 = "9a6ae7ed916312b41236fcef7e0af564ef934769"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.9.13"
[[deps.URIs]]
git-tree-sha1 = "b7a5e99f24892b6824a954199a45e9ffcc1c70f0"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
version = "1.5.0"
[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[deps.UnicodeFun]]
deps = ["REPL"]
git-tree-sha1 = "53915e50200959667e78a92a418594b428dffddf"
uuid = "1cfade01-22cf-5700-b092-accc4b62d6e1"
version = "0.4.1"
[[deps.Unitful]]
deps = ["Dates", "LinearAlgebra", "Random"]
git-tree-sha1 = "a72d22c7e13fe2de562feda8645aa134712a87ee"
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
version = "1.17.0"
[deps.Unitful.extensions]
ConstructionBaseUnitfulExt = "ConstructionBase"
InverseFunctionsUnitfulExt = "InverseFunctions"
[deps.Unitful.weakdeps]
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
[[deps.UnitfulLatexify]]
deps = ["LaTeXStrings", "Latexify", "Unitful"]
git-tree-sha1 = "e2d817cc500e960fdbafcf988ac8436ba3208bfd"
uuid = "45397f5d-5981-4c77-b2b3-fc36d6e9b728"
version = "1.6.3"
[[deps.Unzip]]
git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78"
uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d"
version = "0.2.0"
[[deps.VersionParsing]]
git-tree-sha1 = "58d6e80b4ee071f5efd07fda82cb9fbe17200868"
uuid = "81def892-9a0e-5fdd-b105-ffc91e053289"
version = "1.3.0"
[[deps.Vulkan_Loader_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Wayland_jll", "Xorg_libX11_jll", "Xorg_libXrandr_jll", "xkbcommon_jll"]
git-tree-sha1 = "2f0486047a07670caad3a81a075d2e518acc5c59"
uuid = "a44049a8-05dd-5a78-86c9-5fde0876e88c"
version = "1.3.243+0"
[[deps.Wayland_jll]]
deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg", "XML2_jll"]
git-tree-sha1 = "7558e29847e99bc3f04d6569e82d0f5c54460703"
uuid = "a2964d1f-97da-50d4-b82a-358c7fce9d89"
version = "1.21.0+1"
[[deps.Wayland_protocols_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "4528479aa01ee1b3b4cd0e6faef0e04cf16466da"
uuid = "2381bf8a-dfd0-557d-9999-79630e7b1b91"
version = "1.25.0+0"
[[deps.XML2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"]
git-tree-sha1 = "24b81b59bd35b3c42ab84fa589086e19be919916"
uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a"
version = "2.11.5+0"
[[deps.XSLT_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgcrypt_jll", "Libgpg_error_jll", "Libiconv_jll", "Pkg", "XML2_jll", "Zlib_jll"]
git-tree-sha1 = "91844873c4085240b95e795f692c4cec4d805f8a"
uuid = "aed1982a-8fda-507f-9586-7b0439959a61"
version = "1.1.34+0"
[[deps.XZ_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "cf2c7de82431ca6f39250d2fc4aacd0daa1675c0"
uuid = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800"
version = "5.4.4+0"
[[deps.Xorg_libICE_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "e5becd4411063bdcac16be8b66fc2f9f6f1e8fe5"
uuid = "f67eecfb-183a-506d-b269-f58e52b52d7c"
version = "1.0.10+1"
[[deps.Xorg_libSM_jll]]
deps = ["Libdl", "Pkg", "Xorg_libICE_jll"]
git-tree-sha1 = "4a9d9e4c180e1e8119b5ffc224a7b59d3a7f7e18"
uuid = "c834827a-8449-5923-a945-d239c165b7dd"
version = "1.2.3+0"
[[deps.Xorg_libX11_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxcb_jll", "Xorg_xtrans_jll"]
git-tree-sha1 = "afead5aba5aa507ad5a3bf01f58f82c8d1403495"
uuid = "4f6342f7-b3d2-589e-9d20-edeb45f2b2bc"
version = "1.8.6+0"
[[deps.Xorg_libXau_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "6035850dcc70518ca32f012e46015b9beeda49d8"
uuid = "0c0b7dd1-d40b-584c-a123-a41640f87eec"
version = "1.0.11+0"
[[deps.Xorg_libXcursor_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXfixes_jll", "Xorg_libXrender_jll"]
git-tree-sha1 = "12e0eb3bc634fa2080c1c37fccf56f7c22989afd"
uuid = "935fb764-8cf2-53bf-bb30-45bb1f8bf724"
version = "1.2.0+4"
[[deps.Xorg_libXdmcp_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "34d526d318358a859d7de23da945578e8e8727b7"
uuid = "a3789734-cfe1-5b06-b2d0-1dd0d9d62d05"
version = "1.1.4+0"
[[deps.Xorg_libXext_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"]
git-tree-sha1 = "b7c0aa8c376b31e4852b360222848637f481f8c3"
uuid = "1082639a-0dae-5f34-9b06-72781eeb8cb3"
version = "1.3.4+4"
[[deps.Xorg_libXfixes_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"]
git-tree-sha1 = "0e0dc7431e7a0587559f9294aeec269471c991a4"
uuid = "d091e8ba-531a-589c-9de9-94069b037ed8"
version = "5.0.3+4"
[[deps.Xorg_libXi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXext_jll", "Xorg_libXfixes_jll"]
git-tree-sha1 = "89b52bc2160aadc84d707093930ef0bffa641246"
uuid = "a51aa0fd-4e3c-5386-b890-e753decda492"
version = "1.7.10+4"
[[deps.Xorg_libXinerama_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXext_jll"]
git-tree-sha1 = "26be8b1c342929259317d8b9f7b53bf2bb73b123"
uuid = "d1454406-59df-5ea1-beac-c340f2130bc3"
version = "1.1.4+4"
[[deps.Xorg_libXrandr_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll"]
git-tree-sha1 = "34cea83cb726fb58f325887bf0612c6b3fb17631"
uuid = "ec84b674-ba8e-5d96-8ba1-2a689ba10484"
version = "1.5.2+4"
[[deps.Xorg_libXrender_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"]
git-tree-sha1 = "19560f30fd49f4d4efbe7002a1037f8c43d43b96"
uuid = "ea2f1a96-1ddc-540d-b46f-429655e07cfa"
version = "0.9.10+4"
[[deps.Xorg_libpthread_stubs_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "8fdda4c692503d44d04a0603d9ac0982054635f9"
uuid = "14d82f49-176c-5ed1-bb49-ad3f5cbd8c74"
version = "0.1.1+0"
[[deps.Xorg_libxcb_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "XSLT_jll", "Xorg_libXau_jll", "Xorg_libXdmcp_jll", "Xorg_libpthread_stubs_jll"]
git-tree-sha1 = "b4bfde5d5b652e22b9c790ad00af08b6d042b97d"
uuid = "c7cfdc94-dc32-55de-ac96-5a1b8d977c5b"
version = "1.15.0+0"
[[deps.Xorg_libxkbfile_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"]
git-tree-sha1 = "730eeca102434283c50ccf7d1ecdadf521a765a4"
uuid = "cc61e674-0454-545c-8b26-ed2c68acab7a"
version = "1.1.2+0"
[[deps.Xorg_xcb_util_cursor_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_jll", "Xorg_xcb_util_renderutil_jll"]
git-tree-sha1 = "04341cb870f29dcd5e39055f895c39d016e18ccd"
uuid = "e920d4aa-a673-5f3a-b3d7-f755a4d47c43"
version = "0.1.4+0"
[[deps.Xorg_xcb_util_image_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "0fab0a40349ba1cba2c1da699243396ff8e94b97"
uuid = "12413925-8142-5f55-bb0e-6d7ca50bb09b"
version = "0.4.0+1"
[[deps.Xorg_xcb_util_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libxcb_jll"]
git-tree-sha1 = "e7fd7b2881fa2eaa72717420894d3938177862d1"
uuid = "2def613f-5ad1-5310-b15b-b15d46f528f5"
version = "0.4.0+1"
[[deps.Xorg_xcb_util_keysyms_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "d1151e2c45a544f32441a567d1690e701ec89b00"
uuid = "975044d2-76e6-5fbe-bf08-97ce7c6574c7"
version = "0.4.0+1"
[[deps.Xorg_xcb_util_renderutil_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "dfd7a8f38d4613b6a575253b3174dd991ca6183e"
uuid = "0d47668e-0667-5a69-a72c-f761630bfb7e"
version = "0.3.9+1"
[[deps.Xorg_xcb_util_wm_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "e78d10aab01a4a154142c5006ed44fd9e8e31b67"
uuid = "c22f9ab0-d5fe-5066-847c-f4bb1cd4e361"
version = "0.4.1+1"
[[deps.Xorg_xkbcomp_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxkbfile_jll"]
git-tree-sha1 = "330f955bc41bb8f5270a369c473fc4a5a4e4d3cb"
uuid = "35661453-b289-5fab-8a00-3d9160c6a3a4"
version = "1.4.6+0"
[[deps.Xorg_xkeyboard_config_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xkbcomp_jll"]
git-tree-sha1 = "691634e5453ad362044e2ad653e79f3ee3bb98c3"
uuid = "33bec58e-1273-512f-9401-5d533626f822"
version = "2.39.0+0"
[[deps.Xorg_xtrans_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "e92a1a012a10506618f10b7047e478403a046c77"
uuid = "c5fb5394-a638-5e4d-96e5-b29de1b5cf10"
version = "1.5.0+0"
[[deps.ZMQ]]
deps = ["FileWatching", "Sockets", "ZeroMQ_jll"]
git-tree-sha1 = "356d2bdcc0bce90aabee1d1c0f6d6f301eda8f77"
uuid = "c2297ded-f4af-51ae-bb23-16f91089e4e1"
version = "1.2.2"
[[deps.ZeroMQ_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "libsodium_jll"]
git-tree-sha1 = "fe5c65a526f066fb3000da137d5785d9649a8a47"
uuid = "8f1865be-045e-5c20-9c9f-bfbfb0764568"
version = "4.3.4+0"
[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.13+0"
[[deps.Zstd_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "49ce682769cd5de6c72dcf1b94ed7790cd08974c"
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4"
version = "1.5.5+0"
[[deps.eudev_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "gperf_jll"]
git-tree-sha1 = "431b678a28ebb559d224c0b6b6d01afce87c51ba"
uuid = "35ca27e7-8b34-5b7f-bca9-bdc33f59eb06"
version = "3.2.9+0"
[[deps.fzf_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "868e669ccb12ba16eaf50cb2957ee2ff61261c56"
uuid = "214eeab7-80f7-51ab-84ad-2988db7cef09"
version = "0.29.0+0"
[[deps.gperf_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "3516a5630f741c9eecb3720b1ec9d8edc3ecc033"
uuid = "1a1c6b14-54f6-533d-8383-74cd7377aa70"
version = "3.1.1+0"
[[deps.libaom_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "3a2ea60308f0996d26f1e5354e10c24e9ef905d4"
uuid = "a4ae2306-e953-59d6-aa16-d00cac43593b"
version = "3.4.0+0"
[[deps.libass_jll]]
deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "5982a94fcba20f02f42ace44b9894ee2b140fe47"
uuid = "0ac62f75-1d6f-5e53-bd7c-93b484bb37c0"
version = "0.15.1+0"
[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.8.0+0"
[[deps.libevdev_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "141fe65dc3efabb0b1d5ba74e91f6ad26f84cc22"
uuid = "2db6ffa8-e38f-5e21-84af-90c45d0032cc"
version = "1.11.0+0"
[[deps.libfdk_aac_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "daacc84a041563f965be61859a36e17c4e4fcd55"
uuid = "f638f0a6-7fb0-5443-88ba-1cc74229b280"
version = "2.0.2+0"
[[deps.libinput_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "eudev_jll", "libevdev_jll", "mtdev_jll"]
git-tree-sha1 = "ad50e5b90f222cfe78aa3d5183a20a12de1322ce"
uuid = "36db933b-70db-51c0-b978-0f229ee0e533"
version = "1.18.0+0"
[[deps.libpng_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "94d180a6d2b5e55e447e2d27a29ed04fe79eb30c"
uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f"
version = "1.6.38+0"
[[deps.libsodium_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "848ab3d00fe39d6fbc2a8641048f8f272af1c51e"
uuid = "a9144af2-ca23-56d9-984f-0d03f7b5ccf8"
version = "1.0.20+0"
[[deps.libvorbis_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll", "Pkg"]
git-tree-sha1 = "b910cb81ef3fe6e78bf6acee440bda86fd6ae00c"
uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a"
version = "1.3.7+1"
[[deps.mtdev_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "814e154bdb7be91d78b6802843f76b6ece642f11"
uuid = "009596ad-96f7-51b1-9f1b-5ce2d5e8a71e"
version = "1.1.6+0"
[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.48.0+0"
[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
version = "17.4.0+0"
[[deps.x264_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "4fea590b89e6ec504593146bf8b988b2c00922b2"
uuid = "1270edf5-f2f9-52d2-97e9-ab00b5d0237a"
version = "2021.5.5+0"
[[deps.x265_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "ee567a171cce03570d77ad3a43e90218e38937a9"
uuid = "dfaa095f-4041-5dcd-9319-2fabd8486b76"
version = "3.5.0+0"
[[deps.xkbcommon_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Wayland_jll", "Wayland_protocols_jll", "Xorg_libxcb_jll", "Xorg_xkeyboard_config_jll"]
git-tree-sha1 = "9c304562909ab2bab0262639bd4f444d7bc2be37"
uuid = "d8fb68d0-12a3-5cfd-a85a-d49703b185fd"
version = "1.4.1+1"
......@@ -2,3 +2,6 @@
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
[compat]
julia = "1.6"
......@@ -5,14 +5,16 @@ Das Kursmaterial wurde aus zwei Quellen angepasst:
- der [Kurs](https://github.com/mfherbst/2022-rwth-julia-workshop.git) von Michael Herbst ([MIT Lizenz](https://opensource.org/licenses/mit/)).
- das Buch [ThinkJulia](https://benlauwens.github.io/ThinkJulia.jl/latest/book.html) von Allen Downey und Ben Lauwens ([Creative Commons Namensnennung-Nicht-kommerziell 3.0 Unported Lizenz](https://creativecommons.org/licenses/by-nc/3.0/deed.de)).
Eine sehr umfangreiche Spickzettel findest du [hier](https://cheatsheet.juliadocs.org/).
## Software und Material
Der Kurs erfordert verschiedene Dinge: eine funktionierende Installation von [Julia 1.9](https://julialang.org/downloads/), [Jupyter](https://jupyter.org/), [IJulia.jl](https://github.com/JuliaLang/IJulia.jl), das Kursmaterial und verschiedene Abhängigkeiten. Um alles zu bekommen, befolgen Sie diese Schritte:
Der Kurs erfordert verschiedene Dinge: eine funktionierende Installation von [Julia 1.9](https://julialang.org/downloads/), [Jupyter](https://jupyter.org/), [IJulia.jl](https://github.com/JuliaLang/IJulia.jl), das Kursmaterial und verschiedene Abhängigkeiten. Um alles zu herunterzuladen und zu installieren, befolgst Du diese Schritte:
### 1) Julia herunterladen
Um dem Kurs zu folgen, benötigst du **Julia 1.9**.
Julia kann leicht in binärer Form von den [Julia-Downloads](https://julialang.org/downloads/) bezogen werden.
### 2) Alles andere herunterladen
### 2) Alles andere
Um die verbleibenden Dateien und Abhängigkeiten zu erhalten, starte `julia` und kopiere im resultierenden REPL-Shell folgenden Code:
```julia
......@@ -22,9 +24,9 @@ include(script)
```
Das [lädt das install.jl-Skript herunter](https://gitlab.mathematik.uni-stuttgart.de/stammbn/julia-seminar/-/raw/main/install.jl?ref_type=heads) und führt es in Julia aus.
### 2) Den Rest bekommen (Experten-Version)
### 2) Alles andere (Experten-Version)
Als Alternative können Sie auch die folgenden Befehle manuell ausführen (dies setzt voraus, dass `git` und `julia` von der Kommandozeile aus verfügbar sind):
Als Alternative kannst Du auch die folgenden Befehle manuell ausführen (dies setzt voraus, dass `git` und `julia` von der Kommandozeile aus verfügbar sind):
```
git clone https://gitlab.mathematik.uni-stuttgart.de/stammbn/Julia-seminar/
cd Julia-seminar
......@@ -32,17 +34,15 @@ julia install-manual.jl
```
### 3) Starten des Notebooks
Um das Notebook zu starten, stellen Sie sicher, dass Sie sich im Ordner `Julia-seminar` befinden, und führen Sie dann `julia` aus: Eine interaktive Julia-Befehlszeile wird geöffnet. Führen Sie darin folgenden Befehl aus:
Um das Notebook zu starten, stelle sicher, dass Du Dich im Ordner `Julia-seminar` befindest, und führe dann `julia` aus: Eine interaktive Julia-Befehlszeile wird geöffnet. Führe darin folgenden Befehl aus:
```
using IJulia; notebook(dir=pwd())
```
und das Notebook wird automatisch im Browser geöffnet.
Navigiere zu den Dateien und öffne das Notebook Nummer 0.
### Fehlerbehebung
Wenn Sie auf Probleme stoßen, werfen Sie einen Blick auf den [ausgezeichneten Problembehandlungsabschnitt](https://carstenbauer.github.io/WorkshopWizard.jl/dev/troubleshooting/) aus dem WorkshopWizard-Paket von Carsten Bauer (das von `install.jl` verwendet wird).
Wenn Du auf Probleme stößt, werfe einen Blick auf den [ausgezeichneten Problembehandlungsabschnitt](https://carstenbauer.github.io/WorkshopWizard.jl/dev/troubleshooting/) aus dem WorkshopWizard-Paket von Carsten Bauer (das von `install.jl` verwendet wird).
# Julia-seminar
......@@ -51,6 +51,8 @@ The course material is adapted from two sources:
- the [course](https://github.com/mfherbst/2022-rwth-julia-workshop.git) from Michael Herbst ([MIT license](https://opensource.org/license/mit/)).
- the book [ThinkJulia](https://benlauwens.github.io/ThinkJulia.jl/latest/book.html) from Allen Downey and Ben Lauwens ([Creative Commons Attribution-NonCommercial 3.0 Unported license](https://creativecommons.org/licenses/by-nc/3.0/deed.en)).
A very rich cheat-sheet can be found [here](https://cheatsheet.juliadocs.org/).
## Software and material
The course requires various things: a working installation of [Julia 1.9](https://julialang.org/downloads/), [Jupyter](https://jupyter.org/), [IJulia.jl](https://github.com/JuliaLang/IJulia.jl), the course material and various dependencies. To get everything follow these steps:
......
using Pkg
Pkg.activate(".")
using IJulia
notebook(dir=pwd())