Hacker News new | past | comments | ask | show | jobs | submit login
FxSolver – A solver for engineering and scientific equations (fxsolver.com)
231 points by jerrytee 7 months ago | hide | past | web | favorite | 67 comments

many people have tried to build open source alternatives to mathematica for decades (sage, sympy) and it's just too developer intensive a task. there is so much work and not to mention IP in just Simplify[] that I don't know why people bother. no one that seriously uses something like mathematica (e.g research) would use any other CAS. I'm not saying I wouldn't love a free alternative but it's not practical without dozens of people across the mathematical and engineering spectrum. the challenge that comes to mind is that undertaken by the teams that contributed to numpy, scipy, and pandas in order to be a viable alternative to Matlab.

Axiom, specially FriCAS (open source) is pretty underrated. It unfortunately hasn’t kept up with the times in terms of interface, which is a sure way to kill 95% of the potential users. But it’s mathematical capabilities in some cases, and certainly it’s mathematical potential, outscales Mathematica.

Mathematica’s barebones symbolic representation doesn’t get you very far when you want to do more than some common algebra over the reals and complexes. Mathematica’s abilities, for instance, in abstract algebra are seriously lacking. (In this instance, GAP (open source) exceeds Mathematica pretty seriously.)

I just ran into this trying to get Wolfram Alpha to expand a polynomial from product to sum form over a Galois field. I got frustrated and wrote my own C++ code myself to get the answer.

> But it’s mathematical capabilities in some cases, and certainly it’s mathematical potential, outscales Mathematica.


> Mathematica’s abilities, for instance, in abstract algebra are seriously lacking. (In this instance, GAP (open source) exceeds Mathematica pretty seriously.)

For someone who is not familiar with FriCAS, can you give an example or two (assuming a math background)? I'm interested in specific cases where open source tooling outperforms Mathematica.

There are more specific cases where open source tooling outperforms Mathematica than where the opposite holds. This especially true when you move away from basic calculus and towards research math. For example, many number theorists don't care about Mathematica at all because it has virtually no functionality for modular forms and L-functions which Pari/GP and Sage on the other hand support very well.

