From your question it can be deduced that you're interested only in the Euclidean scalar product for real vector spaces, so I'll make that assumption.
In version 9, I think the cleanest way to do the symbolic manipulations you're after is to use the new capabilities of TensorReduce
. The special case of a null vector does require care because the product of the scalar $0$ with a vector is evaluated by Mathematica to yield $0$ which should then be interpreted as the null vector. This causes no problems if we define AngleBracket
to yield zero for such $0$ arguments. So the following works if we make a decision at the outset what symbols we will assume to represent vectors - here I add that to the global variable $Assumptions
:
AngleBracket[0, y_] := 0
AngleBracket[x_, 0] := 0
AngleBracket[x_, y_] := Dot[x, y]
Clear[dim];
$Assumptions =
a ∈ Vectors[dim, Reals] && b ∈ Vectors[dim, Reals];
Now some tests:
AngleBracket[3 a, b] == 3 AngleBracket[a, b] // TensorReduce
(* ==> True *)
Assuming[x ∈ Reals,
TensorReduce[AngleBracket[x a, b] == x AngleBracket[a, b]]]
(* ==> True *)
Assuming[x ∈ Reals,
TensorReduce[AngleBracket[a, x b] == x AngleBracket[a, b]]]
(* ==> True *)
So to do the simplifications in the above equations, one wraps them in TensorReduce
. The scalar x
is introduced through an additional assumption which I could have added to $Assumptions
, too.
The use of AngleBracket
instead of purely the built-in Dot
is still useful here because it allows me to handle the special case involving the null vector. For that I personally prefer to use BraKet
, by the way, because it only requires a single escape sequence to get the template for both factors of the scalar product.
Format[bk[a_, b_]] = AngleBracket[a, b]
;bk[a_ u_, v_] := a bk[u, v] /; NumericQ[a]
;bk[b_, a_ + c__] := bk[b, a] + bk[b, c]
$\endgroup$0
is not the same as{0}
which is not the same as{0,0}
, which is not the same as (say) an $L^2$ integrable complex-valued function on a space--all of which could be considered vectors--it should not be the case that $\langle 0,v\rangle = 0$: that expression is, in general, nonsensical. To avoid hidden surprises, consider creating an appropriatevector
type and definingAngleBracket
as a (sesquilinear) bivariate function ofvector
s. $\endgroup$