microsoft / calculator

Windows Calculator: A simple yet powerful calculator that ships with Windows
MIT License
29.54k stars 5.35k forks source link

Calculator app crashes when trying to plot 'x < sin(x)' #1326

Open ghost opened 4 years ago

ghost commented 4 years ago

Describe the Bug: The Calculator app crashes when we try to plot the inequality 'x < sin(x)'.

Steps to Reproduce:

  1. Open the Calculator in Graphing mode.
  2. Type 'x' as the first expression.
  3. Type 'x^2' as the second expression.
  4. Type 'x < sin(x)' as the third expression and press Enter.

Crash

  1. You will notice that the Calculator app crashes.

Note: The Calculator app is currently unable to plot inequalities of the type:

x < sin (x)
sin(x) < cos (x)
cos(x) < sin(x)

Expected Behaviour: The Calculator should readily plot these inequalities and should not crash while handling them.

Requested Assignment: I'm just reporting this problem. I don't want to fix it.

MicrosoftIssueBot commented 4 years ago

This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it.

ghost commented 4 years ago

Here is how Microsoft Math Solver plots sin(x) < cos(x):

Screenshot_2020-07-28-22-03-21-995_com microsoft math

grochocki commented 4 years ago

For sin(x) < cos(x), I get this:

image

I get error messages for the others, but no crash:

image

ghost commented 4 years ago

@grochocki Are you sure you followed the steps exactly as I told above? The crash definitely occurs.

You didn't enter x and x^2 before x < sin(x) as I did above.

ghost commented 4 years ago

For sin(x) < cos(x), I get this:

image

I get error messages for the others, but no crash:

image

@grochocki For this inequality, the Calculator mostly shows 'This equation could not be graphed'.

And for cos(x) < sin(x), the calculator either displays a blank graph or displays the same error as for sin(x) < cos(x).

ghost commented 4 years ago

Crash.gif

Note that my input was x < sin x.

grochocki commented 4 years ago

Right you are! Thanks for the additional information.

ghost commented 4 years ago

@grochocki x < sin(x) is indeed too complex to be plotted by a graphing calculator. For plotting this inequality, we have to find all possible values of x for which it is less than its function i.e. sin(x). For example (-0.1) < sin(-0.1).

But inequalities like sin(x) < cos(x) and cos(x) < sin(x) are standard inequalities taught in trigonometry at the high school level. These ought to be handled properly by a graphing calculator.

onlymx13 commented 3 years ago

Isn't x < sin(x) just the same as x < 0?