However, nothing open source currently comes close to Mathematica for symbolic and symbolic-numerical calculus (expression simplification, symbolic integration, solving PDEs, etc.). Also, one of Mathematica's main strengths is providing a lot of functionality in a neat package where diverse components are very easy for the user to glue together, with automagical interfaces where the user doesn't need to know what happens behind the scenes (or at least that's how Wolfram PR spins Mathematica being closed source).

Meanwhile, Sage combines a lot of functionality but you can't go very far before you run into visible duct tape, API inconsistencies and things that don't quite work together automatically when you think they ought to. Its documentation is also not as good (Sage has very detailed documentation, but often not well structured). Many of the same issues that exist in open source software in other fields, really.

I only have experience with OpenAxiom & Axiom; however, the core definition language (Spad) is a dependently typed module-centric modern language... from 1981. It’s like an alternative “what if” language designed by mathematicians to write CASes. It has the oldest implementation of list- and set- comprehensions I know of. (Disclosure: I wrote a paper about adding JET-based forward AD using single-definition generics to the language.) The packages contain a complete implementation of the Risch algorithm; I’m not sure Mathematica has managed that.

According to [0], ”For indefinite integrals, an extended version of the Risch algorithm is used whenever both the integrand and integral can be expressed in terms of elementary functions, exponential integral functions, polylogarithms, and other related functions.

[0] http://reference.wolfram.com/language/tutorial/SomeNotesOnIn...

Most CASes use some form of Risch, but there are various levels of implementation. Axiom is the only known CAS that implements all of the mathematics for every case of Risch, the so-called “algebraic” and “transcendental” cases.

Wolfram’s page uses vague language (“an extended form of”) and doesn’t actually confirm with precision what it is able to do.

>I don't know why people bother

It's not particularly difficult to understand why. An individual home license for Mathematica is $320. An unrestricted license for an open-source "alternative" is $0.

To be an alternative to Mathematica, it doesn't have to be as good as Mathematica.

It just has to be useful enough that learning it is an acceptable tradeoff for "not spending $320 and becoming locked into Mathematica-specific tooling"

How times change, $320 would be considered a very cheap student price for a software package a couple of decades ago.

Were the students rich back then? Did they pocket student loans instead of spending them on tuition? Because I can't imagine how $320 could not be crazily expensive for an average undergrad.

(A decade ago, we'd just pirate the software we needed, because a tunnel to university's licensing server was both unreliable and a PITA to set up...)

Depends on the country.

I did buy software with student discount during high school, which means even more resource constrained than university level students.

Yes there were lots of piracy with street bazaars even, but I really wanted to own proper Borland software and managed to save money for it.

Those that produce software also have their own priorities, based on how they can managed to pay their bills, which given the comments here is why most software tooling shops nowadays mostly sell to enterprise customers.

For hobbyist grade symbolic manipulation, I've always found Maxima good enough. It's especially convenient because it has a command line interface, so you can just type the equation and get the answer immediately.


Maxima is more than hobbyist grade.

X is good enough for Y doesn’t imply that X cannot go beyond Y.

If X goes beyond Y, then someone claiming that isn't wrong, and provides more information than someone claiming merely that X can do Y.

No, it simply means they found X good enough for their modest needs, they didn’t have deeper needs to make a stronger statement about X based on personal experience.

Just saying because you focused on that: Mathematica has a command line interface too

Mathematica also costs $320 if you want to use it individually for purely hobby products, $2700 if you want to use it professionally and your employer doesn't already have a license.

Agreed. I'm not sure how many people that are the developer only type on here (non engineers or scientists)realize how nice the tooling can be in Mathematica. A corporation with basically 1 product, ~800 employees, and 3 decades of software development can do an awful lot. It ain't perfect though and the cost is crazy. It's good to have and know free alternatives (even if inferior) so you have fallback software to use if you want to leave your job and be a contractor.

My buddy is a GIS analyst/technician (master's degree in it) and a lot of experience in ESRI Arc-GIS, which is insanely expensive. Both he and several colleagues have QGIS installed and are learning it in case they go solo and don't have a client with an ESRI system.

Just so people know, Esri sells a Personal Advanced Desktop license for non-commercial use for (I think) $100/yr.


Normally an Advanced Desktop license with multiple extensions would run well north of $10,000/yr with an initial purchase price about 4x that amount.

Yea, $40k is insane for an individual. $100 a year would be fine if commercial. To me even that is dumb. Someone has to pay to use your software for hobby and non-paying work? That just sounds wrong lol.

Mathematica isn’t expensive, in the scheme of things. Some engineering software such as Cadence can run $100k/year/seat for maintenance. I don’t even use Mathematica much, but keep paying the $500/year maintenance, because when I do need it, I really need it.

Agreed it is much cheaper than something like Cadence, but it is still a no go for most people doing solo work.

For fun I do knot theory and using Sage and snappy I feel there are more functions that are relevant to what I want to accomplish versus what is available for me in Mathematica.

Also, Mathematica has a very terse and somewhat confusing syntax (I have used lisp before). On the other hand Python is a much simpler way for me to write code in.

Lastly, it eliminates the price which if you aren't a University or a corporation you won't have access to those tools. This makes it easier for people to reproduce their work.

EDIT: corrected typo

Even compared to Lisp, Mathematica code tends to end up being write-only code. Variable scoping semantics is weird, and cajoling Mathematica to do things in the order you want can be cumbersome. Mathematica is also just slow and buggy, especially when you have to use a license server. (Mathematica on macOS frequently beachballs.)

Is there a BNF online for Mathematica?

I know there is a project to do Mathematica-like things (computer algebra system) on github written in pure Python ( http://sympy.org/ ).

I've been told that Sage ( http://sagemath.org/ ) is Mathematica-like but uses Python as its programming language.

There is also Maxima ( http://maxima.sourceforge.net/ ) which also has a close to Mathematica experience.

Yea I had that feeling too. I wish they replaced the syntax with a python/ lua / javascript ripoff.

There was a very serious call for an open source CAS a couple of years ago foe the very simple reason that the CAS code used in research needs to be auditable. There are a ton of papers out there which base their validity on the premise that Mathematica performed correctly. Without source code, the validity of these calculations cannot be realistically proven.

Such CASs do exist indeed, check Reduce: https://en.wikipedia.org/wiki/Reduce_(computer_algebra_syste...

Which is awesome, BTW. There's also Giac/Xcas: https://www-fourier.ujf-grenoble.fr/~parisse/giac.html, and a few more specialised ones.

Reduce looks really like something that I should check out. Thank you for pointing it out.

Giac/Xcas is the CAS included with then HP Prime scientific calculator.

I’m pretty sure people said the same thing about Linux back in the day. Not that this effort will necessarily have anything like that level of success, but requiring a lot of work doesn’t make it impossible for open source to succeed.

I fully agree. I work half of the time with Mathematica, the other half writing Fortran. Now you can guess what my job is ;). There is just no general purpose replacement for Mathematica. The language (everything is an expression) is beautiful and powerful. Whenever I tried something different I spent too much time looking for missing things or circumnavigating quirks and limitations. Other CAS are certainly useful when you can live with their limitations. Second place for me goes to Matlab, which occasionally performs certain tasks better (faster), but I don't like the language very much.

I can't say anything about Matlab, which seems to be fully focused on engineering applications.

Did you mean something besides "Matlab" in one of these instances?

"Second place for me goes to Matlab... I can't say anything about Matlab..."

>Mathematica, Fortran

Fellow theoretical physicist?

Heh ... back when I was still in pursuit of the elusive academic career, I used MuMath, Maple, and Macsyma along with Fortran, C, and this odd language called Perl (to automate many of my jobs). Mathematica was still new-ish, and mostly confined to Macs.

These days, post physics, I do most of my work in Perl, Python, Julia, and various DBs, with lots of spreadsheets and slide decks.

I have Maxima (GPLed Macsyma) on my laptop now. I love that the fortran(); bit still works ...

(%i1) integrate(sin(x) * exp(-x) ,x,0,a); Is a positive, negative or zero?


                     - a
      1   %e    (cos(a) + sin(a))
(%o1) - - ------------------------------

      2              2
(%i2) fortran(%o1);

[updated to fix formatting issues]

I left academia before Julia became popular.

What's the deal with it, does it actually add anything over c/fortran + python?

It (often) performs much better than python/matlab without giving up the ease of use of those languages for numerical/scientific work.

Sounds reasonable, but am I missing something deeply important, like say lisp or haskell, if I don't learn Julia. What I've seen it's a nicer fortrant.

Julia is actually a pretty interesting language under the hood that is doing a lot of powerful things with metaprogramming and lisp-style macros. It also has a solid (optional) type system and method dispatching making a lot of things very clean.

That being said Julia has also done very good job of making it easy to use as just matlab 'clone' if that is what you want.

edit: I should add that as much as I admire Julia and enjoy playing around with it. 99% of my numeric work is still done with numpy and a smattering of C due to libraries/existing code/inertia

What else, am I right?

For some areas within algebraic geometry I think other CAS's work better than Mathematica and have functionality that it lacks. For example, in the past I used https://www.singular.uni-kl.de/. It has been too long since I studied such things so I cannot give any specific examples.

> it's just too developer intensive a task. there is so much work and not to mention IP in just Simplify[] that I don't know why people bother

> the challenge that comes to mind is that undertaken by the teams that contributed to numpy, scipy, and pandas in order to be a viable alternative to Matlab.

I mean, numpy/scipy/pandas are reasonably successful. And to take a larger view, open source software has made great gains in replacing not only Matlab, but SAS, SPSS, Stata and others as well. A large amount of specialized domain knowledge was required to replace those as well. What makes Mathematica out of the reach of the same forces (economic and social) that have pushed open source software into replacing Matlab/SAS/SPSS/Stata/etc.?

I used wxMaxima. Worked fine for what I needed it for (integration, solving systems of equations, etc.) In some cases it even solved problems that Mathematica couldn't.

I am actually quite happy with Sympy, it sometimes needs a helping hand but : - it can solve the equations that I need solved - it is open source and free - it is a python library (I alreaddy know the syntax and it can be plugged in a python codebase) - I can export the results in Latex, C++, Haskell, ... (nice bonus)

It's true that many people have tried making open source CAS, but fxsolver isn't one of them. You will find great difficulty finding a link to its source code, and wikipedia lists it as proprietary.

Mathematica is to Sage as OS X is to Linux.

Most people who don't know better mistake polish for capability.

If this is high-school hobbyist project, congratulations!

Otherwise, it is a simple univariate function evaluator, not really a solver -- it doesn't handle multivariate equations, nor give numerical solutions to implicit equation systems F(x) = 0 (typically calculated using the Newton-Raphson method).

As far as I can tell, it doesn't seem to "solve" at all -- it merely evaluates the RHS, given a set of parameters.

It is definitely not a CAS or anything like that.

You can solve for any of the variables (you can select the variable, or just leave one field empty). It's not very clear though, and it does not give all solution.

Also, you're in for a surprise if you search for Fibonacci. It gives a useless formula, and you cannot even evaluate the n-th number directly.

1) Fair point -- I take that back about not being able to solve.

2) Finding all roots to a general nonconvex equation system is a NP-hard problem. It can be done by partitioning the feasible region into convex regions and doing local searches, but typically numerical methods will only return a single solution for a given initial guess. So it's fair that it cannot return all solutions.

3) The Fibonacci sequence is an iterative equation, so explicit iteration is typically required to evaluate a Fibonacci numbers at n. It's fair that a general root-finding algorithm cannot handle iteration.

