![]() |
Vector Crash Course
Q: What is a vector?
A: A vector is a way of describing motion through space, regardless of the starting point of that motion. Q: How do you write a vector? In physics, there are two useful ways. The first is polar coordinates. Polar coordinates tells you the magnitude and the direction of the vector. So you could say some vector, say v, is this. v = r @ theta For example: v = 1.75 units @ 30 degrees (or pi/4 radians if you prefer) However, this is not exactly useful when it comes to the calculations involved. Not, at least, given that most if not all of us are more familiar with Cartesian coordinates. In Cartisian coordinates, the vector tells information about the change in x and the change in y, usually called dx and dy, respectively. v = <dx,dy> Based upon the Pythagorean theorem, we can write polar coordinates in terms of Cartesian coordinates and vice-versa. dx= r*cos(theta) dy= r*sin(theta) r^2=dx^2+dy^2 tan (theta)= dy/dx So, from the earlier example of polar coordinates: v = <1.299,.75> (roughly) Next Post: Addition and multiplication of vectors |
in other words,vector is a mathematical device for describing a quantity that has a magnitude and a direction.
|
Right, where a scalar quantity only has magnitude.
An example: Speed is a scalar quantity that only tells distance/time. Velocity is speed in a given direction. Sorry, should have mentioned that. |
It's interesting..
|
If you want my opinion, I'd say you went way over their heads. I don't think polar coordinates are a necessary topic, and overcomplicates matters.
osrs, anybody can copy & paste :-p |
Quote:
You aren't the only one smart guy here. |
Actually, my physics class talked about polar coordinates first, because it is more simple to understand visually.
For those of you who don't know. An angle in a graph is taken counterclockwise from the positive x axis. |
what about those of us who arent doing physics. XD i only understood you in begining...
|
Scalar multiplication of vectors:
When you multiply a vector by a scalar, the direction of the vector is unchanged; only the magnitude changes. Let A=<a,b> and c be some real number. Then c*A=<a*c,b*c>. Q: Why doesn't the direction change? A: Think of it this way, if you have been in algebra, you should know that the slope of a line is the rise(change in y) divided by the run (change in x). Well, that is just what b and a are, respectively. So the slope of that vector is the direction of that vector. When you multiply both a and b by c, nothing changes in the slope, because c "cancels out" in the division. Addition of vectors: Q: How do you add/subtract vectors? A: It is easy, once in Cartesian coordinates. Let A=<a,b> and B=<c,d>. Then A+B=<a+c,b+d>. If you wanted to subtract B instead of add it, you could just multiply it by -1, as above, then add just like you would normally. The Scalar Product (The Dot Product) Given two vectors, A and B, the scalar product of the two, in mathematical terms is written A·B=|A|*|B|*cos(theta), where theta is acute (or 180) angle between them. What does || mean, though? Well || returns the magnitude of the vector, making a scalar quantity. Since the dot product only involves the magnitudes of vectors, the dot prodect itself is a scalar quantity, hence the name scalar product. Using a previous example, speed is the magnitude of velocity. Q: How do you find the magnitude of a vector? A: Let v=<a,b>. Then, |v|=sqrt(a^2+b^2). For those with a good memory, you might recognize that to be just like the formula for finding r from Cartesian coordinates. That is because r is the magnitude of the vector. Q: What if you don't know the angle between them? A: That is one of the uses of the dot product. There is a shortcut way of figuring out the answer of the dot product itself. Let A=<a,b> and B=<c,d>. Then, A·B=a*c+b*d. And you already know how to find the magnitude of A and B. So just divide both sides by those magnitudes, and you are left with (A·B)/(|A|*|B|)=cos(theta). With the help of a calculator, you can find that angle. Next post: Vector product (cross product) |
Like I said, this is only a crash course. If you need more than what I have here, an excellent reference, if you want to sift through it, is http://mathworld.wolfram.com
|
I took a physics course, and it was pretty easy, but I don't think I'd have the know-how to apply it to a script, I can think of some basic scripts.. but my knowledge in scripting isn't near some of yours, I will try to learn more scripting before I get into this...
|
same here. im still working on fairly simple things, and using every chance i get to look at new scripts posted here to learn from them.
|
Quote:
|
Quote:
The most basic use of vectors in script is just movement, many people already use them without knowing it. Whenever you have a direction (i.e. angle, or even built in directions) and a speed (magnitude) you're using vectors. Using dx (delta x or distance x, whichever you say) and dy is also using vectors, cept they don't need translation (sin + cos) to be used on the board. I'll post some basics in physics if anyone is interested and if Gilt doesn't mind. |
Quote:
Shh.. |
Lol Your both~ like stuped Lol~ man iM like so coOl`~)@@#!!
I think that did the job nicely. |
Quote:
|
Quote:
Osrs, I would follow your own instructions and "Shh.." Whats the use in fighting a fight that you cant win? |
Quote:
|
Thanks for pointing out my typo, go ahead and do you physics stuff in a new thread.
|
:) I had to learn polar coordinates and rectangular coordinates.
I needed to use them like constantly in AC electronics. |
| All times are GMT +2. The time now is 06:03 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.