# How to define a fixed length vector in Mathematica?

I would like to define a 3-D vector as say v={x,y,z}, but I want it to have a fixed norm, say a unit norm |v|=1. How do I impose this condition on v.

-
how about v=Normalize[{1,2,3}]? –  Pinguin Dirk Mar 14 '13 at 17:14
Suppose that I write v = Normalize[{x, y, z}]. Then FullSimplify[v.v] gives (x^2 + y^2 + z^2)/(Abs[x]^2 + Abs[y]^2 + Abs[z]^2), but I want to get simply 1 as the answer. I do not want to specify x,y,z as numbers as in this example. –  seckin Mar 14 '13 at 17:20
In order to simplify the way you want, you need to tell Simplify that you are using reals, like so: Simplify[v.v, Element[{x, y, z}, Reals]] –  Pinguin Dirk Mar 14 '13 at 17:33
@PinguinDirk Your comments could provide a perfect answer, others might find it useful too. –  István Zachar Mar 14 '13 at 17:45
@IstvánZachar: I figured that a short comment is perfect for this kind of a question :) I added an answer just now, see below. Thanks for your feedback –  Pinguin Dirk Mar 14 '13 at 18:15

To summarize my comments to the question:

In order to get a normalized version of your (real) vector, just use Normalize:

v=Normalize[{1,2,3}]


Note that you can also use other norms in Normalize, see the documentation for that. I shall assume you want the Euclidean one.

Assume we consider a general normalized vector

v= Normalize[{x, y, z}]


In order to get the desired result from Simplify of v.v, you need to tell Mathematica that {x,y,z} are real:

Simplify[v.v, Element[{x, y, z}, Reals]]


1

as Mathematica assumes by default that $x,y,z$, respectively are complex (and obviously, for e.g. a complex $x=i$, we have $Abs[x]^2=Abs[i]^2=1^2\neq-1=i^2=x^2$, so it cannot simplify in general). Telling Mathematic that we use reals, we have $x^2=Abs[x]^2$ and get the desired result.

-
thanks for the answer, this helps. Can I also set x,y,z real to start with and get the answer without using this option in Simplify. I suppose, I can. I will try it tommorow morning. –  seckin Mar 15 '13 at 1:28