mkulesh / microMathematics

microMathematics Plus - Extended visual calculator
GNU General Public License v3.0
566 stars 68 forks source link

Implement plus-minus operator #84

Closed frozenspider closed 1 year ago

frozenspider commented 5 years ago

Please implement a ±x function for taking an expression with both positive and negative sign. This is useful e.g. when square roots or absolute values are involved.

Initial text for historical reasons: Please implement a |x| function for absolute value of an expression. This is useful e.g. when square roots are involved.

mkulesh commented 5 years ago

Hi, @frozenspider there is already such a function. Please try a := |-5| a = ? b := |1+2i| b = ? c := |sin(4)| c = Please see attached screenshot screenshot_20181224-123436 Or do you need an other function?

frozenspider commented 5 years ago

Sorry @mkulesh, got a brain fart :) What I've intended to ask for was an exact opposite of that, plus-minus operator ±. Corrected the issue.

mkulesh commented 5 years ago

Hi @frozenspider Just to better understand... If we have an expresssion with a single ± operator: a := 1 ± 2 Then the result is an array with two elements, where the first corresponds to 1 + 2, and the second corresponds to 1 - 2. That is in the case if we have two or more ± operators in the same equation: a := (1 ± 2)*(3 ± 3)? Shall the result be an array with 4 elements (that corresponds to 4 different combination) or only 2 elements (for the first element, we use "+" for all ± operators, and for the second we use "-" for all ± operators)?

frozenspider commented 5 years ago

I see too ways of resolving this. Either:

As far as I'm aware, second notation is more common, e.g. cos(x ± y) = cos(x)cos(y) ∓ sin(x)sin(y)

mkulesh commented 5 years ago

The second notation is also easier to implemen. I think I can first implement the second notation (where results always consists of two values): x := a ± b ∓ c ∓ d would mean a + b - c - d and a - b + c + d I can start with the implementation in January. Is it ok for you?

frozenspider commented 5 years ago

I'm merely a petitioner, I'll be happy with whatever improvement you do :) Thanks for the great app!

mkulesh commented 1 year ago

Currently, no plan to fix it