10 ms·
I skipped around in the book a bit and found it interesting. I’d consider encouraging my kids to learn calculus this way. However, I am curious about the first
by dfee 2y ago
I skipped around in the book a bit and found it interesting. I’d consider encouraging my kids to learn calculus this way.
However, I am curious about the first paragraph of the preface:
> Julia is an open-source programming language with an easy to learn syntax that is well suited for this task.
Why is Julia better suited than any other language?
- patagurbon 2y agoJulia inherited a lot of MATLAB DNA like standard library linear algebra and 1 based indices. In addition it's got very commonly used Unicode support and intentionally can look like pseudocode in many cases.
- blagie 2y agoThis is a good overview: https://computationalthinking.mit.edu/Spring21/ https://computationalthinking.mit.edu/Spring21/ The very short story is that it's a language somewhat similar to Python (and, likewise, easy-to-use), but with much richer syntax for expressing mathematics directly. It also has richer notebooks. The key property is that in python notebooks, you run cells. In julia notebooks, it handles things like dependencies. If I change x, either as a number or a slider, all the dependencies things update. You can define a plot, add sliders, and it just works. (Also: I'm not an expert in Julia; most of my work is in Python and JavaScript. I'm sure there are other reasons as well, but the two above come out very clearly in similar courses)
- dnfsod 2y agoI also clicked around and felt the formatting and progression of the book was a bit confusing, but found some of the Julia features intriguing. (like “postfixing” allowing the same pencil notation of f’ and f’’ et al) In my opinion, and experience, the best “calculus book” is Learn Physics with Functional Programming which only relies on libraries for plotting, and uses Haskell rather than Julia. https://www.lpfp.io/ https://www.lpfp.io/ > Why is Julia better suited than any other language? Julia is known as a “programming language for math” and was designed with that conceit steering a lot of its development. Explicitly it supports a lot of mathematical notation that matches handwritten or latex symbols. Implicitly they may be referencing the simplified (see Pythtonic) syntax, combined with broad interoperability (this tutorial uses SymPy for a lot of the heavy lifting), lots of built in parallel computing primitives, and its use of JIT compilation allowing for fast iteration/exploration.
- barrenko 2y agoThank you for reminding me of LPFP!
- jakderrida 2y agoI'm just guessing, but: 1. Open Source. 2. Easy to learn. (kind of) 3. Robust plotting and visualization capabilities, which are integral (I f*cking swear no pun intended) to understanding calculus, the foundational purpose of calculus being to find the area under the curve. (something I really wish they told me day one of Pre-Calc) 4. This one is just a vague feeling, but the fact that Python's most robust Symbolic Regression package, SymPy, relies on running Julia in the background to do all the real work suggests to me that Julia is somehow just superior when it comes to formulas as opposed to just calculations. IDK how, though.
- constantcrying 2y ago1-3 apply exactly the same to python, 4 is just false, SymPy is written in python, it has nothing to do with Julia.
- patagurbon 2y agoThey're thinking of PySR but you are right on all points!
- constantcrying 2y ago>Why is Julia better suited than any other language? Because it is a language specifically targeted for doing numerical analysis. Python, which is it's main "competitor" has a notoriously poor syntax for mathematical operations with miniscule standard library support for mathematics, a very limited type system and abysmal runtime performance. Julia addresses all of these issues and gives a relatively simple to read language, which often closely resembles mathematical notation and has quite decent performance.
- mgaunard 2y ago"its" not "it's" numpy has similar syntax to MATLAB and Julia Python's type system is pretty rich and allows overloading all operators
- constantcrying 2y ago>numpy has similar syntax to MATLAB and Julia Numpy has absolutely awful syntax compared to Julia or MATLAB. It is fundamentally limited by pythons syntax, which was never meant to support the rich operations you can do in Julia. I have done quite a bit in both languages and it is extremely clear which language was designed for numerical analysis and which wasn't . >Python's type system is pretty rich and allows overloading all operators The language barely has support for type annotations. Duck typing is actually a very bad thing for doing numerical analysis, since you actually care a lot about the data types you are operating on. Pythons type system is so utterly inadequate that you need an external library to have things like proper float types.
- mgaunard 2y agoYou're just repeating that it's bad without any argument. Numpy's syntax is the same as MATLAB's. Both MATLAB and Julia also use dynamic typing, though it is true Julia does have support for ad-hoc static typing through annotations in a way that is stricter than Python's. Numpy does provide all the traditional floating-point types.
- staplung 2y agoJulia has a bunch of little niceties for mathematics: * Prefixing a variable with a scaler will implicitly multiply, as in standard math notation (e.g. 3x would evaluate to 6 if x is 2) * Lots of unicode support. Some feel almost gratuitous (∈ and ∉ are operators that work as you would expect) but it's pretty nice to have π predefined (it's even an irrational datatype) and to use √ as an operator (e.g. √2 is a valid expression and evaluates to a float). It's not just that Julia supports these constructions but provides a convenient way to get them to appear. * This is a little less relevant for calculus but vectors and matrices are fist class types in Julia. Entering and visually parsing matrices is so much easier in Julia than in Python. m = [1 2 3; 4 5 6; 7 8 9] vs. m = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] Transposition is a single character operator ('). Dot product can be done with the dot operator (m ⋅ n). A\b works as it does in matlab. * Julia supports broadcasting. It also has comprehensions but with broadcasting I personally find much less need for comprehensions. * Rationals are built-in with very simple syntax (1//2))
- RivieraKid 2y agoI quite like and use Julia but wish there was a language mixing the best aspects of Julia and Swift (which I think can be done without many compromises, i.e. it would be a better language overall). Some things I don't like about Julia: - array.mean().round(digits=2) is more readable than round(mean(array), digits=2) - Poor support for OOP (no, pure FP is not the optimal programming approach).
- patagurbon 2y agoYou can overload your own types to get a lot of those things (poor support for OOP is harder but you can sort of emulate it with traits). Overloading `getproperty` for the former case. Of course it's not built in, which I understand is annoying if that's your preferred coding style. I personally am sad that really good traits aren't encoded in the language.
- abisen 2y agoIf I am not using named arguments I find myself using the pipe operator a lot. I also find it more readable. array |> mean |> round For scenarios with named arguments there is a little not so cleaner workaround array |> mean |> x->round(x, digits=2)
- g0wda 2y agoMultiple-dispatch is the right abstraction for programming mathematics. It provides both the flexibility required to create scientific software in layers (science has a LOT more function overloading compared to any other field.), and the information required to compile to fast machine code.
- michaelcampbell 2y ago> > Julia is an open-source programming language with an easy to learn syntax that is well suited for this task. > Why is Julia better suited than any other language? Why must it be better suited than ANY other language, for the bit you quoted to be true?