Julia

252 readers
1 users here now

founded 1 year ago
MODERATORS
1
2
3
 
 

Think Julia is available under the Creative Commons Attribution-NonCommercial 3.0 Unported License.

A paper version of this book is published by O’Reilly Media and can be bought on Amazon.

Preface

In January 2018 I started the preparation of a programming course targeting students without programming experience. I wanted to use Julia, but I found that there existed no book with the purpose of learning to program with Julia as the first programming language. There are wonderful tutorials that explain Julia’s key concepts, but none of them pay sufficient attention to learning how to think like a programmer.

I knew the book Think Python by Allen Downey, which contains all the key ingredients to learn to program properly. However, this book was based on the Python programming language. My first draft of the course notes was a melting pot of all kinds of reference works, but the longer I worked on it, the more the content started to resemble the chapters of Think Python. Soon, the idea of developing my course notes as a port of that book to Julia came to fruition.

All the material was available as Jupyter notebooks in a GitHub repository. After I posted a message on the Julia Discourse site about the progress of my course, the feedback was overwhelming. A book about basic programming concepts with Julia as the first programming language was apparently a missing link in the Julia universe. I contacted Allen to ask if I could start an official port of Think Python to Julia, and his answer was immediate: “Go for it!” He put me in touch with his editor at O’Reilly Media, and a year later I was putting the finishing touches on this book.

It was a bumpy ride. In August 2018 Julia v1.0 was released, and like all my fellow Julia programmers I had to do a migration of the code. All the examples in the book were tested during the conversion of the source files to O’Reilly-compatible AsciiDoc files. Both the toolchain and the example code had to be made Julia v1.0–compliant. Luckily, there are no lectures to give in August….

I hope you enjoy working with this book, and that it helps you learn to program and think like a computer scientist, at least a little bit.

Ben Lauwens

4
 
 

Victor Buendía (@[email protected]) writes:

Turns out that #julialang does not have the equivalent of Numpy's gradient function. So I went to Numpy docs and source code and adapted it.

Numpy's gradient is great because it uses centered differences, so it's way more accurate than naively getting the forward differences. Also, supports non-equally spaced grids.

In case someone needs it (for 1D arrays only), here it is:

https://gist.github.com/VictorSeven/996e0745e820dde0610ada9e9e025844

Source

5
6
 
 

Tip:

In Julia mode, the REPL supports something called prompt pasting. This activates when pasting text that starts with julia> into the REPL. In that case, only expressions starting with julia> (as well as the other REPL mode prompts: shell>, help?>, pkg> ) are parsed, but others are removed.

7
 
 

Martin D. Maas writes:

Julia is an is a general-purpose, open-source, dynamic, and high-performance language. By leveraging a clever design around a just in time (JIT) compiler, Julia manages to combine the speed of languages like C or Fortran, with the ease of use of Matlab or Python.

This is a hands-on tutorial series, which focuses on understanding the most important aspects of the language from a practical point of view, and focusing on the needs of scientists and engineers.

In particular, we won’t be introducing much more syntax or language features than what is required to solve the different problems we will be tackling.

As a quick reference, and if you have experience with Python or Matlab, it might be worth to check out the Matlab-Python-Julia Cheatsheet.

Read Julia Programming Tutorial
Total: 37 posts
Last updated: November 13, 2023

8
 
 

Apr 18, 2023 Matthijs Cox writes:

The “two language problem” was globally accepted for several decades. You just learn to live with it. Until one day it was challenged by the Julia language, a programming language that promises both speed and ease of use. As I feel the pain of the two language problem deeply, I wanted to try out this new solution. So together with several allies I went on a mission to adopt this new technology at work, and remove the bottleneck.

While we had initial success and attention, we quickly stumbled into resistance from the existing groups of researchers/scientists and developers. Over time I have named this the “two culture problem”. In the beginning I didn’t see the cultures clearly, which limited our success. I was too focused on the technological problem itself.

I will refer to the two cultures as “scientists” versus “developers”. However, the “scientists” group generalizes to anyone who codes quick and dirty to explore, such as domain experts, data analysts and others like that. I do hope everyone is doing their exploration somewhat scientifically, so the generalization should makes sense. Scientists typically want to get their stuff done, perhaps with code, but they don't care about the code. Software developers care deeply about the code craftsmanship, sometimes obsessively so, but often developers barely understand the business domain or science. There are people near the middle, trying to balance both, but they are a rare breed.

Read My Target Audience

9
 
 

Jan 31st 2024 Krastanov writes:

A monthly newsletter, mostly on julia internals, digestible for casual observers. A biased, incomplete, editorialized list of what I found interesting this month, with contributions from the community.

