r/madeinrust • • 14d ago

Majority AI Coded MathCAS, an open source computer algebra system for heavy symbolic and numerical computation. Bonus: automatic parallelization, JIT compilation and arbitrary precision numerics integrated into the core.

I love what artcraft did! So I scrambled to make my own version of Mathematica minus the bloat and huge subscription fees. Meet MathCAS.

I think research tools should be free or at least free to use, because we mostly work with grant money and sometimes people like me use personal funding for research. We use mathematica in our department regularly and still the department refuses to pay for it. So I made my own.

Features:

  1. The term rewriter at the core quickly decides whether to parallelize a computation or not.

  2. You can compile typed functions for faster performance.

  3. The algorithms are written ground up for arbitrary precision numerics support.

  4. The tested numerical integrations beat mathematica in speed and accuracy.

  5. It is aimed at doing symbolic, numeric and higher math calculation only, not replace mathematica entirely for people who use it for other purposes.

I will try to maintain this as long as I can, because I was always fascinated by computer algebra systems (my first one was PocketCAS on windows PPC) but the complexity of it prohibited me from making one, despite knowing how they generally work.

Feature requests and bug reports are welcome. 😄

33 Upvotes

12 comments sorted by

2

u/Dry_Beautiful958 13d ago

Did you do the decompiler shenanigans for the CAS or did you use something like XCAS?

2

u/defnotaloser 13d ago

Neither. The semantics and syntax (the TRS core) are decided without looking at anything and it's a bit awkward to use at first. For example, the "./" substitution was `rewrite(expr, rules)`. Once the core was built, I fed it all the mathematica code I had so it can make equivalent shortcuts and understand what to implement next. After 30 or so rounds of implementation and bug fixing, here we are.

1

u/Dry_Beautiful958 13d ago

I'm sorry I'm still confused, but how was the code that does calculations created (like integral from -pi to pi of xsinxdx = 2pi). Like on my HP Prime, its XCAS thats doing the calculations. I interpret your response as mostly relating to parsing

1

u/defnotaloser 13d ago

For indefinite integrals(anti-derivatives), it has a Risch-like algorithm plus some extra rules written by hand. For definite integrals, it tries the trivial stuff first to check if the integral is identically zero or can be reduced by using integral identities. Then it asks for an antiderivative. This particular integral has a simple antiderivative, so it does the integral this way.

Failing this, it would try integral transforms (Mellin) and finally there is an Meijer G function trick that even I didn't know of. All of these algorithms are published btw.

1

u/Clear_Wrongdoer_775 10d ago

First where is the appimage for linux? And second, have you tried sagemath?

1

u/defnotaloser 10d ago

I am sorry, the appimage is built locally but not included in github release through github actions. I'll fix it.

I heard about sagemath, but did not try it. From the looks of it, it's not a TRS like MathCAS.

1

u/Inst2f 9d ago

I love how fractions are rendered and parentheses auto-adjust.

> Mathematica minus the bloat and huge subscription fees
Wolfram Engine has been freeware since 2019...

1

u/defnotaloser 8d ago

Thanks. The ui needed as much work as the engine itself. It was done from scratch 3 times over 45 rounds of coding sessions.

Wolfram engine isn't free for academic research and producing publication plots. The terms of use is very vague so honestly, I don't know what it allows at all. 

1

u/Inst2f 8d ago

> Wolfram engine isn't free for academic research

They state explicitly for research and development. The commercial or production use is forbidden (or you just pay them 300 euros per year or something). But ok, I see your point

1

u/No_Place_4096 8d ago

python + sympy?

1

u/defnotaloser 8d ago

No pattern matching. The point of Mathematica/MathCAS is term rewriting capabilities and the ease that comes with it.

1

u/AutoModerator 14d ago

Upvote this comment if you think this project is AI slop. Downvote this comment if you think this project is not AI slop.

This is to indicate to other users of the subreddit and is not used for moderation.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.