Live data from Hacker News

Some fun with π in Julia

julialang.org

11–20 of 69 posts

Re: Some fun with π in Julia

#11
Most times a julialang.org blog post is posted to HN, I wonder whether the choice of content is well chosen to spread awareness of and interest in Julia.

I write this as a huge Julia fan; I use Julia daily, and it is both my favorite language and the language I know best. So I already think Julia is great. But reading many Julia blogs, especially those from julialang.org, would make me think Julia is only useful for very narrow scientific applications if I didn't already know better.

I like Julia because it's extremely fast and extremely expressive - and I don't just mean "expressive" as in "can be written like a dynamic/scripting language," though it can. I mostly mean that the combination of its type system and multiple dispatch allows some really elegant abstractions.

Re: Some fun with π in Julia

#12
post #6

I have always been skeptical about 'scientific' languages. Why do you need a special language when any general language + some libraries will do? This is a good example of a feature that only really makes sense in a scientific language.

In R, I can import a CSV, plot a histogram of each column, and fit a linear regression of one column against the others in about 5 minutes and 15 lines of code.

In Python, I can do the same thing if I install the Pandas and Statsmodels libraries first.

Try that in Ruby, Perl, C++, C, Java, Rust, Haskell, Common Lisp, or just about any language you can think of. Good luck.

Re: Some fun with π in Julia

#13

Genuine question, As a professional developer, why would you restrict yourself to such technology? what we should be asking here is why? give me one scenario where this language is more appropriate than the plethora of other domain specific languages. would you bet your company on such language when there is more mature languages already ?

Are you asking "why do we use scientific languages"? If that's your question, the answer is the same reason that you don't write a webserver in assembly.

If you're asking "why Julia versus other languages" it's that, well, Julia is fighting to answer that question for itself. As far as I can tell:

- Versus R and Octave: performance, coherent syntax, and more features for writing "programs" instead of just "scripts" - Versus Python + the Scipy stack: its scientific features are built into the language (instead of being an awkward layer on top of it) - Versus any proprietary platform (SAS, Matlab, etc): it's open source and free-as-in-beer, and therefore not confined to legacy/enterprise applications

I'm a data scientist and I currently use R and Python. I've been wanting to give Julia a try for months, and now that the ecosystem is starting to mature (plotting and data frames are must-haves for me) it's making more sense to spend some time with the language.

Re: Some fun with π in Julia

#14
post #7

Genuine question, As a professional developer, why would you restrict yourself to such technology? what we should be asking here is why? give me one scenario where this language is more appropriate than the plethora of other domain specific languages. would you bet your company on such language when there is more mature languages already ?

I think one of the strengths of this approach is easily implementing numerical methods/approaches from papers and having it just work . If you work in academia or in an R&D field, this is valuable. I don't think Julia is presently positioning itself to be the core language a company's product is based on.

having it "just Work" is relative even in academia and R&D, again, there are domain specific languages being used in these environments that "just work" and have been designed to do so in the most efficient manner.

Re: Some fun with π in Julia

#15
post #6

I have always been skeptical about 'scientific' languages. Why do you need a special language when any general language + some libraries will do? This is a good example of a feature that only really makes sense in a scientific language.

Numerical programming takes more expressive power than one might imagine. In most languages, numerical primitives like integers and floating-point numbers, and numerical operators like `+` and `[]` (array indexing), are very special and are endowed with enough magic to be usable. E.g. in C, `+` is too polymorphic to be defined as a function; in Python, `+` has special `__radd__` methods to (hackily) emulate multiple dispatch; in Java `int`, `float` and `double` are entirely different kinds of values (non-objects) from normal user-definable objects. In many ways, the fundamental premise of Julia is to design a language with sufficient power and performance that numbers are not special: "primitive" types like `Int`, `Float64` are just defined in normal Julia code, and operators like `+` and `[]` are normal Julia functions like any other.

This recent post gives some more motivation: https://discourse.julialang.org/t/julia-motivation-why-weren....

Re: Some fun with π in Julia

#16
post #6

I have always been skeptical about 'scientific' languages. Why do you need a special language when any general language + some libraries will do? This is a good example of a feature that only really makes sense in a scientific language.

[deleted]

Re: Some fun with π in Julia

#17

Most times a julialang.org blog post is posted to HN, I wonder whether the choice of content is well chosen to spread awareness of and interest in Julia. I write this as a huge Julia fan; I use Julia daily, and it is both my favorite language and the language I know best. So I already think Julia is great. But reading many Julia blogs, especially those from julialang.org, would make me think Julia is only useful for…

> Most times a julialang.org blog post is posted to HN, I wonder whether the choice of content is well chosen to spread awareness of and interest in Julia.

Or you know.. it's Pi day.

Re: Some fun with π in Julia

#18
post #6

I have always been skeptical about 'scientific' languages. Why do you need a special language when any general language + some libraries will do? This is a good example of a feature that only really makes sense in a scientific language.

One of the big wins is being REPL/workbook-focused, rather than REPL/workbook as an afterthought.

When I'm building software, I tend to like things to have very tight interfaces -- box everything up into components, understand how they talk to each other, etc. Define interfaces, implementations, types, etc -- In general, optimizing for long-term maintainability.

When I'm exploring data, my thought process is much more "scatter everything about on the desk" and "let me run these 5 lines of code again within the current context". "What does this thing look like", etc. Having "a table of data" as a first-class citizen in the language, with all the libraries assuming that as input and everything optimized to work around / display / visualize such is incredibly useful.

Re: Some fun with π in Julia

#19
post #6

I have always been skeptical about 'scientific' languages. Why do you need a special language when any general language + some libraries will do? This is a good example of a feature that only really makes sense in a scientific language.

I would say there's something magical about the way that Julia is structured that makes it more than just a scientific language. I wrote a DSL for Julia for writing clean combinatorial verilog (haven't tackled sequential yet) in 3 days, using lispish macros. It took another 1 day to hook it up to 'verilator' which transpiles the verilog to C and lets you crosscheck it by loading it back up in Julia.

https://github.com/interplanetary-robot/Verilog.jl

This is very important if you're planning to build hardware to do specific math - because Julia is incredibly good at mathematical modeling, and you can very rapidly set up comprehensive tests for your hardware designs with confidence.

The closest alternative is chisel, which is written in scala. Although it's more professionally maintained and more fully-featured, it's hard to call the verilog chisel emits "human-readable", and it's harder to set up comprehensive tests - berkeley hardfloat, which is a very impressive project in chisel, had several critical bugs in its implementation (that I found, using julia).

Re: Some fun with π in Julia

#20
post #7

Earlier quoted context omitted.

I think one of the strengths of this approach is easily implementing numerical methods/approaches from papers and having it just work . If you work in academia or in an R&D field, this is valuable. I don't think Julia is presently positioning itself to be the core language a company's product is based on.

having it "just Work" is relative even in academia and R&D, again, there are domain specific languages being used in these environments that "just work" and have been designed to do so in the most efficient manner.

So your question is applies to Python, Scala, Ruby or any other non-domain specific language, not just Julia.
Post reply on HN