Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Advanced Topics from Scientific Computing
TU Berlin Winter 2022/23
Notebook 02
Creative Commons Lizenzvertrag Jürgen Fuhrmann

html"""
<b> Advanced Topics from Scientific Computing<br>
TU Berlin Winter 2022/23<br>
Notebook 02<br>
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons Lizenzvertrag" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/80x15.png" /></a>
Jürgen Fuhrmann
</b> <br>
"""
3.8 ms
TableOfContents(title="")
26.0 μs

Julia - first contact

General information

Resources

This notebook tries to give a first introduction to Julia, featuring standard features which can be found in other languages as well. More Julia-specific things come later.

md"""
# Julia - first contact
## General information
### Resources
- [Homepage](https://julialang.org)
- [Documentation](https://docs.julialang.org/en/v1/)
- [Cheat Sheet](https://juliadocs.github.io/Julia-Cheat-Sheet/)
- [WikiBook](https://en.wikibooks.org/wiki/Introducing_Julia)
- [7 Julia Gotchas and How to Handle Them](https://www.stochasticlifestyle.com/7-julia-gotchas-handle/)


This notebook tries to give a first introduction to Julia, featuring standard features which can be found in other languages as well. More Julia-specific things come later.
"""
2.8 ms

Open Source

  • Julia is an Open Source project started at MIT

  • Julia itself is distributed under an MIT license

    • packages often have different licenses

  • Development takes place on github

  • As of October 2021, more than 1200 contributors to the code

  • The Open Source paradigm corresponds well to the fundamental requirement that scientific research should be transparent and reproducible

md"""
__[Open Source](https://opensource.org/)__
- Julia is an Open Source project started at MIT
- Julia itself is distributed under an [MIT license](https://github.com/JuliaLang/julia/blob/master/LICENSE.md)
- packages often have different licenses
- Development takes place on [github](https://github.com/JuliaLang/julia)
- As of October 2021, more than 1200 contributors to the code
- The Open Source paradigm corresponds well to the fundamental requirement that scientific research should be [transparent and reproducible](https://doi.org/10.5281/zenodo.1172988)

"""
598 μs

How to install and run Julia

  • Installation:

    • Download from julialang.org (recommended by Julia creators)

    • Long term support (LTS) Version: 1.6

    • Current stable version: 1.8.2 (recommended for this course)

    • Installation via system package manager (yast, apt-get, homebrew...)

  • Workflows:

    • Pluto notebooks in the browser

    • From command line: Edit source code in any editor

    • Julia plugin of Visual Studio code editor

    • Jupyter notebooks in the browser

md"""
### How to install and run Julia
- Installation:
- [Download](https://julialang.org/downloads/) from julialang.org (recommended by Julia creators)
- Long term support (LTS) Version: 1.6
- Current stable version: 1.8.2 (recommended for this course)
- Installation via system package manager (yast, apt-get, homebrew...)
- Workflows:
- Pluto notebooks in the browser
- From command line: Edit source code in any editor
- Julia plugin of Visual Studio code editor
- Jupyter notebooks in the browser
"""
703 μs

Standard number types

  • Julia is a strongly typed language, so any variable has a type.

  • Standard number types allow fast execution because they are supported in the instruction set of the processors

  • Default types are autodected from expression

  • The typeof function allows to detect the type of a variable

  • The sizeof funtion detects the size in bytes of a variable (1 byte = 8 bit)

md"""
## Standard number types
- Julia is a strongly typed language, so any variable has a type.
- Standard number types allow fast execution because they are supported in the instruction set of the processors
- Default types are autodected from expression
- The `typeof` function allows to detect the type of a variable
- The `sizeof` funtion detects the size in bytes of a variable (1 byte = 8 bit)
"""
434 μs

Integers

Integer variables are used to represent integer numbers.

md"""
### Integers

Integer variables are used to represent integer numbers.
"""
185 μs
i
10
i=10
9.4 μs
Int64
typeof(i)
8.7 μs
8
sizeof(i)
10.0 μs

Besides of the default Int64 type, Julia knows Int8, Int16, Int32

md"""
Besides of the default `Int64` type, Julia knows `Int8`, `Int16`, `Int32`
"""
148 μs
10
j::Int16=10
12.6 μs
Int16
typeof(j)
8.0 μs
2
sizeof(j)
8.3 μs

Floating point numbers

Floating point variables are used to represent real numbers up to some precision.

md"""
### Floating point numbers


Floating point variables are used to represent real numbers up to some precision.

"""
155 μs
x
10.0
x=10.0
8.1 μs
Float64
typeof(x)
8.4 μs
8
sizeof(x)
8.3 μs

There is also Float16, Float32

md"""
There is also `Float16`, `Float32`
"""
131 μs
144.3
y::Float32=144.3
1.9 ms
4
sizeof(y)
8.7 μs
Loading...