Julia learning material for high school students

Hello,

With schools closed, my daughters are interested in (or at least willing to try :wink: learning a programming language. I had initially thought of Racket after seeing Matthias Felleisen’s video but I believe Julia is probably a better choice for them.
My objectives are:

  1. to give them a taste of programming as a superpower (for school assignments but not just that)
  2. give them a better grasp of functions (which was a central point in Felleisen’s argument)

Now I am aware of the treasure trove of material at Get started with Julia but most seems to be geared towards college students. Can anyone recommend tutorials, books, videos, etc. (English or French) that would be more suitable for high school students? They are 15 and 17.

Also, does any one here have experience teaching their kids Julia? Any tips you can share?
Many thanks!
-Benoit

6 Likes

Think Julia? That might be at the right level.

1 Like

Maybe this book? I haven’t read it before but it seems to be for beginners.

Is this their first programming language (ie their first encounter with programming)?

Generally, introductory materials for most languages have no prerequisites, so general notes on the language for college students may be just fine for a motivated high school student.

The difficult part may be finding materials that engage younger students. Most users of Julia are motivated to learn it for some application (usually scientific programming). While Racket has course materials developed with younger people in mind (simple graphics and games), I am not aware of anything similar for Julia.

You may just want to look at their school assignments and help them solve them in Julia, gradually introducing the relevant concepts.

5 Likes

Thank you @PetrKryslUCSD @tk3369 for the suggestions! I will look.

You are right that engagement (and motivation) are key. I will look for packages/projects that may align with their interests, and that they could use for school assignments. Yes, it’s their first programming language.

1 Like

While I love julia, it may not be the best first language for kids to learn. Even though it wasn’t my first language, the one that really got me into programming was processing. It’s an incredible language that has variants in java, javascript, and python (only the java one existed when I learned, and it was great! As clunky as java seems to me now, I still love processing!). Check out some of what people do with it if you’re interested.

It may be heresy to say this on the julia discourse board, but that’s my two cents. I never used processing for a school assignment (outside of art class) but it taught me the principles of code (which are easily translatable).

– edit to add:
If you’re interested, I can point you to endless excellent resources!

3 Likes

Thanks! Not heresy at all. It’s just that the most obvious application/motivation of programming for them is their math/science assignments, for which Julia is an obviously great choice. If they get more interested in programming per se, then Processing might interest them a lot, I agree.

True, true. Julia can’t be beat in that respect.

For me at least, fun has always been a greater motivator than work :laughing:. I went digging after posting you that link earlier and came across a pretty nifty 5 line sketch!

2 Likes

Nice little composition in Processing there! I think using simple graphics to introduce programming is definitely an approach worth investigating. We had something similar going in the recent Google Code-In.

The Processing code is five lines. Here’s two of them:

for(r=0;r<s;r+=5){for(a=0;a<TAU;a+=PI/30){R=r/s*TAU
fill(0);circle(sin(a+sin(R+a)+t)*r,cos(a+t)*r,R)}}t+=.02}

!

One way of doing something similar in Julia would be this:

using Luxor

function frame(scene, fn)
    background("white")
    sethue("black")
    δ = scene.movie.width/2
    for r in 1:5:scene.movie.width
        for i in 0:π/30:2π
            θ = i + rescale(fn, 1, scene.framerange.stop, 0, 2π)
            R = r/scene.movie.width * 2π 
            circle(sin(i + sin(R + θ) + δ) * r, cos(θ + δ) * r, 1 + R/2, :fill)
        end
        δ += 0.02
    end
end
circlewave = Movie(500, 500, "circlewave")
animate(circlewave, [Scene(circlewave, frame, 1:200)],
    creategif=true, pathname="/tmp/circlewave.gif")

circlewave

It’s not five lines though. (I don’t play golf… :slight_smile: )

13 Likes

Not entirely on-topic, but Humble Bundle currently has a bundle of books to teach programming to kids. Not in Julia, unfortunately, but I thought it may still be helpful.

@cormullion awesome port! And I didn’t know about Luxor, so that’s a package to note for sure. I wouldn’t trade processing for making images/animations/interactive widgets this way, but I’ll certainly have to play around with this. As for the original really being “5 lines”, fair enough, I guess it would really be more like 10 if the the loops were written properly (someone was trying to get 5 under par…).

Any idea if a Luxor frame like that (and/or a more complex one) could be rendered in real time? I’ve been wanting a julia processing port for a quite a while, and maybe this can be used to build one…

1 Like

I’m afraid Luxor;jl as currently written is as static as the Great Pyramid of Gizeh, and the animation is merely a concatenation of PNGs.

But it’s possible that someone who knows Cairo.jl well knows whether it would be possible to have a real-time live output window a la Processing. Perhaps a port of Processing would then be straightforward. That someone isn’t me, though. :slight_smile:

1 Like

My objectives are:

  1. to give them a taste of programming as a superpower (for school assignments but not just that)

The first thing that comes to mind for me here is how they can use Julia to solve difficult problems. I’ve been re-learning calculus roughly 15 years out of college (which I find difficult :wink:) and I’ve found ForwardDiff.jl and SymPy.jl to be a bit like having a superpower:

using ForwardDiff
using SymPy

g(x) = (16/x) - 4 * sqrt(x)

# Derivative of g(x) at x = 4
julia> ForwardDiff.derivative(g, 4)
-2.0

@vars x y z real=true
f(x,y,z) = 4x^3 * y^2 - ℯ^z * y^4 + (z^3/x^2) + 4y - x^16

# ∂f/∂x
julia> diff(f(x,y,z), x)
                         3
      15       2  2   2⋅z
- 16⋅x   + 12⋅x ⋅y  - ────
                        3
                       x

The output in the REPL isn’t the easiest to read for that last example, but I’m sure you can latexify it and get that to display in your editor/IDE of choice.

Of course, the danger in this is that they come to rely on the machine to solve the problem rather than understanding how to do the math by hand :smiley:

1 Like

Hey @Benoit9, I am a little late to the conversation but I wanted to suggest having them check out: Tasks - The Julia Programming Language - 2019 - Google Code-in Archive

The Julia Language Participated in the Google’s CodeIn Challenge for student ages 13-17. All of the tasks listed at that link can be done in Julia. I am happy to help mentor or if they want to join in the google-codein channel on Slack there are other students and mentors who can help!

Thank you so much! Awesome learning resource!

1 Like

@Benoit9 I have now the same question, for a daughter which likes programming with Scratch. So, what did you try, and what is your operating return ?

1 Like

This is an old thread, and so I noticed it does not include this book, which might be useful: https://www.amazon.co.uk/Little-Book-Julia-Algorithms-programming/dp/1838173609