alexbarry / AlexCalc

Scientific calculator with LaTeX equation display, variables, units, complex numbers. Runs locally in your browser with WebAssembly.
Other
25 stars 1 forks source link

Memory #22

Open Ypot opened 2 months ago

Ypot commented 2 months ago

Could "define new variable" be used to add values to memory?

User could choose to define new variable, and directly be offered a letter associated with the value in the screen. Both editable, but if accepted it would already be a memory.

alexbarry commented 2 months ago

Hi, thanks for the suggestion! I'm not completely sure I understand. Here are some possibilities:

Variable name suggestions

Are you suggesting that the calculator should suggest variable names based on existing variables, and maybe the magnitude or units of a value? E.g. a value in Newtons may have a variable name suggested such as "F" or "F_1", and if that variable already is defined, then maybe the calculator would auto suggest a new name, like "F_2"? I do like that suggestion! It seems like an open ended problem and besides deciding names based on units, I may need some suggestions.

If this is what you mean, what do you think a good user interface would be? If you press the "var" button, should a suggestion appear in the "Define new variable" popup? Or would it be nicer to make it even easier (but less obvious), like pressing "alt" should convert the "store" button into a "store and suggest a name" button? (Maybe called "auto store"). I could do both of these.

Fewer UI steps to define a variable

Or are you suggesting that if the user presses a button from "Define new variable" without having pressed the "store" button, the calculator should automatically insert the "store" operator? This does seem better, the current behaviour isn't very discoverable.

How to store variables (current behaviour)

Just to confirm that you're aware: you can already store new variables in memory by entering your expression, then pressing "store" (which enters the text ->), then entering a variable name, optionally through the "var" button popup in the "Define new variable" section (clicking a variable button, then pressing "Insert variable"). Then you can press enter and refer to your variable in future expressions and it will contain your value.

If you already entered your expression and pressed enter, instead of having to re-type it, you can press the "up arrow" button and it will appear as input. Then you can press "store" and enter your variable name.

image

You could also press the "ans" button, it automatically stores the value of the previous expression. You could also press "ans", then "store", then your new variable name.

One idea that I had while writing this: if you press "store" and then a variable name without any expression before the "store", it should default to "ans". (I'd like to make this happen if the user enters any expression that needs something to its left, like addition or multiplication, etc.)