• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Nicholas Kong

Pratical Usage of Vector Spaces in Programming or game programming

7 posts in this topic

I am trying to grasp the idea of vector spaces in my linear algebra textbook. The only thing I got out of it was that a vector space is set of elements or vectors (elements and vectors seems to be used interchangably which causes confusion) that must satisfies 10 rules that involves matrix addition and scalar multiplication in order to be called a vector space.

 

This concept is a whole lot more abstract compared to what was covered before: which was on system of linear equations and echileon forms.

 

Question: I still do not see the big picture or the whole point of learning vector spaces. I am trying to find the motivation to appreciate vector spaces. It has been 2 days and it is still an abstract concept to understand fully. Am I approaching vector spaces the wrong way?

Edited by warnexus
0

Share this post


Link to post
Share on other sites

The point of introducing vector spaces axiomatically (the 10 rules are called "axioms") is that you can recognize them in many situations, and then a lot of the knowledge you have will apply. The short version of the formal definition is that a vector space is a set of things that can be added, multiplied [EDIT: subtracted] and scaled (i.e., multiplied by number).
 
Besides R^n as a vector space over the reals, there are many other things that are vector spaces:
 * Matrices
 * Polynomials of degree 3
 * Polynomials
 * Sequences of real numbers
 * Functions from reals to reals
 * Continuous functions from reals to reals
 * Complex numbers (they are a 2-dimensional vector space over the reals)
 * Quaternions (they are a 4-dimensional vector space over the reals)
 * unsigned integers, considering XOR as the addition (you can think of them as a 32-dimensional vector space over the field of two elements)
 
There will be situations where you will find a vector space while solving a problem, and I give you an example below. But before I lose you in the details of a complicated problem, let me say that the most important benefit of learning about vector spaces, like most of math, is that it will train you to look at problems in new ways.
 
And now the example. Let's try to find a closed formula for the Fibonacci sequence. That is, we want to find a formula F[n] such that
 
F[0] = 0, F[1] =1, F[n+2] = F[n+1]+F[n]
 
Ignore for a second the first two conditions and concentrate on the last one. The set of sequences that satisfy that equation is a vector space, because the sum of two sequences that satisfy that equation satisfies that equation and scaling a sequence that satisfies the equation also satisfies the equation. As an exercise, you should check that all the axioms are satisfied.
 
Once you learn a bit more from you book, you'll be able to determine that this vector space has dimension two (because the sequence that starts A[0]=1, A[1]=0 and the sequence with B[0]=0, B[1]=1 are linearly independent and can generate any member of the vector space), so all you have to do is find two linearly-independent formulas that satisfy F[n+2] = F[n+1]+F[n] and you know that you can find the formula for Fibonacci as a linear combination of the two. These two formulas are geometric series of the form
 
F[n] = x^n
 
In order to find appropriate values for x, write F[n+2] = F[n+1]+F[n], which is x^(n+2) = x^(n+1)+x^n, and after dividing by x^n you get
 
x^2 = x+1
 
Solve this second degree equation, find the two values of x that make the formula work and then figure out the coefficients that you have to use to combine the two geometric sequences (Impose F[0]=0 and F[1]=1 and you'll get a system of 2 equations with 2 unknowns which is easy to solve).

Edited by Álvaro
2

Share this post


Link to post
Share on other sites

Matrices and quaternions aren't very good examples of vector spaces since there aren't any rules to multiply elements together in vector space, which is the thing you usually do with matrices and quaternions. They are good examples of (non-commutative) rings though.

 

 

The short version of the formal definition is that a vector space is a set of things that can be added, multiplied and scaled (i.e., multiplied by number).

 

Are you sure you are thinking of a vector space? Vector spaces don't define multiplication between elements, only addition of vectors and multiplication by a scalar. I think you are thinking of a ring.

 

EDIT: Inner product spaces, which are a further refinement of vector spaces, define the inner product which acts on 2 vectors but that results in a scalar not a vector (the dot product Rn . Rn -> R is an example of an inner product).

Edited by Paradigm Shifter
0

Share this post


Link to post
Share on other sites
Some typical patterns of "intelligent" linear algebra applications:


- Recognize that a set of things has to be linearly independent, or they behave badly. How do you verify they are independent? Which vector space do these things belong to? Only a number of things equal to the dimension of the space can be linearly independent, if you want more you need to upgrade to a different vector space.


- Similar to the above: recognize that the constraints on something form a system of linear equations, eliminate linearly dependent equations that don't actually add constraints, and figure out whether (and/or in which situations) the complete system is underdetermined, solvable or overdetermined. Which of the three cases are possible? Can you deal with them, or you need to rethink the whole system?


- When there are multiple vector spaces, one might be a subspace of the other, or each might be a different extension of a common subspace, or they can be unrelated. Which isomorphisms and projections make sense? Can you treat these spaces uniformly in your code?
0

Share this post


Link to post
Share on other sites

Matrices and quaternions aren't very good examples of vector spaces since there aren't any rules to multiply elements together in vector space, which is the thing you usually do with matrices and quaternions. They are good examples of (non-commutative) rings though.


Yes, they are non-commutative rings, but they are also vector spaces, and sometimes it's a good idea to think about them that way. By the way, they are also Lie groups. There are many ways to look at the same object. Sometimes you may want to think of the reals as a vector space over the rationals.

 

 

The short version of the formal definition is that a vector space is a set of things that can be added, multiplied and scaled (i.e., multiplied by number).

 
Are you sure you are thinking of a vector space? Vector spaces don't define multiplication between elements, only addition of vectors and multiplication by a scalar. I think you are thinking of a ring.

 


Oh, damn it. I meant to say "subtracted", not "multiplied". Sorry about that.

Edited by Álvaro
0

Share this post


Link to post
Share on other sites

linear algebra and analytic geometry are the two primary math disciplines in 3d graphics.

 

learn it, know it, live it, breathe it, dream it. 

 

i got an A in linear at OSU and still wish i knew the subject better.

 

and i've been doing 3d game graphics for a quarter of a century!

 

vector spaces and spanning sets and such are the more theoretical side.   later you'll get into applications  where being able to recognize these situations and applying the theory are the key to solving the problem.  IE because of <some condition> we know this is a <vector space | spanning set | linearly independent, | etc > situation and we can apply rule (axiom) <some rule> to solve the problem.

 

later in making games, it can help with more elegant solutions to uncommon tasks.

0

Share this post


Link to post
Share on other sites

beside the axioms a set must prove to be a vector space, there are a few short cuts to explain vectors space(s). A vector can exist in any amount of vector spaces, so to keep its identity, it is expressed in every vector space differently depending on the vector space's basis vectors. Little ToDo for you:

vector (2,1,4) in a vector space H defined by basis vectors (1,0,0)x(0,1,0)x(0,0,1) over R(eal numbers) is expressed as (1,0.5,2) in vector space G over R(eal numbers), Find the basis vectors of vector space G. Define the matrix that transforms from vector space G to vector space H.

 

if you solve this, you will have a little decent understanding of vector space(s).

0

Share this post


Link to post
Share on other sites

JohnnyCode's language is non-standard. I think what he means to say is that a vector can be expressed using coordinates, but the coordinates depend on the basis we are using.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0