So I have some rules for a symbolic inner product that work for quite a lot of cases:
SetAttributes[CircleDot, Orderless]
x_ \[CircleDot] 0 := 0
(x_ + a_)\[CircleDot] b_ := x \[CircleDot] b + a\[CircleDot] b
(x_ a_) \[CircleDot] b_ := x (a\[CircleDot] b) /; NumericQ[x]
This is great if all symbols are vectors, and the scalars satisfy NumericQ == True.
Does anyone know a good way to define symbolic scalars? I'd like some kind of 'MakeScalar' function which I can use to mark some of my symbols so that they're taken out of the inner product, and then all other symbols would be interpreted as vectors
I've tried messing around with setting Attributes, but they didn't work very well, partially because I need that if a is a scalar, so is 1/a, Sin[a] etc. . Is it possible to assign NumericQ to be true for a given symbol? I'm not sure if this would be a good idea, but I think it would work for me
NumericQ[a] = Trueworks to removeafrom the inner product, but eg.Sin[a]is not removed, and when I check,NumericQ[Sin[a]]evaluates to false, even though I have setNumericQofato be true. This seems strange to me, do you know why it is? – Jojo Jun 02 '16 at 11:15NumericQ[a] = True; NumericQ[Sin[a]]in every version of Mathematica from V9 through V10.4.1 and gotTrueevery time. What version are you using? Is there any possibility of other definitions in your application that might interfere? – WReach Jun 02 '16 at 14:19a, not sure what was going on there. Unluckily it's still not working for the case I want to use it in though. I am trying to useSubscript[m,1]as my variable, and I have calledSymbolize[Subscript[m,1]]. After this I then callNumericQ[Subscript[m,1]] = Trueand thenNumericQ[Subscript[m,1]]which evaluates to False, do you know anything about this? – Jojo Jun 03 '16 at 09:33