I want to be fair to the authors, yet at the same time, want to provide gentle feedback that the technical depth of the product may not be sufficient to feasibly sustain a business (except maybe through ads? But even that will subside at some point).

Most engineers have large Excel files that do this sort of thing because it really isn't that hard to do (some use simple VBA code for Newton-Raphson -- it's Calculus 101 stuff), plus their Excel files integrate with their other custom calculations.

Yeah was at least hoping for an equation solver e.g. find radius given area

Nice. It's a stretch to call this a Wolfram Alpha alternative but this long list of calculable equations can make it useful for quick, back-of-the-envelope calcs. The formula linking feature is also a fresh touch for a calculator but the plotting tool could use some improvement since there other free tools out there doing plotting much better (Desmos, Geogebra, etc)

Would love to see an open source alternative (or at least a rich API) so that we can build different front ends for different needs.

OT question, I've seen dozens of algebra solvers now, but are there are good ones for simple geometry problems?

Examples are like



How does a program interact these problems? I assume the hardest part is the input.

Maybe Geogebra? https://www.geogebra.org/

Thanks, that's cool, but it's limited to graphing, can it solve geometric problems like the two links I posted?

Great tool, just starting exploring it.

This brings into focus a math issue I've been wrestling with for some time, but haven't yet been able to adequately express.

