I am writing a program in which I am using NumericQ. I am trying to allow symbols to also be considered Numeric, so I have been using NumericQ[a]=True for all of the symbols that I want to be numeric. However, this messes with the functionality of Solve so that I have to write NumericQ[a]=False for all of the symbols before using Solve. Going back and forth repeatedly, even using a map function, is annoying. To solve the issue, I created a new function defined by numeric[x_Symbol]=True; numeric[x_?NumericQ]=True; numeric[___]=False;. The issue with this method is that I want numeric[b+5] to evaluate as True. For example, when you type NumericQ[c]=True; NumericQ[c + 7]; evaluates to True. Initially, I added a line for every operation between symbols that I wanted to be True --Plus[x_?numeric,y_?numeric]=True. Even just adding Plus made the code significantly slower, but adding it for all of the operations - Times, Conjugate, Exponent - made it too slow to evaluate. My code makes extensive use of NumericQ, so I need whatever I use to not be much slower than it if I want it to run in a reasonable time. Thank you for the help.

Edit: The reason I want to do this is I am trying to add commutative properties like distributive to NonCommutativeMultiply. The NonCommutativeAlgebra package does this, but the symbols that I want to be noncommutative (one's with a subscript) are commutative in this package. Combining NumericQ with assigning certain symbols as numeric implements what I am wanting to do perfectly, but I have to change those symbols back to not numeric if I want to use the solve function.

  • 1
    $\begingroup$ If every symbol is numeric, and any composition of numeric things is also numeric, what exactly is not numeric? Can you give an example of things you don't want to consider to be numeric? Also, can you be a bit more specific as to what you need all those checks for? $\endgroup$
    – Lukas Lang
    Jul 1, 2021 at 19:46
  • $\begingroup$ Can you clarify how it interferes with Solve? I hope you are not doing NumericQ[a] = True then try to Solve for a, as that makes no sense. If you are doing that, then why do you want NumericQ[a] to be True? It only really makes sense to set NumericQ[a] to True if you also set N[a], so a truly behaves like a numeric constant. $\endgroup$
    – Szabolcs
    Jul 1, 2021 at 19:52
  • $\begingroup$ Why not use a[1] and give a the NumericFunction attribute? $\endgroup$
    – Carl Woll
    Jul 1, 2021 at 19:53
  • 4
    $\begingroup$ Overall, this feels like an XY problem: xyproblem.info More clarifications are needed. I suggest you explain the actual task you want to complete instead of asking about how to implement a solution which is very likely not the way to go. $\endgroup$
    – Szabolcs
    Jul 1, 2021 at 19:53
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Jul 1, 2021 at 20:05

1 Answer 1


In NCAlgebra you can use subscripts with noncommutative symbols.

a ** Subscript[X, 1] ** b

evaluates to

a ** Subscript[X, 1] ** b

as you would expect. Subscripted symbols inherit the noncommutative property from their base symbol.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.