Scientific Calculator Whipped Up In Python

Scientific calculators were invaluable to most of us through high school and college, freeing us from the yoke of using tables to calculate logarithms and trigonometric functions. Once out in the real world, it’s no longer necessary to use an education board approved device to do your maths – you can do it all on your PC instead. For those keen to do so, [AstusRush]’s latest Python work may be just the ticket!

Far exceeding the capabilities of the usual calculator apps, there’s plenty of useful features under the hood. Particularly exciting is the LaTeX display, which shows equations in textbook-quality human-readable format. There’s also a graphing suite, and capability to handle matricies and vectors. LAN chat is implemented too, useful for working in teams.

It’s a useful tool that may suit better than a full-fat MATLAB install, particularly at the low, low price of free. This is one calculator that CASIO will have to keep their nose out of!

29 thoughts on “Scientific Calculator Whipped Up In Python

  1. I’ve been looking for a calculator program that a) enters data like a calculator, and b) has all the functions of my scientific calculator.

    So far, no luck…

    Every time I try to do a calculation, such as multiply C by L, and then press SQRT, it throws an error because SQRT has to come *before* the number, not after. I have to manually go up and place the cursor before the number, and then go down and hit SQRT.

    This is not how I’m used to entering data in my physical calculator. I could learn the new way, but switching back and forth would then be a pain. (Yes, I often use my physical calculator while designing things.)

    For some reason, online calculators have a tiny abbreviated list of functions. For example, the default app in Cinnamon doesn’t have X**2, you have to type X**Y and enter 2 for the exponent. Similarly, the one on windows has X**2, but not SQRT. You have to enter X**Y and 0.5 for the exponent. My calculator keys each have 3 functions (two shift keys), plus things like INV and HYP as prefixes. You can always find the exact function you want somewhere.

    This project is a good example of something that’s a non-calculator. It will plot, and will take input in a high-level language, but it doesn’t *enter* like a calculator. It’s really a computer language interpreter with plotting.

    I’m still on the lookout for an actual calculator program, if anyone has any suggestions…

    (As an aside, it would be interesting to have a calculator mode for electronics. The operator || (parallel to) would be useful, as would (L FREQ C) (gives frequency of L and C, in the manner of X**Y). Maybe special functions that downconvert or upconvert by a million – convert Farads to microfarads by one keystroke, then to picofarads by one more. Convert from V to dB or I to dB – that sort of thing.)

    1. HP RPN calculators are probably the most faithfully replicated option. Most modern Casio and Sharp calculators allow you to construct an expression prior to evaluation, so the mode of operation you’re looking for is kind-of dying off.

    2. The virtual keypad in Qalculate does allow entering sqrt() and other unary operators either before or after operands. If entered at the end of existing calculation without putting a * or other binary operator in between, it will automatically enclose the whole expression so far.

      It also has ways to define custom functions, but the predefined ones are lacking anything electronics-specific.

    3. I’ve just tried the Windows 10 calculator and it has a square root option. In standard mode it appears as its own button, in scientific mode you need to toggle the ‘2nd’ button to show the shift keys which turns the x^2 into the square root. Alternatively you can just type the @ symbol in either mode and it will perform a square root for you. The scientific mode also has all the trigonometric options you mentioned with INV and HYP buttons (though INV is labelled as 2nd).

      I was going to knock it for not being able to store multiple items in memory but it turns out it does that too and you can see a list of stored numbers and click on them to insert them (for numbers with a lot of digits you need to be careful that you don’t click inside the number itself but rather on the box containing the number).

      Maybe there’s something else that it’s missing but you may benefit from giving it another shot. As a bonus it’s also open source!

    4. Strange… my MS Windows 10 calculator has square root… set the calculator to scientific (triple line menu where you can select standard, scientific, programmer or date calculation), hit the 2nd “key”, and the sqrt function replaces the x^2 function.

    1. Having used Octave a bit, I can tell you it is infuriatingly slow compared to Matlab. Unless you ABSOLUTELY must use the Matlab language (e.g., you have a large/complicated program already written that you want to run), I think you would be better off just using a different language. Python should cover all the bases in that regard, but Julia (https://julialang.org/) also looks interesting and similar to Matlab. (Note: I haven’t used it, so take this with a grain of salt.)

      1. That is unfair to Octave—in most situations it’s as fast or faster than Matlab. If you know Matlab or have a significant Matlab code on your hands, you definitely should try Octave before rewriting everything in another language.
        I agree with you that it’s not the same—heavily looped unvectorized code is indeed slower, and there are parts of Matlab (especially toolboxes) that Octave does not implement yet, but it’s an excellent software that I use daily and I encourage you to try. They also have a very friendly community with a helpful mailing list.

    2. Absolutely check out Julia. It is a modern open-source MATLAB alternative. It is blisteringly fast, dynamic, and an absolute joy to program in. It’s not intending on being syntactically compatible with MATLAB/Octave at all, but it should feel similar. It has completely replaced my previously MATLAB workflows and is just orders of magnitude better.

  2. Neat project. Reminds me of a couple others I haven’t played with in a long time.

    geogebra is pretty neat for 2D functions. ( If you like playing with this, try the game Euclidia )

    sympy does symbolic calculations and plots.

    vpython has a easy API for 3D objects and plots.

    github.com/trzemecki/Unum add units like meters and seconds to numbers.

    pypi.org/project/units/ add units like meters and seconds to numbers. ( haven’t tried this one, looks newer than the one above)

    pypi.org/project/numericalunits/ a cool hack to add units.

    wolframalpha is just plain amazing.

    Agree with the posts above numpy, scipy and octave are all good for numeric work.

    What I haven’t found is an easy to use open source finite element modeling, computational fluid dynamics, or multiphysics.

  3. I have wanted (for most of my life) a calculator with a row of buttons for the SI prefixes. (nano to Giga would do)

    Though for many calculations with units in them the Google search bar is super-useful. You can type things like “4GW / 4 BTU” and get the answer of 948 kHz.

  4. ipython shell has been my “calculator” for years now. For basic stuff, it’s great. If I want more advanced stuff: import math. More advanced again? import numpy, pandas.

    The other tool I turn to is gnumeric. It’s Engineering Notation feature is a godsend!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.