Skip to content

Commit 773d80a

Browse files
Merge pull request #278 from coding-for-reproducible-research/julia_session_2
Julia session 2 Content
2 parents 493c8cb + 4533cc5 commit 773d80a

File tree

8 files changed

+764
-509
lines changed

8 files changed

+764
-509
lines changed

_toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ parts:
113113
- file: individual_modules/introduction_to_julia/control_flow
114114
- file: individual_modules/introduction_to_julia/functions
115115
- file: individual_modules/introduction_to_julia/arrays_and_matrices
116+
- file: individual_modules/introduction_to_julia/io
117+
- file: individual_modules/introduction_to_julia/package_management
116118
- file: course_homepages/python
117119
sections:
118120
- file: individual_modules/section_landing_pages/introduction_to_python
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1
2+
-4.3
3+
42
4+
3.14

individual_modules/introduction_to_julia/functions.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@
754754
"\n",
755755
"The benefits of this are:\n",
756756
"\n",
757-
"- **Performance**: Julia will pick the most specific method and compile optimised machine code for that method. This is especially valuable for methods that get called multiple times (e.g. within a loop).\n",
757+
"- **Performance**: Julia will pick the most specific method and compile optimised machine code for that method. This is especially valuable for methods that get called multiple times (e.g. within a loop). To make best use of this, it's important to ensure we write functions in a way that allows Julia to infer the types input/output at each step of the computation (more about this later in the course).\n",
758758
"- **Extensibility and flexibility**: Code can be written in a way to provide special cases for specific types when needed. Users can add new methods to functions (even those from the standard library or other packages) for new types they define without modifying the original code, a form of polymorphism.\n",
759759
"- **Clarity**: We can use the dispatch mechanism instead of writing functions with long chains of type-checking `if-else` statements.\n",
760760
"\n",

individual_modules/introduction_to_julia/introduction_to_julia.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"Each method shares the same name `add` but has different implementations for the types it handles. This makes the code:\n",
6262
"\n",
6363
"- **Clear and concise**: There is no need to add different code paths through functions based on checking types of arguments.\n",
64-
"- **Fast**: Julia compiles a specialised version for each method call at runtime. \n",
64+
"- **Fast**: Julia compiles a specialised version for each method call as required, using *just-in-time* (JIT) compilation. \n",
6565
"- **Extensible**: New implementations of `add` can easily be added for new combinations of types.\n",
6666
"\n",
6767
"Julia is also designed to be **dynamically typed**; you do not need to declare types for variables, as the type is determined at runtime, alongside using automatic memory management (garbage collection), so you don't have to manually allocate or free memory in typical usage. \n",
@@ -70,8 +70,8 @@
7070
"\n",
7171
"Julia incorporates many features that make it powerful for numerical and scientific computing:\n",
7272
"\n",
73-
"- **High Performance**: Thanks to JIT compilation using LLVM, Julia can approach or match the speed of C and Fortran for many tasks, meaning you often don't need to rewrite performance-critical code in another language. Code written in pure Julia is typically fast if written with performance in mind. \n",
74-
"- **Multiple Dispatch**: Multiple dispatch allows the standard library and packages to define methods optimised for different types (e.g. arrays of floats vs ints) seamlessly. This contributes to performance. It also makes it straightforward to extend the code to support new types as-and-when useful.\n",
73+
"- **High Performance**: Julia can approach or match the speed of C and Fortran for many tasks, meaning you often don't need to rewrite performance-critical code in another language. Julia features just in time compilation using LLVM and, where possible, specialises function calls according to types that are inferred during compilation. This means that code written in pure Julia is typically fast if written in a way that maximises Julia's type inference capabilities (as well as other performance considerations).\n",
74+
"- **Multiple Dispatch**: Multiple dispatch allows the standard library and packages to define methods optimised for different types (e.g. arrays of floats vs ints) seamlessly. As well as being at the heart of Julia's performance capabilities, it also makes it straightforward to extend the code to support new types as-and-when useful.\n",
7575
"- **Good support for Numerical Computing**: Julia has built-in support for things like arbitrary precision arithmetic, regular expressions, and powerful libraries for linear algebra and random numbers. Julia's package manager makes it easy to add external packages for specialised functionality, such as statistics, plotting, optimisation, etc.\n",
7676
"- **Interactive and Reproducible**: Julia can be used interactively (e.g. via the REPL or Jupyter notebooks) just like Python or R, which is great for exploration. Julia also has the built-in `Pkg` standard library that uses **Project** and **Manifest** files to pin exact dependency versions and ensure your environment can be recreated anywhere.\n",
7777
"- **Learning from older languages**: To some extent, Julia has been able to implement lessons that other languages had to learn the hard way, especially around it's tooling. For example, its package management system is easy to use, it has unit testing support directly in the standard library, and it has a a go-to [documentation generator](https://documenter.juliadocs.org/stable/).\n",

0 commit comments

Comments
 (0)