Why Julia
(too) many dynamic languages to choose from: Python, R, etc.
(too) many classifications:
high level VS low level languages: C / C++ / Fortran
implementations: compiled VS interpreted
from a user point of view
write source code -> compile -> run the program
run directly the source code
scripting mode
source code -> compile -> run
Read–Evaluation–Print Loop (REPL)
dynamically-typed language
x = 1.0
x = -1.0 + 0 *im
x = [1 2 ; 3 4 ]
f(x) = sqrt(x)
g(x) = exp(x)
h(x) = log(x)
but the convenience comes with a cost: slow .
why Python is slow?
not (only) because it's interpreted
many codes are already implemented in C, should be fast!
it's a data type problem:
type inference and type stability
obj.method(x, y) VS method(obj, x, y)
Why Julia (for this course)
learning what to calculate (i.e. physics) is hard enough
...and there is no free lunch
beginner friendly and easy to learn
Why Julia (for this course)
useful built-in functions:
eigen, inv, vector multiplication
no need to import numpy as np, etc...
start counting from 1 (don't argue!)
column-major
functions (and structures) have a clear "end"
Why Julia (for this course)
it is fast enough
loops are fast
to vectorize or not, is just a matter of style
JIT compiler
have fun: try something new and exciting, and see how far we can go...
may contribute to some new packages and documentation
about programming
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?
Brian Kernighan, The Elements of Programming Style, 2nd edition.
pep8 for python
julia style guide
class rule
rule #1: you do not talk about NUMQM2021.
rule #2: you DO NOT talk about NUMQM2021.
rule #3: do not use the sample codes provided, they are ugly and inefficient, improve them instead.
class rule
rule #4: undergraduate students are watching (and grading) us: explain things so that they can understand.
rule #5: when you have to choose between right (but boring) and wrong (but funny) answers, choose the wrong ones.
rule #6: follow the instructions of HAL .
Previous slide Page 1 of 15 Next slide Toggle fullscreen Open presenter view