of the vector

Solved

Posted on 2011-04-22

I found an interesting article (to me at least) that I want to play around

with, but am not fluent in Greek (Pure mathematical functions) .

http://www.bouncingchairs.net/pskalman-lategecco.pdf

the algorithm itself starts around page 4 (5 is graphs), 6 has its 'pseudo code',

which is all Math.

I don't understand what

norm

Normal

||v_t|| or ||vt_best|| (the double pipes, or how to evaluate them)

in this context mean.

Any nudge in the right direction is super appreciated.

THanks,

with, but am not fluent in Greek (Pure mathematical functions) .

http://www.bouncingchairs.

the algorithm itself starts around page 4 (5 is graphs), 6 has its 'pseudo code',

which is all Math.

I don't understand what

norm

Normal

||v_t|| or ||vt_best|| (the double pipes, or how to evaluate them)

in this context mean.

Any nudge in the right direction is super appreciated.

THanks,

25 Comments

as they speak about vector U and talke about its normaliztion

like u/||u||

Normalization of the vector means making the vector in the same direction

but with unit length and to get it you need to divide each

coorduinate by the length of the vector

|| x || means the norm of the element x of a normed vector space

So, equation 7 would go like this?

```
for (i = 0; i < n; i++)
{
v[i] += v[i]/SQRT(SUM(v[i]^2..v[n]^2))
+ (1-0.45)
* vb[i]/SQRT(SUM(vb[i]^2..vb[n]^2))
}
```

To do this scaling, you have to divide the vector by the vector length.

If the vector is in a 3D vector space, for example, then it has three coordinates.

Then ||

of the vector, especially when you think in 3D space

u/||u|| will indeed be called normalized vector - this is the vector

which has the same direction as original vector u, but is of a unit length

So you obrtain such vector by dividing all components

of original vector by the length of the vector

what do you do with equation 9?

```
v(hat)[i] ~ Normal(0.6, v[i])
```

float [] vt = new float[3];

float [] vbest = new float[3];

float [] v = new float[3];

float [] vtplus1 = new float[3];

float alpha;

flaot lengthvt = Math.sqrt(vt[1]*vt[1] + vt[2]*vt[2] + vt[3]*vt[3]);

flaot lengthvbest = Math.sqrt(vbest[1]*vbest[1

float lengthv = Math.sqrt(v[1]*v[1] + v[2]*v[2] + v[3]*v[3]);

for (int j=0; j<3; j++) {

vtplus1[j] =( (alpha*lengthvt + (1.0f-alpha)lengthvbest)/l

}

vtplus1[j] = (alpha*

}

Equation (9) (correction):

```
float [] vt = new float[3];
float [] vbest = new float[3];
float [] v = new float[3];
float [] vtplus1 = new float[3];
float alpha;
flaot lengthvt = Math.sqrt(vt[1]*vt[1] + vt[2]*vt[2] + vt[3]*vt[3]);
flaot lengthvbest = Math.sqrt(vbest[1]*vbest[1] + vbest[2]*vbest[2] + vbest[3]*vbest[3]);
float lengthv = Math.sqrt(v[1]*v[1] + v[2]*v[2] + v[3]*v[3]);
for (int j=0; j<3; j++) {
vtplus1[j] =( (alpha*lengthvt + (1.0f-alpha)lengthvbest)/lenghtv)*v[j];
}
```

assuming that 1-alpha = 0.45

that you should generate random v by generating random numcbers

for each coordinates, but this random numbers

should be distributed normally around value v' as math expectation (for each coorduiinate)

with dispersion of sigma - i guess sigma was also acalculated before?

For this you probably need to write a special program - you can

start with java random class which generates values uniformaly between

0 and 1 but then calculate value according the norma distribution

- I think we should browse around there should be such normally distributed

random generator in java somehwere, so you see you need to get vlaues close to v'

much more often than far away from v' (as opposed to uniform random which we have in

our standard java lbrary)

the have it! Look at that;

http://download.oracle.com

so v[j] = random number normally distributed around v[j] with a stdev of 0.6?

or something else entirely?

yes, that's what it is I guess

I'm not yet sure how to get form their distribution with average 0 and dispersion 1

to your requiirement but I'm sure t is doable and should not be too hard

average is just to move - dispersion is probably just to delete by square root or somthing

I'm sure I'll be back for more when I get stumped,

but in the meantime; thanks!

(2*rand-1 + 2*rand-1 + 2*rand-1)*stdev + avg

appears to generate a random number normally distributed

around an average. Might be quicker too

its just straight multiply

http://www.wilmott.com/mes

I tested it in excel, and the AVERAGE function gave me the

average I put in; and the STDEV function roughly gave me the

stdev I put in

I checked this against the results from using = norminv(rand(),avg, stdev),

and they appear indistinguishable.

so I'd use (-1 + 2 * rand) + (-1 + 2 * rand) + (-1 + 2 * rand)

Well, if you have the same average and the same std dev,

it does not necessarily mean that the distribution

would be Gaussian

On the other hand we don't know if it is essential that it would be Gaussian

or just average and dispersion is important

this java standard methhod

nextGaussian() - it will return you the numbers distributed normally

with avergae 0.0 and stnd deviation 1.0

So if you multiply this number by standard deviation you need

and add the avergae you want then the new number will be distributed exavtly as you need so your method

for generating such values wuold be:

Random r = new Random(new java.util.Date().getTime()

double myGaussian(double avg, double std_dev, Random r){

double x = r.nextGaussian();

return (x*std_dev + avg);

}

So if you call

myGaussian(5, 25, r);

million times than your resulst will be ditributed over Gaussian centered at 5 with standard deviation 25

before shifting platforms.

Here's what I have so far to describe a particle (hawk)

```
class Hawk
attr_accessor :pos,
:vel,
:vprime,
:vhat,
:denom
#---------------------------------------------------------
def update!(best_p)
_denom!
_vprime!(best_p)
_vhat!
@vel.each_index do |x|
@vel[x] = (@alpha * @denom + (1 - @alpha) * best_p.denom) * @vhat[x]
end
end
#_________________________________________________________
##########################################################
private
##########################################################
#---------------------------------------------------------
def _denom!
b = 0
@vel.each{|x| b += x**2}
@denom = b**(1/2)
end
#_________________________________________________________
#---------------------------------------------------------
def _vprime!(bp)
@vel.each_index do |x|
@vprime[x] = @alpha *
(@vel[x] / @denom) +
(1 - @alpha) *
(bp.vel[x] / bp.denom)
end
end
#_________________________________________________________
#---------------------------------------------------------
def _vhat!
@vprime.each_index do |x|
@vhat[x] = @vprime[x].normal(@sigma)
end
end
#_________________________________________________________
end
```

Title | # Comments | Views | Activity |
---|---|---|---|

Windows phone Development | 11 | 15 | |

basic hardware to learn oop advanced design patterns | 3 | 50 | |

Debug Windows Service program in C# | 4 | 24 | |

deducing meaning of a word from its prefix-question | 7 | 17 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**24** Experts available now in Live!