Learning and Work

Encounter the Ecosystem of Julia

~500 words; this is an averagely personalized post.

  Content:
Warm-Up ‐ Why I Started to Learn Julia
What have Helped me to Learn Julia and its Ecosystem
Experience: Applying Julia for Math Visualizations
Advice(the author was keen on giving advice to others, but she is trying to give up this habit now)
Future
External Links and Resources

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.1 (2021-12-22)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

At this moment, the lazy author hasn't downloaded the most updated version (v1.7.2 (Feb 6, 2022)) of Julia. The quick evolving of Julia and its packages can lead to embarrassment of the lazy users. [REF]

Warm-Up ‐ Why I Started to Learn Julia

In September last year, an acquaintance/buddy (seems like "acquaintance" since I hesitate), who is teaching in the math department of a local university, contact me and suggested providing a job opportunity of making animations for his lecture videos.

Originally, he suggested using Python. I had heard of Julia at that time, but never tried it, but I quickly replied that I could use Julia and/or Processing(a Java library) to produce the animations. The acquaintance knows Mathematica and TeX, but he isn't a coder, so he accepted my suggestion. Well, I am lucky ‐ I have no criticisms for Julia as its design of being a programming language for working with it for roughly 4 months.

What have Helped me to Learn Julia and its Ecosystem

Before toddling with Julia, I had learnt some bits of Java, bits of Perl and bits of LISP. I felt my experience of LISP is the most helpful; it may be due to the feature that "functions as first-class objects", or many parentheses had been used in my Julia scripts.

function my_func(s, os)
    Object(1:tt, ((args...) -> (
    sethue("red");
    line(
        Point(p_x(s), -padd + p_y(s)),
        Point(p_x(os), - padd + p_y(os)),
        :stroke
    )
    )))
end

I am a stubborn supporter of command-line, so I haven't tried Pluto or Jupyter; the REPL environment of Julia is friendly and smart(!) enough.

julia> exp(3,5)
ERROR: MethodError: no method matching exp(::Int64, ::Int64)
Closest candidates are:
  exp(::Real) at /mnt/julia-1.7.1/share/julia/base/math.jl:1218
Stacktrace:
 [1] top-level scope
   @ REPL[14]:1
julia> using Makie

julia> using Plots

julia> plot
WARNING: both Plots and Makie export "plot"; uses of it in module Main must be qualified
ERROR: UndefVarError: plot not defined

My Perl experience also helps. This round is not related to language design. The Julia Packages site is similar to Comprehensive Perl Archive Network(CPAN) in the Perl ecosystem. The installation of a Julia package is also easy in a similar level. Press ] in the REPL and enter "add xxxxx". It's lovely to see people are closely cooperating, especially for programming languages which are open-source and do not start with backup from enterprises.

(@v1.7) pkg> add NetworkDynamics
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed NetworkDynamics ─ v0.7.1
    Updating `~/.julia/environments/v1.7/Project.toml`
  [22e9dc34] + NetworkDynamics v0.7.1
    Updating `~/.julia/environments/v1.7/Manifest.toml`
  [22e9dc34] + NetworkDynamics v0.7.1
Precompiling project...
  1 dependency successfully precompiled in 6 seconds (385 already precompiled)

Experience: Applying Julia for Math Visualizations

Continue story-telling. The acquaintance became my supervisor/boss as written in the contract. (Word choice again? "Boss" seems better, since the amount of characters needed to be typed is less.)

I told the boss that I would spend two weeks to get familiarity for Julia. Honestly, I did not work very hard. And looking back, I should try playing with Plots.jl and Luxor.jl in the beginning. (Instead, I intended to practise Julia programming with problems on Project Euler.)

For work, I have produced animations for graph theory and calculus.

For calculus, of course I work with Plots.jl or Makie.jl. One thing I want in Makie is support for "zerolines" framestyle which is available in Plots.jl.

On the videos for graph theory lectures, I have used Javis.jl, an animation package based on Luxor.jl.

Future

Though my paid job will be ended at this month, I do think I will continue to explore Julia; friends know that I am a greedy collector of math materials; maybe I will try to make generative art through Julia, or; learn math with related Julia packages (eyes on packages of dynamical systems and linear programming), or; refactor my previous Julia codes. □

External Links and Resources

General Resources

Plotting/Animations Resources

To learn more

  1. A Swift Introduction To Macros In The Julia Language: A brief overview of how to use macros in Julia. by Emmett Boudreau (May 2020)

Easter Egg: Why We Created Julia, Jeff Bezanson, Stefan Karpinski, Viral B. Shah & Alan Edelman (14 February 2012)

Except from images and codes from personnels, the content of this blogpost is released under a copyleft spirit. One may share (full or partial) content of this blogpost on other platforms if you share it under the free and open content spirit.


Contact on twitter: @e7_87.

Discuss via GitHub issues: here.

Email: fungcheokyin at gmail.com

Created Date: 14th February, 2022.