A calculator for the Terminal that renders beautiful math
kary.us
kary.us
I mean, if I do math or physics, I usually follow conventions, so I expect G to be usable as the gravitational constant, while g to be usable as the free-fall acceleration, maybe in the same formula.
You haven't made a language here, you have implemented one. That language is mathematical "Nota"tion.
You've implemented it incorrectly, because mathematical notation is case sensitive. A doesn't mean a, any more than it means α.
It is, of course, your project, and your sense of aesthetics which must ultimately be satisfied. I hope you will consider what I and others are trying to communicate to you, because I would use this, if it weren't broken from my perspective.
I personally love case insensitivity because it is really hard for me to remember the cases. I love macOS for its case insensitive file format and each time I design a language—and Nota is not mathematical notation, it is its own language with its own grammar. Just like the way Mathematica is its own language—I seek to see if having case insensitivity is possible. I loved it that with Nota, because the language was so simple I could even have spaces in the names. These are awesome for quick doings.
I haven’t resisted to the idea of case sensitivity though. But to be honest never thought about it.
For the sake of beauty nota renders each word in first-letter-Upper/rest-Lower since this was the most beautiful representation I experimented with. I will add the A and A’ to have both a and A (and the rest of the letters) this was if someone really loves to have the distinguished cases they can and I can keep my easy to write and beautiful in print style.
I think this solution is the win-win. And also I think if you regard Nota as a separate language with separate ideas; You can have more fun with it. It’s like watching How I met your Mother and trying to use it to replace Friends, it’ll make a bad experience, but regard it as a its own series and you then can see its beauty
That's horrifying. Spaces between identifiers should of course mean products.
There is a long ongoing discussion about an upcoming standard for image support in terminals: https://gitlab.freedesktop.org/terminal-wg/specifications/is...
Instead, we need term programs that can handle type ligatures better. Being able to use something like FF Chartwell in a terminal would be amazing .. and would lead the way to having properly formatted mathematical notation in the terminal, without requiring a new standard to implement. Ligatures are already a thing - they just need to be better supported by the term apps.
But I mean that term apps should have better support for ligatures - as in font/type ligatures - for doing proper mathematics.
https://en.wikipedia.org/wiki/Mathcad#/media/File:Mathcad_25...
https://books.google.com/books?id=zjAEAAAAMBAJ&lpg=PA63&dq=m...
a + b * x + c /|
to this:
a + (b * x + c) /|
And apply again to get this:
(a + b * x + c) /|
It (e.g.) let’s you write fractions without needing to use loads of parens (which have a cost as they must be balanced) or needing to think about whether the numerator will have more than one term.I guess with rich input I’d also want to see the output in “big” mode.
Another way to try to make input easier is to use rpn. This has advantages and disadvantages.
Currently the calculator I most use is gnu Calc (I also use R occasionally for calculating quantiles). GNU Calc is the calculator built into emacs. It has an rpn interface and an algebraic one. A nice feature of the algebraic interface is that you can use $ to mean “the top entry on the stack” and so you can incrementally build up an equation. A second feature is selections. Their internal implementation is weird (based on hidden “functions” and rewrite rules) but they work fantastically well for modifying and manipulating the inside of a formula or equation. It also has a “big” display format which looks a bit like this one except that it predates Unicode symbols being common and so is pure ascii. (It also has tex output and emacs has image support but no one has put the two together yet)
Mainly I use Calc because I’m in emacs anyway and it has a ton of features that are easy to access (eg arbitrary precision floats, bignums, modular arithmetic support, complex numbers, interval arithmetic, vectors, matrices, algebra, curve plotting/fitting, unit conversions, ...). I feel like the variable support isn’t great. I feel like I want to eg have some set of variables, defined to be various input numbers, and write formulae in terms of them and then get the formula on the left without variables substituted and it’s numeric evaluation (with them substituted) on the right. There’s something weakly like this using => but it doesn’t compose well. If you add a => 1 to b => 3, you don’t get a + b => 4, you get (a => 1) + (b => 3). (I think. My memory is a bit rusty for the last example).
> Nota approaches identifiers much differently than any other language.
is not actually true. Goldman Sachs have an internal language, Slang, which also allows internal spaces in identifiers, and where identifiers are case insensitive. I believe it originated as an MIT research language so probably there are others with a similar approach.
I think we can forgive them for saying that if the exception is not readily available.
The SymPy Unicode output mode also does a pretty good job on the command line. You can try here https://live.sympy.org, for example https://live.sympy.org/?evaluate=(1%2F2)%2F3%20%2B%202%2Fsqr... (see Settings on the side to turn off LaTeX rendering)
https://reference.wolfram.com/language/tutorial/UsingATextBa...
Do you plan to extend the language with symbolic capabilities?
So your target audience is strictly (US) English?
Of course, it is (almost) impossible to account for the enormous amount of keyboard layouts that exist, so I wish we could agree to use key positions over the characters they produce for shortcuts, so we can cover a significant portion of the population with ANSI/ISO layouts. I'm honestly not sure what keyboard layouts are used in countries with entirely different scripts, but my cursory Google searches suggest the physical layout is the same as ours.
Sure, you might lose some mnemonics on layouts that aren't QWERTY, but at least the majority of shortcuts would be usable by default compared to having to remap them in every application. The application could even resolve what keys are actually mapped to the physical keys and display the correct shortcut in menus.
Destiny 2 actually seems to do this and does, as far as I was able to tell, an excellent job of it.
https://github.com/pmkary/notaBonus feature: symbolic derivation
One documentation nit: “Parenthesis” is singular; the plural is “parentheses”.