Unexpectedly, some of the "equations" posted here aren't really equal! For instance, "pressure altitude - in feet"[1] (formulas that require a particular set of unit are a big red flag) is given as:

  h_alt = ( 1 - ( P_sta / 1013.25 )^0.190284 ) · 145366.45 
But this can't be correct -- the left side has a dimensions of length^1, while the right side has dimensions of (mass^0.190284 · length^-0.190284 · time^-0.380568). At the risk of stating the obvious, these are not equal!

Another red flag is that the page specifies that altitude and pressure inputs for this formula (I can't call it an "equation") must be given as dimensionless numbers. But length and pressure quantities have dimensions of length^1 and (mass^1 · length^-1 · time^-2), respectively.

To transform this expression into an equation (and as a side-effect, make it work with any arbitrary pressure and length units), just replace each "naked" (improperly dimensionless) variable X by the quantity X/<unit>, then rearrange so the units become part of the constants. For example, the above expression can be refactored into an equation as follows:

Substitute (X/unit) for X:

  (h_alt / foot) = ( 1 - ( (P_sta / millibar) / 1013.25 )^0.190284 ) · 145366.45

  h_alt = ( 1 - ( P_sta / (1013.25 millibar))^0.190284 ) 145366.45 foot
Convert to SI:

  h_alt = (1 - (P_sta / (101.325 kPa))^0.190284 · 44307.69396 meter
Note that we can do the same thing with the "equivalent" expression in meters[2] (a further red flag: if they're equivalent, why should any system of equations need more than one copy?) it should yield the same result:

  h_alt = ( 1 - ( P_sta / 1013.25 )^0.190284 ) · 44307.69396 
  (h_alt / meter) = ( 1 - ( (P_sta / millibar) / 1013.25 )^0.190284 ) · 44307.69396
  h_alt = ( 1 - ( P_sta / (1013.25 millibar))^0.190284 ) · 44307.69396 meter
Well I'll be damned. :)

Euler was the first person to realize this, afaik. Is there a term to describe these kind of "de-unit-ified" equations? More than once I've found myself needing to reconstruct a proper equation (with correct dimensions and constants) from one of these bastardized non-equations.

[1] https://www.fxsolver.com/browse/formulas/Pressure+Altitude+-...

[2] https://www.fxsolver.com/browse/formulas/Pressure+Altitude+-...

edit: I'd fix it myself (by submitting an equation), but I can't figure out how to embed units in the equation itself. It interprets "kPa," "kg," "m," and "s" as variable names. :(

TL;DR fxsolver.com doesn't seem to support embedding units in expressions, leading to to confusing non-equal "equations"

Dimensional analysis is one of my favorite subjects. Unfortunately the more advanced results from it are rarely taught outside of fluid dynamics classes, e.g.:


The pi theorem is one of the most useful results in my work as a theoretical fluid dynamicist. The (modest) dimensionality reduction it offers seems unbelievable at first.

The book by Barenblatt on dimensional analysis is pretty awesome too.

> Euler was the first person to realize this, afaik. Is there a term to describe these kind of "de-unit-ified" equations? More than once I've found myself needing to reconstruct a proper equation (with correct dimensions and constants) from one of these bastardized non-equations.

Not very surprisingly, it's called nondimensionalization (https://en.wikipedia.org/wiki/Nondimensionalization).

Damn, got my hopes up. That's close, but not quite the same thing.

The nondimensionalization article is talking about reducing free dimensions in a model by variable substitution (while following all the rules of dimensional analysis), but I'm talking about re-writing a single equation so it can be used by "unit-phobic" people by simply dropping (not substituting!) all units (breaking all the rules of dimensional analysis), and assuming a certain set of units for input and output values.

Compare this (incorrect) formula, which gives no hint as to which units are being used for pressure or height:

  h_alt = ( 1 - ( P_sta / 1013.25 )^0.190284 ) · 145366.45
with this (correct) equation, which always works regardless of what units are chosen (just follow the unit conversion rules):

  h_alt = (1 - (P_sta / (101.325 kPa))^0.190284 · 44307.69396 meter
There are even unit-preserving calculators like Frink, which allow you to specify any units (for instance, giving barometric pressure in light-nanoseconds of mercury[1]).

[1] http://frinklang.org/fsp/frink.fsp?fromVal=%281+-+%282.5+lig...

FWIW, Nondimensionalization for dummies[1] has a nicely-motivated introductory example (from ecology).

[1] http://wp.auburn.edu/radich/wp-content/uploads/2014/08/Nondi...

Might be free but the ads are too aggressive and the design is very lacking and counterintuitive.

To be honest, I can't really see the use of this website for any practical work related purposes. Comparing it to WolframAlpha (as the submitter does in the title) is a little pretentious in my opinion.

All it does it solve the simplest equations with some unit annotations and a description. It looks like this is something for a high school physics class at most.

I just entered "5 + 4" into the search box, and it should just work. It doesn't. On the LHS, it shows "5 + 4 (16)" in my recent searches, which is equally confusing. Apparently you have to add solvers to some array to use them? This feels incredibly over-engineered. I'll stick to WolframAlpha because it's a simple search bar and it just works.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact