Sublime-WolframLanguage icon indicating copy to clipboard operation
Sublime-WolframLanguage copied to clipboard

Some issues about numerical constants

Open shigma opened this issue 6 years ago • 6 comments

built_in_numeric_constants defines some numerical constants for wolfram language, but here are some minor issues:

  1. Infinity and Indeterminate seems numerical constants to me, for they have mathematical meaning and we can just do any mathematical operations on them.
  2. MachinePrecision seems a little bit strange compared with other constants. It may be just have a numerical value. If accepted, should some other built-in symbols with numerical values (including but not limited to numbers defined here) be accepted too?

shigma avatar Nov 04 '18 18:11 shigma

  1. All the symbols now in built_in_numeric_constants are NumericQ. Neither Infinity nor Indeterminate satisfy that. I see your point though. What do the other people think?
  2. MachinePrecision is a numerical constant, $MachinePrecision and other symbols is that page are numbers.
In[21]:= Through[{NumberQ, NumericQ}[$MachinePrecision]]
Out[21]= {True, True}

In[22]:= Through[{NumberQ, NumericQ}[MachinePrecision]]
Out[22]= {False, True}

batracos avatar Nov 04 '18 20:11 batracos

You've got a point here.

@chere005 @ViktorQvarfordt any ideas?

shigma avatar Nov 05 '18 03:11 shigma

I think Infinity and Indeterminate make sense in the same way as MachinePrecision. Perhaps calling these built_in_numeric_constants is the issue, and they should just be called built_in_math_constants or built_in_constants. I approach this more from the angle how do I want my code to look and I would like some visual identifier for these in the same way I would want an identifier for Pi

chere005 avatar Nov 08 '18 19:11 chere005

  1. All the symbols now in built_in_numeric_constants are NumericQ. Neither Infinity nor Indeterminate satisfy that. I see your point though. What do the other people think?
  2. MachinePrecision is a numerical constant, $MachinePrecision and other symbols is that page are numbers.
In[21]:= Through[{NumberQ, NumericQ}[$MachinePrecision]]
Out[21]= {True, True}

In[22]:= Through[{NumberQ, NumericQ}[MachinePrecision]]
Out[22]= {False, True}

If this is your definition for numeric constants, I should be removed from the list because NumberQ[I] returns True. Generally, I approve the idea that a rule should be set so that we can easily keep pace with every version of Mathematica, however !NumberQ[#] && NumericQ[#]& may be not qualified enough.

@chere005 any ideas?


(Sorry, there's some problem with my browser ...)

shigma avatar Nov 10 '18 05:11 shigma

  1. All the symbols now in built_in_numeric_constants are NumericQ. Neither Infinity nor Indeterminate satisfy that. I see your point though. What do the other people think?
  2. MachinePrecision is a numerical constant, $MachinePrecision and other symbols is that page are numbers.
In[21]:= Through[{NumberQ, NumericQ}[$MachinePrecision]]
Out[21]= {True, True}

In[22]:= Through[{NumberQ, NumericQ}[MachinePrecision]]
Out[22]= {False, True}

If this is your definition for numeric constants, I should be removed from the list because NumberQ[I] returns True. Generally, I approve the idea that a rule should be set so that we can easily keep pace with every version of Mathematica, however !NumberQ[#] && NumericQ[#]& may be not qualified enough.

@chere005 any ideas?

(Sorry, there's some problem with my browser ...)

I think my comment from 2 days ago covers this. I don't think we need to decide based on NumberQ or NumericQ but rather which symbols we want highlighted similarly because its convenient and helps understand the code

chere005 avatar Nov 10 '18 07:11 chere005

Let's move Infinity and Indeterminate then.

batracos avatar Nov 13 '18 09:11 batracos