“Internals” Fora and Core Repos (Slack/Zulip/Discourse/Github):

  • Julia 1.10 was released around Christmass. See the release highlights.
  • It seems we all agree that it would be incredibly valuable to have better ways to call julia from inside python. This discourse thread has plenty of discussion on the topic, but specifically check out Chris’s comments which has a bunch of constructive suggestions towards the end.
  • Rounding operations on Complex numbers (into presumably complex integers) are pretty difficult to do consistently. On the issue tracker folks have been discussing various ways to do it, and the dangers of being too permissive in what interfaces might emerge by accident. It is not feasible to summarize the entire story, as the thread is a bit meandering and has some contextual miscommunications, but a valuable read nonetheless. Arbitrarily, consider starting with this comment.
  • A lot of ongoing discussion in various places on how to deal with asynchronous exceptions (interrupts from the outside or stack overflows, that can happen at much weirder ill-defined times compared usual exceptions). This is a good starting point for the discussion. There are comments with interesting references to how other languages deal with this as well.
  • Now that we have a public keyword, people are thinking about how to better protect (or mark as sensitive) package internals, to avoid accidental dependencies on unstable implementation details.
  • A wonderful explanation of how “world splitting” used to be a great optimization in the compiler that can now lead to invalidating large amounts of code, cause recompilation, and de-optimization. The thread as a whole has other useful pieces of wisdom, but it is a bit meandering.
  • A wonderful case study in fixing method invalidations and compilation latency (using Pkg.jl as an example). See this related older post on similar topics.
  • An interesting discussion on the idiosyncrasies of computing type intersections (the set of types that are at the same time subtypes of two given types) in Julia. The operation is not commutative.
  • Fun examples of how the update to a new LLVM is now changing the loop unrolling behavior (occasionally to detrimental effects) on slack and github

Read This month in Julia world - 2024-01

10
11
12
13
14
 
 

Dr. Chris Rackauckas (@[email protected]) writes:

#julialang GPU-based ODE solvers which are 20x-100x faster than those in #jax and #pytorch? Check out the paper on how #sciml DiffEqGPU.jl works. Instead of relying on high level array intrinsics that #machinelearning libraries use, it uses a direct kernel generation approach to greatly reduce the overhead.

Read Automated translation and accelerated solving of differential equations on multiple GPU platforms

15
 
 

Richard McElreath has made his course materials available on GitHub.

However, the course follows the 2nd edition of McElreath's book Statistical Rethinking which is not available in a free digital format.

After watching the first lecture in the Statistical Rethinking 2023 YouTube Playlist, I might go ahead and purchase the text and use this course instead of Trevor Hastie and Rob Tibshirani's An Introduction to Statistical Learning (with Applications in R or Python) course.

I also like that this resource has made an explicit attempt to provide code examples in Julia as well as the more popular Python and R.

I wasn't sure who Richard McElreath was so I did a quick search which revealed his position as Director of the Department of Human Behavior, Ecology and Culture at the Max Planck Institute for Evolutionary Anthropology in Leipzig.

16
17
 
 

Last week I was in Münster, Germany, to discuss Spatial Data Science across the @julia, @python, and #r languages (https://r-spatial.org/sdsl/). I think it is fair to say that everyone learned a lot from one another and there are now several efforts to align the ecosystems
in terms of teaching, file formats, and others. In JuliaGeo we still have to implement some geography methods. Thanks to @edzer and Yomna for organizing.

18
 
 

Last month I taught @julia and its geospatial stack at the @opengeohub summer school 2023 in beautiful Poznań, Poland. I had a great time together with other open-source developers. Pictured is me calling in from the train home, because I won a hackathon by using Julia 🥳.

My materials (including the notebooks for the hackathons) are at https://github.com/evetion/OGH2023 and the recording(s) are at https://www.youtube.com/watch?v=UgMdr8vE9uM&list=PLXUoTpMa_9s1C8LrkslIctOU31Oi0LAQa.

19
 
 

Initial commit was June 11. Documentation is here.

20
 
 

Julia has hit the TIOBE index top 20. This is the first time in history! Born about 13 years ago, Julia is a really young programming language. So what makes Julia unique? Why does it deserve this top 20 position? Julia is especially used in the data science and mathematical computation world. But we already have got top 20 contenders in this field such as Python, R and MATLAB. So why then Julia?

21
 
 

I just tried my first problem on Codewars and realised: This solution feels like cheating

22
23
 
 

“We are very excited by this new strategic investment from AEI HorizonX,” said Dr. Viral Shah, Chief Executive Officer of JuliaHub. “In recent years, Julia’s superior speed and ease of use have been put to work for pharmaceutical companies such as Pfizer and United Therapeutics, and for aerospace applications at NASA, the Federal Aviation Administration and Boeing. This investment allows us to continue to develop and help deploy Julia’s capabilities across all industries.”

24
 
 

Hey, I thought I could spark some discussion here, so I'll just ask what I've been wondering about.

So, what is the difference between JuMP and Optim.jl? Or is it possible to use Optim's optimizers with JuMP?

Some ELI5 would be awesome.

Thanks

25
 
 

A quick overview of the Julia Programming language.

view more: next ›