8 ms·
Woxi: Wolfram Mathematica Reimplementation in Rust
- adius 8mo agoHi, I'm the main developer. We're steadily getting closer to the next release which will support most features of Mathematica 1.0 plus some of the most popular newer functions (> 900 overall!). AMA!
- apetresc 7mo agoWhat percentage of the overall code was written primarily by agents?
- cs702 7mo agohttps://github.com/ad-si/Woxi/graphs/contributors https://github.com/ad-si/Woxi/graphs/contributors
- muizelaar 7mo agoHow does it compare to mathics? How close is it to being able to run rubi: https://rulebasedintegration.org/ https://rulebasedintegration.org/?
- disentanglement 7mo agoYou can find the whole integration routine here https://github.com/ad-si/Woxi/blob/36343ab2cbc97e5081f7c811e2dd15a2da5c67f4/src/functions/calculus.rs#L629 https://github.com/ad-si/Woxi/blob/36343ab2cbc97e5081f7c811e.... It's essentially a test mock-up (not even trying partial fraction decomposition for rational functions).
- anematode 7mo ago// ∫ tan(x) dx = -ln|cos(x)| - not implemented (requires Log) This really doesn't bode well... I'm no expert in CASes, but everything I've looked at seems very naive. Vibe coding a Mathematica replacement makes zero sense to me.
- anematode 7mo agoReported a few issues, e.g. https://github.com/ad-si/Woxi/issues/16 https://github.com/ad-si/Woxi/issues/16
- cs702 7mo agoThank you for sharing this on HN. It's a worthwhile effort. If successful, Woxi can enable a large mass of scientists and engineers who don't have access to Mathematica to run legacy code written for it. Also, Woxi would give those scientists and engineers who regularly use Mathematica a non-proprietary, less restrictive alternative, which many of them would welcome. How does Woxi compare to other "clean-room implementations"[a] of the same language? -- [a] Please check with a lawyer to make sure you won't run into legal or copyright issues.
- utopiah 7mo agoInteresting, thanks for sharing. Naive question as I'm not familiar with Mathematica much (but aware of it and Wolfram Alpha and related tools), how does it compare to e.g. Jupyter or Julia or maybe another language (with its framework) that might be even closer?
- adius 7mo agoI think Wolfram Language is just so much more ergonomic. No need to import dependencies - everything's included and consistent, very readable - yet compact - syntax, less gotchas than Python, R, etc., sensible default, …
- Y_Y 7mo agoYmmv, but I've found that you sure do need to import things eventually, and it's not so ergonomic because most projects just end up as mega-notebooks. Just like Python or any other language that looks easy for the learning examples, there are still hairy bits, they're just better hidden. The difference is that the debuggers for Python are far better. Mathematica is great for quick stuff, but once you hit a particular level complexity it goes crazy. In this regard I find it similar to Bash.
- robotpepi 7mo agoI'd add the pattern matching syntax. it's so natural for a mathematician.
- dist-epoch 7mo agoWhy would I use this and not Wolfram Script? Better license? Allowed for commercial operations?
- adius 7mo agoExactly! And: - Faster startup time because of no license check - Can run multiple instances of Woxi at the same time - Embeddable via WASM - Configurable via compile time flags (which features should be included) - …
- redbluered 7mo agoLicense is a big deal, and not just for cost and openness, but also for practical use in pages like docker, ci/cd pipeline, cloud deployments, or other places licenses need to be dynamic.
- foobarqux 7mo agoHow is the popularity/rank in functions.csv determined?
- adius 7mo agoThat's actually a value that Wolfram determines themselves. Here is the documentation for it: https://reference.wolfram.com/language/ref/WolframLanguageData.html https://reference.wolfram.com/language/ref/WolframLanguageDa... Here is e.g. all the values for the Plus[] function: $ wolframscript -code 'WolframLanguageData["Plus", "Ranks"]' {All -> 6, StackExchange -> 8, TypicalNotebookInputs -> 5, TypicalProductionCode -> 6, WolframAlphaCodebase -> 6, WolframDemonstrations -> 4, WolframDocumentation -> 4}
- egl2020 7mo agoThere's a mystique around Mathematica's math engine. Is this groundless, or will you eventually run into problems getting correct, identical answers -- especially for answers that Mathematic derives symbolically? The capabilities and results of the computer algebra systems that I've used varied widely.
- adius 7mo agoHard to tell honestly. So far there was always some surprisingly straight forward solution If had any problems with the math engine. There is actually a lot of public research how equations can be solved/simplified with computer algorithms. So I'm optimistic. I also stumbled upon a few cases where Mathematica itself didn't quite do things correctly itself (rounding errors, missing simplifications, etc.). So maybe it's actually a little overhyped …
- Y_Y 7mo agoI also found problems with integrating some obscure functions a few years black, though IIRC the issue was remedies by using the amazing Rubi package: https://rulebasedintegration.org/ https://rulebasedintegration.org/
- redbluered 7mo agoScmutils from MIT does a very good -- arguably better -- job for correctness. No symbolic integration by ideology and not identical. Sussman and Terman. Amazing attention to detailand correctness. Claude could probably bridge Scheme to Wolfram. I'm not sure how important but- for-bug identical output really is.
- lupire 7mo agoMathematica gets incorrect answers quite frequently.
- foobarqux 7mo agoHave you considered using quickcheck/random/property-based testing with LLM code generation to automate function implementation?
- adius 7mo agoYeah, I've already looked into it, but decided to keep developing it "example driven" for now. Aka I'm playing around with it, and whenever I find something that's broken I keep a note of it and then I pick those notes one by one and implement them. Once the most common things are implemented I will start writing property tests to catch all the edge cases of each feature.
- foobarqux 7mo agoI'm saying you can go even further and automate the entire thing using LLMs/agents, it is pretty much the ideal use case: you have a black-box reference implementation to test against; descriptive documentation for what the functions should do; some explicitly supplied examples in the documentation; and the ability to automatically create an arbitrary number of tests. So not only do you have a closed loop system that has objective/automatic pass-fail criteria you also don't even have to supply the instructions about what the function is supposed to do or the test cases! Obviously this isn't going to be 100% reliable (especially for edge cases) but you should be able to get an enormous speed up. And in many cases you should be able to supply the edge case tests and have the LLM fix it. (Codex is still free for the next few days if you want to try their "High"/"Extra high" thinking models)
- thrtythreeforty 7mo agoYou accidentally raise an interesting point: good, thorough public documentation, once considered a great selling point for your system, now invites automated reimplementation by competition. It would be a shame to see public docs vanish because it turns out they are literally machine readable specs.
- pwdisswordfishy 7mo agoLSP?
- adius 7mo agoNot yet, but on the roadmap!
- jacquesm 7mo agoWhat is your plan for long term support?
- aaron695 7mo ago[dead]
- the__alchemist 7mo agoI love Rust for mathematical and scientific tasks (I am building the structural bio crate infrastructure), and I love Mathematica and have a personal sub. I should be the audience, but... What makes Mathematica great, IMO, is the polish and overall experience created by consistent work with applications in mind over decades. So, I look at this project with skepticism regarding its utility.
- amelius 7mo agoYeah, the Mathematica language is the least interesting aspect of the Mathematica system. Closely followed by the interactive notebooks.
- aeonik 7mo agoI disagree, the language itself is one of the more elegant parts of the system, and enables a lot of the rest of the elegance. From a purely programming language theory, it's pretty unique. I once tried to find a language that had all the same properties, and I failed. The Factor language is probably the closest. But they are still pretty different.
- zozbot234 7mo agoThe relevant programming paradigm is string/term rewriting, which is featured in other programming languages such as Pure. It seems to have few direct applications outside of symbolic computing itself, compilers and related fields such as PL theory. (Formal calculi and languages are often specified in PL theory as rewrite rules, even though the practical implementation may ultimately differ.)
- aeonik 7mo agoIndeed, I think I messed up the language name too. It was Kernel that was most similar with the fexpr capability. Pure is a good example too. https://web.cs.wpi.edu/~jshutt/kernel.html https://web.cs.wpi.edu/~jshutt/kernel.html
- 7mo ago
- downboots 7mo agoGreat! Math tools for everyone. what's stopping some Mathematica employee from taking the source code and having an agent port it. Or even reconstruction from the manual. Who owns an algorithm? Will everything get copied eventually?
- adius 7mo agoAccording to https://en.wikipedia.org/wiki/Lotus_Development_Corp._v._Borland_International,_Inc https://en.wikipedia.org/wiki/Lotus_Development_Corp._v._Bor...., a software clone does not infringe software copyright. So yeah, I'd guess sooner or later everything is going be cloned …
- MengerSponge 7mo ago> what's stopping some employee from something like Mathematica from taking the source code and having an agent port it to open source Laws against theft. Also the same reason employees don't release the code on pastebin or something. > Who owns an algorithm? The org or person who was granted the software patent. https://en.wikipedia.org/wiki/Software_patent https://en.wikipedia.org/wiki/Software_patent > Will everything get copied eventually? If we're lucky. More likely everything bitrots as technical capabilities are lost. Slowly at first, then quickly.
- downboots 7mo agohttps://en.wikipedia.org/wiki/Illegal_number https://en.wikipedia.org/wiki/Illegal_number
- MengerSponge 7mo agohonestly one of my favorite Wikipedia articles. It's silly, but it is a logical conclusion to the existence of secret information. 45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B1 REDACTED 45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B3
- Y_Y 7mo agoWhich patent are you referring to?
- fnord77 7mo agovibe coded?
- adius 7mo agoSuch a massive undertaking would be almost impossible without AI agents, so yeah, they help me. But with around 5000 tests, they are actually helping to improve the software quality!
- throawayonthe 7mo agoare all the tests hand written or are some agent-contributed? curious
- mountainriver 7mo agoWhat’s the difference if you review the code getting merged?
- i_cannot_hack 7mo agoReviewing the correctness of code is a lot harder than writing correct code, in my experience. Especially when the code given looks correct on an initial glance, and leads you into faulty assumptions you would not have made otherwise. I'm not claiming AI-written and human-reviewed code is necessarily bad, just that the claim that reviewing code is equivalent to writing it yourself does not match my experience at all.
- tempest_ 7mo agoPlus if you look at the commit cadence there is a lot of commits like 5-10 minutes a part in places that add new functionality (which I realize doesn't mean they were "written" in that time) I find people do argue a lot about "if it is reviewed it is the same" which might be easy when you start but I think the allure of just glancing going "it makes sense" and hammering on is super high and hard to resist. We are still early into the use of these tools so perhaps best practices will need to be adjusted with these tools in mind. At the moment it seems to be a bit of a crap shoot to me.
- WillAdams 7mo agoFor folks who are considering passing, note that there is a "Jupyter Lite" mode in addition to "Woxi Studio" --- seems very promising and the former addressed my first concern out-the-gate.
- esafak 7mo agoI wonder if it would make a good Zeppelin interpreter. https://zeppelin.apache.org/ https://zeppelin.apache.org/
- adius 7mo agoOh cool, haven't heard of this before. Could be a good fit - I'll have to try it out some day!
- deleted 7mo ago[deleted]
- anandijain 7mo agoThis is cool! I've always wanted a polished kernel on the terminal. I spent a lot of time a few years ago writing my own Wolfram Kernel. It was a blast to understand how a pattern matching (symbolic) language is implemented. https://github.com/anandijain/cas8.rs https://github.com/anandijain/cas8.rs
- singularity2001 7mo agoIs the syntax for symbolic computation already near optimal or should something be rethought and redone?
- oofbey 7mo agoAGPL licensed. An interesting choice. Author really doesn’t want Wolfram to use it??
- adius 7mo agoWhy should I want them to use it?
- oofbey 7mo agoWell it would get vastly more popular if it was officially endorsed. Do you want lots of people using it?
- pwdisswordfishy 7mo agoWhy is that important?
- poly2it 7mo agoBecause you get changes upstreamed.
- oofbey 7mo agoMost humans like external validation. Having other people use what they've built is a common metric of validation in open source software. Economically, these metrics can be used as credentials for things like job applications or consideration in joining groups.
- peterus 7mo agoI regularly use Mathematica for working with symbolic expressions (for its DSolve and transfer function stuff) and it is way more maintainable and elegant to have fractions, symbols and powers rendered in math mode instead of having to deal with a text only representation. Are there any front ends (either custom or somehow extending jupyter) for this project which recreate this experience?
- lejalv 7mo agoMaybe http://texmacs.org http://texmacs.org would fit here!
- samwillis 7mo agoHave you considered doing property tests with Mathematica as an oracle? An ai based development workflow with a concrete oracle works very well. You still need the research and planing to solve things in a scalable way, but it solves the "are the tests correct" issue. What we've done is pull out failing property tests as a unit tests, makes regression testing during the agentic coding loop much more efficient.
- Grosvenor 7mo agoMy Bona fides: I've written my own Mathematica clone at least twice, maybe three times. Each time I get it parsing expressions and doing basic math, getting to basic calculus. Then I look up the sheer cliff face in front of me and think better of the whole thing. There is an architectural flaw in Woxi that will sink it hard. Looking through the codebase things like polynomials are implemented in the rust code, not in woxilang. This will kill you long term. The right approach is to have a tiny core interpreter, maybe go to JIT at some point if you can figure that out. Then implement all the functionality in woxilang itself. That means addition and subtraction, calculus, etc are term rewriting rules written in woxilang, not rust code. This frees you up in the interpreter. Any improvements you make there will immediately show up over the entire language. It's also a better language to implement symbolic math in than rust. It also means contributors only need to know one language: woxilang. No need to split between rust and woxilang.
- adius 7mo agoMh, I thought about this a little and came actually to exactly the opposite conclusion: Implement as much as possible in Rust to get the fastest code possible. Do you have any more insights why this should not be possible / unsustainable?
- Grosvenor 7mo agoYou have two distinct products 1) An interpreter 2) a math language. Don't write your math in some funny imperative computer language. Keep the interpreters surface area as small as possible. Do some work to make sure you can accelerate numeric, and JIT/compile functions down to something as close to native as you can. Wolfram, and Taliesin Beynon have both said Wolfram were working internally to get a JIT working in the interpreter loop. Keep the core small, and do that now while it's easy. Also, it's just easier to write in Mathematica. It's probably 10x smaller than the rust code: f[x_Integer]:=13*x; f::help:="Multiplies x by 13, in case you needed an easy function for that." EDIT: Another important thing to note is the people who really deeply know specific subjects in math won't be the best, or even good rust programmers. So letting them program in woxilang will give the an opportunity to contribute which they wouldn't have had otherwise.
- LowLevelKernel 7mo agoMany Wolfram language algorithms are proprietary right?
- evanb 7mo ago> The initial focus is to implement a subset of the Wolfram Language so that it can be used for CLI scripting and notebooks. If you have Mathematica installed you can write CLI scripts and notebooks.
- asdfe3r343 7mo agoHow did claude code became contributor?
- unexpectedtrap 7mo agoGlad to see Rust project under AGPL-3.0. I wish to see more Rust projects under (A)GPL, because (A)GPL is rare in the Rust community for some reason.
- RagnarD 7mo agoHave you gotten any nastygrams from Wolfram about this? They're pretty protective of their IP. Not saying I think that it's some violation of it, but I could see them being alarmed.
- qubex 7mo agoWow! Do my eyes deceive me? What kind of ‘sunset’ are we talking of here?!