Calculus with Julia

(jverzani.github.io)

252 points | by subset 2 days ago ago

53 comments

  • patagurbon 16 hours ago

    There's no language I'd want to teach (applied) math in more than Julia. Lean is obviously kind for anything involving a proof, but for teaching anything with linear algebra involved the syntax alone is enough of a reason to prefer Julia.

    Optimization, specifically the kind that JuMP tackles, is another field where teaching is probably easier in Julia than any other language

    • Trusteando 7 hours ago

      Since you've posted in HN about the state of Julia in 2024, I think you have the knowledge, and perhaps the desire, to provide information about what the improvement are in Julia with respect to problems expressed in the 2022 long discussion by Yuri Vishnevsky (1).

      Anyway the problem I see is that other languages and tools are also improving, for example the author of this post (2) "I am reluctant to shift to Symbolics, as the calculus specifics (limits and integrals) aren't as competitive".

      (1) https://discourse.julialang.org/t/discussion-on-why-i-no-lon...

      (2) https://github.com/jverzani/CalculusWithJulia.jl/issues/50

      Edited for grammar and spelling.

    • veqq 7 hours ago

      Have you ever looked into APL or BQN?

      • patagurbon an hour ago

        Too dissimilar to the blackboard although I really do like them

      • ModernMech 6 hours ago

        I have, compared to Julia they’re both just overall too slow. Same with K and Uiua and Matlab.

        • thatsabadlook 4 hours ago

          Do you seriously need performance to teach integrals or derivatives?

          • ModernMech 2 hours ago

            I understand TFA is scoped to calculus, but the parent post scoped their usage of Julia to "anything with linear algebra involved", so I would say in that case you should teach languages that are practical for linear algebra. I threw Matlab under the bus because it's generally slow (although there are ways to optimize it a bit more) and expensive, but I would teach matlab or julia before apl or bqn. Also bqn is a very new language, it's not ready to be used for classroom teaching purposes.

    • patagurbon 9 hours ago

      I must’ve meant best* instead of kind oop

  • aborsy 7 hours ago

    Julia should have been adopted for numerical computation and ML by places like Google.

    They went with python and it's just too general and verbose.

    • thatsabadlook 4 hours ago

      I'm so glad they didn't and I bet they are too.

  • Trusteando 12 hours ago

    The stated goal is to introduce math concept without computer language or use being a burden. But then I took a quick glimpse at the derivative chapter, and at the top there is "using Sympy", so you don't only use Julia but also sympy. Mathematica and Matlab are the alternative in a university setting in which free licenses for students are available, with strong numerical and symbolic capabilities . I think Julia is a lovely language, but perhaps Julia + Sympy is a difficult proposal for attaining the stated goal. S.Rational(1) + S.Rational(1,3) type of things from sympy are hard to digest.

    Edited: Added: I think if you love teaching calculus using Julia then the passion you transmit might compensate for the additional burden of using Julia plus SymPy.

  • subset 2 days ago

    I'm just picking up Julia for my DSP course at uni, and came across this nice intro. It's very well-paced for a first introduction to programming!

    • lloydatkinson 11 hours ago

      Do they teach it? My DSP module at university was some Matlab point and click exercise.

      • ballmerpoint 9 hours ago

        The Julia DSP module is pretty nice for learning. The basic objects are about what you would expect them to be, you can specify filters by their zeroes and poles, etc.

        Some of the design algorithm bits are hidden away, but I’d argue that a first course in DSP probably shouldn’t cover optimization details like Parks-McClellan.

  • 13 hours ago
    [deleted]
  • 13 hours ago
    [deleted]
  • ronfriedhaber 6 hours ago

    Great resource. Julia is one of the best PLs coming out of MIT.

  • neronuser 15 hours ago

    Anyone using Julia outside university settings? I tried to get into it around 5 years ago, and it felt good, was conceptually interesting, but haven't seen any adoption or talks anywhere outside the academia

    • andyferris 13 hours ago

      Yes - in multiple companies. It works perfectly fine in production, and is especially useful if mathematical optimisation is part of your app somewhere or you need to write any custom, performant algorithms. It's pretty flexible - you can use it for dynamic code like python scripts, you can write optimised data pipelines, it can function as pretty decent server (the async stuff is working well these days). Not sure on adoption, but it defintely works.

    • FacelessJim 14 hours ago

      Been using it daily for years now, even at work. Nowadays you can just compile as a library that you can share with other languages.

      As a language it’s very pluggable (both directions). I think it’s one the best languages in terms of interop out there at the moment.

      • dandanua 13 hours ago

        Julia's interop is amazing. I've used AI to generate Julia code that calls cuBLASLt for efficient tensor FP8 computations. It achieves like 90% of maximal theoretical GPU performance withing a workflow written completely in Julia.

    • anogrebattle 5 hours ago

      Yes, in the aerospace industry. We love it.

    • thatsabadlook 4 hours ago

      Heavy avoid. I've seen companies sink so much time and money into it. What should be an engineered released product become an expensive academic consortium of never ending work to improve the language and the ecosystem. Some people make careers out of getting hired to fix Julia at various companies...

    • kataklasm 14 hours ago

      At a new-space startup I've worked at in the past we used it for some satellite (constellation) analysis work. Mechanical, Power, ConOps, that sort of stuff. MATLAB was too expensive and also overkill, as we didn't really need the toolboxes.

    • RobotToaster 15 hours ago

      I know Microsoft made a geometric optics package for it they apparently used for VR hardware.

    • pjmlp 15 hours ago
    • sdsd 15 hours ago

      I saw it used five years ago on a LessWrong post: https://www.lesswrong.com/posts/Y6TtPfcKiHjK9Bmoa/sleeping-j...

      That's the only time I've ever even heard it mentioned outside HN. I felt a lot of excitement for Julia's automatic differentiation during the ML era, because you had programmers with weak math backgrounds suddenly needing to do basic calculus (any dev from that era has the chain rule burnt into their brain).

      Then the ML community settled on Python as their language, and if performance was an issue you wrote a library in C++, and obviously that was all sucked into the event horizon of LLMs so people "code" in whatever language the LLMs had the best training data for.

    • Staross 9 hours ago

      I use daily since years at work for all things bioinformatics/research. I think it's a more fun language than most so it help me keep my sanity.

    • ted_dunning 15 hours ago

      There are open references to usage by

      ECMWF ASML Pumas JPMorgan Chase

      and many other companies.

      I use it routinely, but it isn't a company standard where I work.

    • polalavik 8 hours ago

      looking into it more with the release of juliac. i am able to keep algorithms in one place at a high level for simulation/visualization and running things real time in julia, then if I do everything right i can compile it down to a binary for other platforms using juliac

    • j_maffe 10 hours ago

      I use it for network science research. It's definitely my language of choice for (scientific) computation.

    • ballmerpoint 9 hours ago

      I used to deliver Julia models wrapped in mex to customers using Matlab, this was during v0.3 if memory serves. It worked pretty well.

  • utilize1808 14 hours ago

    What's the developer experience like with Julia nowadays? Any IDE / static analysis / debugger options that doesn't feel like experimental?

    • FacelessJim 11 hours ago

      Depends a bit. More traditional tools like static analysis/Debuggers/full fledged IDEs are somewhat lacking compared to your standard static programming language. Although there’s very good progress being made with JETLS on the static analysis part, and the VSCode extension is very mature.

      But, on the other hand, you rarely need those kind of tools with Julia. The REPL+Revise in Julia is most often all you need. If you really want to jump into running code debugger style you have Infiltrator.jl

      And in the year of our lord 2026, I’ll say that agents are very effective in debugging Julia, especially paired with persistent sessions/daemons like DaemonicCabal.jl or JuliaDaemon.jl.

      • utilize1808 9 hours ago

        While I agree that agents can do pretty much all the coding, I still would love to learn to work with the language myself --- Julia was supposed to be a human-friendly/human-first programming language, with elegant syntax and all that, so it would be a pity not to try it as a human programmer.

        • FacelessJim 9 hours ago

          Oh yeah absolutely. One of my favourite ways to interact with agents is to spin up an interactive common session where both me and it can run commands in a shared environment. You can ask the agent to setup a MWE for you to play with and further explore in the REPL for example.

    • mark_something 10 hours ago

      I used it for a few hobby projects in VSCode. It's not 100% smooth, e.g. I couldn't compile and run my code with a single shortcut. It's supposed to be possible to show graphs in VSCode but I couldn't make that work.

      Debugging worked quite good. I didn't look for static analysis.

      But I find programming in any language in VSCode less polished, compared to e.g. programming C++ with Visual Studio, which works out of the box.

      • jhoechtl 4 hours ago

        What type of programs have you been writing?

    • wolvesechoes 12 hours ago

      I wouldn't call them experimental. They just suck IMO, and that's my biggest gripe with using Julia, as language alone is nice, especially with slowly improving AOT. Of course you will also get replies with completely opposing views, so there is no other way than trying it yourself.

  • softbuilder 7 hours ago

    I would love to see things flipped around: Teach calculus as code, and work in the concepts after. This looks like a conventional approach with code tacked on after. What I see here: concept -> math notation -> code. I'd go: code -> concept -> math notation.

    • veqq 7 hours ago

      There are nice APL- and J-based math books with this approach. APL's inventor's main goal was improving mathematics instruction.

    • golbanno 2 hours ago

      Why would that be better?

  • sundarurfriend 12 hours ago

    20 quadrillion ants is about 2.5 million ants per human - pretty insane to think about. I thought I had a grasp on their abundance, but I'd still probably have underestimated their numbers by an order of magnitude previously.

    We still mog them on mass and volume though. 2.5 million of the average ant would only make the size of a human leg, if that.

  • jackling 10 hours ago

    Seems like a fun way to teach basic calculus. I think a notebook style, maybe a Julia equivalent of Jupyter, would work better.

    From my quick skim, the book is quite light on proofs, which I think is a big mistake for intro calculus classes. Proofs are usually what you need to get a solid feel for the material, at least at the start. Developing intuition on how things work by playing around with Julia, and using that to inform exploration to come up with theorems, and using that data to help develop a proof would be a more interesting approach. Maybe they do this in later chapters. For example, when teaching eulers method for integrating the ODE, visually graphing the error compared to the actual as step size changes could give the reader some intuition about the order of the method.

    • veddox 8 hours ago

      We have Pluto (https://plutojl.org/)!

      Jupyter handles Julia too, but Pluto is designed specifically for it, and is lovely. I'm using it to teach an intro to ecological modelling course right now.

    • WillAdams 9 hours ago

      Doesn't the _J_ in Jupyter stand for "Julia"?

      Arguably, the effort of the reader manually transcribing the code into their own Jupyter notebook seems didactic.

  • yoonge2 9 hours ago

    [flagged]