Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
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
1  
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

1 Answer 1

up vote 7 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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