Hacker News new | ask | show | jobs
by goldenkey 3143 days ago
The main point of the code was to create new means and show derivation of known means. It's easy to write a geometric mean in any language. Having the solve function in Mathematica makes it possible to do dynamically generated means that wouldn't be possible in languages without a strong CAS library.

Also, will J error out on gm a b ? or gm a 100? The beauty of Mathematica is that I can still get results results in algebraic form, when I leave variables unset.

In:= GeneralizedMean[{x, y, z, t}, (#*#2) &]

Out= (t x y z)^(1/4)

1 comments

The article was great, and I get your point. I was not presenting J as comparable to Mathematica as CAS or WL vs. J, but only showing its expressiveness. You are correct in that it will error out with your examples without writing catch code. I too dream WL goes native. Until then, I will stick with other PLs. How do you like Clojure for mathematics?

I still use Maxima on my Android phone along with J. Wolfram Alpha is nice to have too on it!

Also my example was missing the * even though it was explained below. It should be: gm =: #%:*/

Thank you - I hope to eventually produce a paper about alternative continuous and discrete means/norms. Kolmogorov went 5/10 the way, I think I brought his line of questioning to its rightful conclusion. Theres a lot of research to still be done however - only certain forms have easy closed forms when taken on continuous spaces. You might enjoy Part 2: https://scrollto.com/means-of-infinite-sets-and-more/

I actually have never used J, have only minor experience with Clojure in a startup codebase I once worked on, and never heard of Maxima. You have invited me to explore J and Maxima and I thank you for that. So far, I have used solely Mathematica for mathematics. I've tried python with pandas and other libraries but the syntax always seemed obtuse for me. Python's C call interop is why its so library friendly - but the actual language makes these libraries seem bolted on, less integrated than preferable. There are so many languages to try: Haskell, Rust and Julia are on my bucket list. I've mostly conceded to just learning languages when I need to - for an open source codebase or new job. To me, coding is a means to an end of production of tools, apps, deliverables.. Curiosity can deliver one into an abyss of stasis - where one learns all the most amazing expressiveness tools and techniques but never builds anything with them. All a balance..right. Godspeed :-)