Normalizing then scaling a vector to a new magnitude

  • Context: Undergrad 
  • Thread starter Thread starter wraithseeker
  • Start date Start date
  • Tags Tags
    Magnitude Vector
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 7K views
wraithseeker
Messages
28
Reaction score
0
When you set it, initially I have to do

length = Sqrt(x*x+y*y*z*z)
length = newlength/length
set all the velocities to multiply by length

I am wondering what is this for?

length = newlength/length
 
Physics news on Phys.org
newlength/oldlength is the fraction by which the length has to increase. The length of the new vector will be
|| oldvector * newlength / oldlength || = || oldvector || * newlength / oldlength = oldlength * newlength / oldlenght.

Alternatively, you can look at it this way: if you have a vector v, first divide it by its length to make a unit vector u (in the same direction but with length 1). Then multiply u by the length you want it to have to get the new vector:
v' = u * newlength = (v / oldlength) * newlength = v * (newlength / oldlength)
where oldlength is the length of v (sqrt(x^2 + y^2 + z^2)).
 
Well, you're talking about a vector, so I assume direction is important. It would be easier to change leingths of individual cartesian components by the desired amount. In cylindrical and sphercal, you merely change r.