math

Fast 4x4 matrix multiplication in Java with NIO float buffers

I know there are LOT of questions like that but I can't find one specific to my situation. I have 4x4 matrices implemented as NIO float buffers (These matrices are used for OpenGL). Now I want to implement a multiply method which multiplies Matrix A with Matrix B and stores the result in Matrix C. So the code may look like this: class M...

Pool Billiard AI

Im implementing a pool billiard game in Java and it all works fine. It is a multiplayer game, but nevertheless, it should also be possible to play it alone. For this purpose I'm trying to implement a simple KI. At the moment, the KI choose just randomly a direction and a random intensity of the impulse (don't know the correct english wor...

skipping certain number of frames on a timeline

hi, i have a mathematical problem which is a bit hard to describe, but i'll give it a try anyway. in a timeline, i have a number of frames, of which i want to skip a certain number of frames, which should be evenly distributed along the timeline. for example i have 10 frames and i want to skip 5, then the solution is easy: we skip ever...

advance mathematics c++ libraries

what popular advance mathematics libraries for c++ are present out there, so that they can be used as a 1 stop solution and avoiding reinventing the wheel ? ...

Need some help understanding this problem about maximizing graph connectivity

I was wondering if someone could help me understand this problem. I prepared a small diagram because it is much easier to explain it visually. Problem I am trying to solve: 1. Constructing the dependency graph Given the connectivity of the graph and a metric that determines how well a node depends on the other, order the dependencies...

Help understanding unipolar transfer function

There is a question I am stuck on using the following formula for the unipolar transfer function: f(net)= 1 __________ -net 1 + e The example has the following: out = 1 ____________ = 0.977 -3.75 1 + e How do we arrive at 0.977? What is e? ...

Linear Algebra Library For Android

Does anyone know what will be a good library for computing linear algebra in Android (SVD, QR, LU, least-squares, inverse, etc) ? ...

[LaTeX] Math symbols in listings

Hi, I have a problem with Latex -- I don't know how to put mathematical equations and symbols in listings. I use --listings-- package and it's offers great looking listings, but it doesn't allow math symbols in $ .. $. Another package --algorithms-- allows math, but listings doesn't look as good as in --listings-- (the problem is that -...

How can I sort a Flash Actionscript 3 Tilelist based on columns and not rows?

Hi all - I have a Flash Tilelist component (not flex) and have set it up so that 4 rows of 3 tiles each are visible before scrolling. I should note that I'm using a horizontal layout because I need a horizontal scrollbar. I realize using a vertical layout would sort the way I want but gives a vertical scrollbar. The problem I'm encount...

Mathematics - Why is Differential Calculus (MVP) in PHP a tabu?

Hi I want to do a Mean-Variance-Optimization (Markowitz) but i never found anything written in php that does this. MVP needs differential calculus. Can it be done in php and why arent there any classes/works from universities? For a webapplication (regarding performance) would another language be the better choice to handle heavy calc...

PHP given a series of arbitrary numbers, how can I choose a logical max value on a line graph?

I am constructing a line graph in PHP. I was setting the max value of the line graph to the max value of my collection of items, but this ended up making the graph less readable you are unable to view the highest line on the graph as it intersects with the top of it. So what I need is basically a formula to take a set of numbers and calc...

How do you create a formula that has diminishing returns?

I guess this is a math question and not a programming question, but what is a good way to create a formula that has diminishing returns? Here are some example points on how I want the curve to look like. f(1) = 1 f(1.5)= .98 f(2) = .95 f(2.5) = .9 f(3) = .8 f(4) = .7 f(5) = .6 f(10) = .5 f(20) = .25 Notice that as the input gets hig...

How can I transform latitude and longitude to x,y in Java?

Hello, I am working on a geographic project in Java. The input are coordinates : 24.4444 N etc Output: a PLAIN map (not round) showing the point of the coordinates. I don't know the algorithm to transform from coordinates to x,y on a JComponent, can somebody help me? The map looks like this: http://upload.wikimedia.org/wikipedia/c...

Diagonal of polygon is inside or outside?

I have three consecutive points of polygon, say p1,p2,p3. Now I wanted to know whether the orthogonal between p1 and p3 is inside the polygon or outside the polygon. I am doing it by taking three vectors v1,v2 and v3. And the point before the point p1 in polygon say p0. v1 = (p0 - p1) v2 = (p2 - p1) v3 = (p3 - p1) With reference t...

Merge overlapping triangles into a polygon

I've got a bunch of overlapping triangles from a 3D model projected into a 2D plane. I need to merge each island of touching triangles into a closed, non-convex polygon. The resultant polygons shouldn't have any holes in them (since the source data doesn't). Many of the source triangles share (floating point identical) edges with other...

Multithreaded Multiplication of Large Non-sparse, Non-square Matrices in C/C++

All, I'm looking for recommendations for C or C++ libraries (preferably open source) that use multi-threaded techniques to multiply large, non-square, (e.g. 65536xn in size where n < 65536) non-sparse matrices. Thanks. -&& ...

iPhone SDK math - pythagorean theorem problem!

Just as a practice, I am working on an app that solves the famous middle school pythagorean theorem, a squared + b squared = c squared. Unfortunately, the out-coming answer has, in my eyes, nothing to do with the actual answer. Here is the code used during the "solve" action. - (IBAction)solve { int legoneint; int legtwoint; int hy...

how do i add variables with logistic distributions?

i have X, Y, random logistic variables, how do I add them given the mean and scale for each? Logistic distribution. i ran a simulation in python, but i cannot get it to be exact. i ran a simulation on getting a random number X, Y, and keep score on the value of X + Y. then i did the same for getting a single random number with X + Y ...

JavaScript Image zoom with CSS3 Transforms, How to calculate Origin? (with example)

I'm trying to implement an image zoom effect, a bit like how the zoom works with Google Maps, but with a grid of fix position images. I've uploaded an example of what I have so far here: http://www.dominicpettifer.co.uk/Files/MosaicZoom.html (uses CSS3 transforms so only works with Firefox, Opera, Chrome or Safari) Use your mouse whe...

Java Newbie can't do simple Math, operator error

Trying to do some really basic math here, but my lack of understanding of Java is causing some problems for me. double[][] handProbability = new double[][] {{0,0,0},{0,0,0},{0,0,0}}; double[] handProbabilityTotal = new double[] {0,0,0}; double positivePot = 0; double negativePot = 0; int localAhead = 0; int localTied = 1; int localBehi...