TW "Calculator" prototype ready to play with

Stuff that is easy to squeeze in without architectural re-think, I’m going to try and squeeze them in.

A button section for things like clear and copy to clipboard, I’m going to start putting together a “component” for that.

The focus-scrolling thingy, I’m going to have to chew on that. Sniffs like default TiddlyWiki behaviour that I’m going to need to squash, if it can be squashed.

Just starting to sketch out a menu bar for the types of things @TW_Tones and @Ste_W have mentionned.


In many ways I think the most used keys, numbers and basic operators, should be the easiest to find, perhaps all in the bottom right corner near the result display. All the other special /named functions are usually very occasional, and could even be behind a menu, except perhaps the tiddlywiki references, which some users may come to use a lot.

So The basic order could be starting at the top to the bottom and/or left right as follows;

  • Named functions eg abs(x) behind advanced button?
  • Blue and Purple sections
  • Numbers and basic operators “+ X enter”
  • Working formulae display
  • Result
  • Result buttons

One thing I wonder about is the use of “**” when “^” is a more suitable representation or is this a restriction of calculator code?

Nice progress @Charlie_Veniot

1 Like

I’d much prefer “^”, which matches my happy place that is the BASIC programming language.

The “backend” to resolve the equation is javascript.

I thought about setting up a mechanism to translate from “^” (entered in the editor) to the “**” that javascript needs (to resolve the equation) via regex etc., but I don’t particularly like that idea. It would involve making sure to not unintentionally convert any “^” used for any wonky reason in the title of a tiddler or in the name of a field.

Maybe something to consider some day, but I see that kind of thing as too much potential to gum up the works.

SIDENOTE: I still have loads of testing to do to make sure nothing in any tiddler title or field name does not get confused with “math things”.

Editor toolbar buttons (that’s what all of the calculator buttons are) show up above the editor by TW design. Seems to me I remember a discussion once about putting buttons at the bottom of the editor (or I might be getting mixed up with somebody wanting the buttons to float.) I’ll have to go digging in the discussions.

Layout of the grouping is based on the Calculator app on Chromebooks. I’ll be sticking to that layout for my benefit and sanity, but maybe someday I can setup configuration preferences so folk can order the groups differently.

Layout aside, I’d like to setup a button to hide/show groups. So basic calculator functions always visible, the rest of them pop open on demand/click. And save preferences.


Hi @Charlie_Veniot great work, I would love to integrate this into my classroomsuite for TW.
Some tiny thoughts.

  • For a screen calculator it would be good to start with a small basic calculator and unfold the more complex buttons like Tabs only if needed.
  • For a plugin it would be good, if the tiddler itself was not modified by input.
  • I think replacing ** by ^ would be good.
  • It would be good if brackets were set if there is a selection and they are needed.

Hello @JanJo, and thank-you much!

I’ve been going deeper into a “quiet quitting” kind of thing in regards to TiddlyWiki community participation.

Folk know that I’m sticking with TW 5.2.3 because I’m not fond of changes/direction post 5.2.3

As I’m getting more and more behind and finding the things I prefer being deprecated, I’m losing interest in sharing things that are considered ancient/deprecated. So updating/refining/maintaining this calculator (and any other TiddlyWiki things) have significantly lost any appeal.

Somebody else who likes all of the new stuff in the latest and forthcoming TiddlyWiki versions would be oh-so-much better to take that calculator and bring it up to non-deprecated items speed.

Sorry to disappoint, but there’s no excitement in it for this kid.

That is sad… what is the hassle with the post 5.2.3 development?
I stuck to TWClassic for a year, and I still stick to single file…
What would have o be updated in the calculator?

Eh, I really don’t like the new stuff. Not fond of the wording, and I heavily dislike the related syntax. Like I’ve mentioned before: I only upgrade when it hurts too much not to. The cognitive hurdles are too great, the benefits too small, so I stay where I’m at.

Yeah, I couldn’t tell you, because I have neither the interest nor the time, at all, to look into it. That fun little project is way far in the rear view mirror.

Can you tell me where the eval macro is? Was it coded by you? I really cant find it…

The tiddler “Charlie’s Equations Macros”

1 Like

It still seems to work flawlessly… chapeau!

Thanks! I’m pretty sure that will work for years to come.

Hi @Charlie_Veniot would you allow me to integrate a slightly modified version to my classroom suite?

Sorry to hear that :frowning:

Absolutely! Anything I throw out there on the web, if it happens to be useful to you, be my guest.

If you want to include a very very tiny attribution mention, cool. Never expected, always appreciated.

Contributions that involve deprecated stuff, that’s the kind of thing that’s the kind of thing that gums up the works.

This kid can’t be having sticks in his wheels or wheels stuck in the mud, or be putting community wheels in that predicament. So reel 'er in, dial 'er back, stay in the Zen zone.

1 Like

I made a little wiki to continue the work on this

I put the formula into a temp tiddler and added a katex-line.

It is far from beeing complete - the main flaw is the notation of powers (x**N) and squareroots (x**1/n) which does not match intuition and Katexsyntax (x^n) yet.

I turned it into a plugin because this makes it more comfortable and reversible to play with it. It is allowed by @Charlie_Veniot (and me of course) to take this further.

1 Like

@Charlie_Veniot It was quite easy to implement a better notation for powers in the formula power
It would be cool if this could be changed in the button as well and if we could implement a way to calculate and display squareroots. Could you help with this?

next thing would be a button for``\sqrt[3]{x}`

I need accommodations to help me minimize distractions, that to help me with attention regulation challenges and cognitive overload.

I heavily dislike javascript, but I dislike doing math in TiddlyWiki more. So I went with javascript. (The calculator leverages TiddlyWiki to dynamically create an HTML page that is fed to an iframe; the iframe takes care of the javascript math and displays the result. All of that fits my philosophy: use the best tool for the job.

I also heavily dislike ** as an exponentiation operator. I much prefer, as in BASIC, the circumflex character ^ as an exponentiation operator. However, I dislike inconsistency way more: having ^ in the calculator interface and ** in the javascript code, the need to translate (what I see with my eyes and what I see in my head) from one to the other as I’m working on the calculator drives me crazy. (This is just one example to demonstrate my needs that help me avoid sticks in my wheels and wheels stuck in the mud.)

My organizational needs require way too much accommodation for me to effectively work with you in regards to the kind of calculator you’re aiming for.

Much better for me and for you to have me steer clear.

Well, I’ll have my pom-pom’s and cheer your progress from the sidelines.