JuliaKurs23/nb/intro.ipynb

115 lines
3.1 KiB
Plaintext

{
"cells": [
{
"cell_type": "raw",
"id": "10c7d783",
"metadata": {},
"source": [
"---\n",
"title: Introduction\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "f2e8fc05",
"metadata": {},
"source": [
"## Noch eine Programmiersprache?\n",
"\n",
"Die Ziele der Schöpfer von Julia kann man in [Why we created Julia](https://julialang.org/blog/2012/02/why-we-created-julia/) nachlesen. Kurzfassung:\n",
"\n",
"“We want a language that is\n",
"\n",
"open source\n",
"with the speed of C\n",
"obvious, familiar mathematical notation like Matlab\n",
"as usable for general programming as Python\n",
"as easy for statistics as R\n",
"as natural for string processing as Perl\n",
"as powerful for linear algebra as Matlab\n",
"as good at gluing programs together as the shell\n",
"dirt simple to learn, yet keeps the most serious hackers happy”\n",
"\n",
"\n",
"\"Wir wollen eine Sprache, die\n",
"\n",
"- *open source* ist \n",
"- die Geschwindigkeit von C hat \n",
"- obvious, familiar mathematical notation like Matlab\n",
"- as usable for general programming as Python\n",
"- as easy for statistics as R\n",
"- as natural for string processing as Perl\n",
"- as powerful for linear algebra as Matlab\n",
"- as good at gluing programs together as the shell\n",
"- dirt simple to learn, yet keeps the most serious hackers happy\"\n",
"\n",
"vs code: erzeuge eine Datei mit der Endung `.jl`, starte ein REPL mit dem Kommando \n",
"Alt-Enter am Ende einer Zeile oder Anweisung f\"uhrt dazu, dass die Anweisung \n",
"is REPL kopiert und ausgefuehrt wird\n",
"\n",
"alt-enter execute in julia Repl\n",
"shift-enter: ex. and move to next line\n",
"\n",
"die Erstinstallation von Paketen kann sehr lange dauern. \n",
"\n",
"im Jupyterhub sind die im Kurs nenötigten Pakete vorinstalliert. \n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"## colored console graphs produced by `Benchmarktools.jl`\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "62fcada8",
"metadata": {},
"outputs": [],
"source": [
"using BenchmarkTools\n",
"\n",
"@benchmark sum(rand(1000))"
]
},
{
"cell_type": "markdown",
"id": "00dc9599",
"metadata": {},
"source": [
"## structure of floating point numbers\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ccc6afab",
"metadata": {},
"outputs": [],
"source": [
"function printbitsf64(x::Float64)\n",
" s = bitstring(x)\n",
" printstyled(s[1], color = :blue, reverse=true)\n",
" printstyled(s[2:12], color = :green, reverse=true)\n",
" printstyled(s[13:end], color=:red, bold=true, reverse=true)\n",
" print(\"\\n\")\n",
"end\n",
"\n",
"printbitsf64(27.56640625)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.8.5",
"language": "julia",
"name": "julia-1.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}