# Using logarithms to normalize a vector to avoid overflow

Filed under:
|
|
##### overflow

http://stackoverflow.com/questions/2293762/problem-with-arithmetic-using-logarithms-to-avoid-numerical-underflow-take-2

Having seen the above and having seen softmax normalization I was trying to normalize a vector while avoiding overflow -

that is (x1 x2 x3 x4 ... xn) the normalized form for me has the sum of squares as 1.0

So what I thought of doing is s=(2*log(x1)+2*log(x2)+...+2*log(xn))/2 so the two factor can be taken off

and finally the normalized vector is

exp(log(x1)-s), , ..., exp(log(xn)-s)

but I am evidently doing something wrong here, what?

© Stack Overflow or respective owner

• #### good books on numerical computation with C

as seen on Stack Overflow - Search for 'Stack Overflow'
Hi, I've read the post "What is the best book on numerical methods?" and I wish to ask more or less the same question but in relation to C programming. Most of the time, C programming books on numerical methods are just another version of the author's previous Fortran book on the same subject. I've… >>> More

• #### Integration error in high velocity

as seen on Game Development - Search for 'Game Development'
I've implemented a simple simulation of two planets (simple 2D disks really) in which the only force is gravity and there is also collision detection/response (collisions are completely elastic). I can launch one planet into orbit of the other just fine. The collision detection code though does not… >>> More

• #### Typical Applications of Linear System Solver in Game Developemnt

as seen on Game Development - Search for 'Game Development'
I am going to write a custom solver for linear system. I would like to survey the typical problems involved the linear system solving in games. So that I can custom optimization on these problems based on the shape of the matrix. currently I am focus on these problems: B-Spline editing (I use… >>> More

• #### Algorithm to generate numerical concept hierarchy

as seen on Stack Overflow - Search for 'Stack Overflow'
I have a couple of numerical datasets that I need to create a concept hierarchy for. For now, I have been doing this manually by observing the data (and a corresponding linechart). Based on my intuition, I created some acceptable hierarchies. This seems like a task that can be automated. Does anyone… >>> More

• #### HTML numerical to UTF

as seen on Stack Overflow - Search for 'Stack Overflow'
How can i convert this \$langClarContent = &# 1059.,ч.,и.,&# 1090.,&# 1077.,&# 1083.,Dokeos &# 1077., &# 1089.,&# 1080.,&# 1089.,&# 1090.,&# 1077.,&# 1084., &# 1079.,&# 1072., &# 1091.,&# 1087.,&# 1088.,&# 1072.,&#… >>> More

• #### Jpeg Algorithm vs BMP Algorithm?

as seen on Super User - Search for 'Super User'
I'm just wonder, what the differences are between creating a BMP file algorithm and JPG file algorithm ? If you know the others images' format algorithm, please post them. Thanks. >>> More

• #### word disambiguation algorithm (Lesk algorithm)

as seen on Stack Overflow - Search for 'Stack Overflow'
Hii.. Can anybody help me to find an algorithm in Java code to find synonyms of a search word based on the context and I want to implement the algorithm with WordNet database. For example, "I am running a Java program". From the context, I want to find the synonyms for the word "running", but the… >>> More

• #### Search algorithm (with a sort algorithm already implemented)

as seen on Stack Overflow - Search for 'Stack Overflow'
Hello, Im doing a Java application and Im facing some doubts in which concerns performance. I have a PriorityQueue which guarantees me the element removed is the one with greater priority. That PriorityQueue has instances of class Event (which implements Comparable interface). Each Event is associated… >>> More

• #### Is there any algorithm for finding LINES by PIXEL COLORS on picture?

as seen on Stack Overflow - Search for 'Stack Overflow'
So I have Image like this I want to get something like this (I hevent drawn all lines I want but I hope you can get my idea) I need algorithm for finding all straight lines on it by just reading colors of pixels. No hard math, no Haar, no Hough. Some algorithm which would be based on points… >>> More

• #### collsion issues with quadtree [on hold]

as seen on Game Development - Search for 'Game Development'
So i implemented a Quad tree in Java for my 2D game and everything works fine except for when i run my collision detection algorithm, which checks if a object has hit another object and which side it hit.My problem is 80% of the time the collision algorithm works but sometimes the objects just go… >>> More