approximation

what is the best way to get an approximate number of search results from a query?

to describe it some more, if i have an image map of a region that when clicked, a query is performed to get more information about that region.my client wants me to display an approximate number of search results while hovering over that region image map.my problem is how do i cache? or get that number without heavily exhausting my serve...

Approximating a shape boundary using Fourier descriptors

I am trying to approximate shape boundaries by using Fourier descriptors. I know this can be done because I've learned about it in class and read about it in several sources. To obtain the Fourier descriptors of a boundary of (x,y) coordinates, I do the following: 1) Turn (x,y) coordinates into complex numbers of the form x + iy 2) Feed...

What is the difference between a 'combinatorial algorithm' and a 'linear algorithm'?

Or rather, what is the definition of a combinatorial algorithm and a linear algorithm, resp.? To make it clear because obviously the first responders misunderstood the question: I am not looking for a definition of an algorithm running in linear time vs non-linear time. A linear algorithm is somehow related to linear programming, which ...

Interpolation advice (linear, cubic?)

I need to find good approximations of the points where an undefined function intersect a threshold value. I'm stepping through my space and whenever I find that two subsequent steps are on different sides of the threshold, I add a point somewhere in between: My first approach was to just pick the mid-point, but this is obviously a ter...

Convert light frequency to RGB?

Does anyone know of any formula for converting a light frequency to an RGB value? ...

Approximating function with Neural Network

I am trying to approximate the sine() function using a neural network I wrote myself. I have tested my neural network on a simple OCR problem already and it worked, but I am having trouble applying it to approximate sine(). My problem is that during training my error converges on exactly 50%, so I'm guessing it's completely random. I am...

Is there a way to get the number of places after the decimal point in a java double?

I'm working on a Java/Groovy program. I have a double variable that holds a number that was typed in by a user. What I really want to know is how many numbers the user typed to the right of the decimal place. Something like: double num = 3.14 num.getPlaces() == 2 Of course, you can't do this with a double since that's using IEEE flo...

approximation methods

I attached image: So in this image there is a diagram of the function, which is defined on the given points. For example on points x=1..N. Another diagram, which was drawn as a semitransparent curve, That is what I want to get from the original diagram, i.e. I want to approximate the original function so that it becomes smooth. Are...

Choosing random numbers efficiently

I have a method, which uses random samples to approximate a calculation. This method is called millions of times, so its very important that the process of choosing the random numbers is efficient. I'm not sure how fast javas Random().nextInt really are, but my program does not seem to benefit as much as I would like it too. When cho...

An approximate algorithm for finding Steiner Forest.

Hello. Consider a weighted graph G=(V,E,w). We are given a family of subsets of vertices V_i. A Steiner Forest is a forest that for each subset of vertices V_i connects all of the vertices in this subset with a tree. Example: only one subset V_1 = V. In this case a Steiner forest is a spanning tree of the whole graph. Example: a grap...

Approximate Estimation of Distance Matrices

I have a set of N objects, and I'd like to compute a NxN distance matrix. Sometimes my set of N objects is very large, and I'd like to compute an approximation to the NxN distance matrix by only computing a subset of the distance comparisons. Can anyone point me in the direction of something that calculates approximations to a full dis...

Looking for an estimation method (data analysis)

Hi! Since I have no idea about what I am doing right now, my wording may sound funny. But seriously, I need to learn. The problem I'm facing is to come up with a method (model) to estimate how a software program works: namely running time and maximal memory usage. What I already have are a large amount of data. This data set gives an o...

Temporary group membership tally - Any clever way to do it?

I'm building a website. It has groups that users can join. The difference between this and "normal" groups is that membership is temporary - when a user joins a group, he decides the length of membership: 5 days, a week, 2 weeks, etc (choices are pre-defined). Or potentially all memberships could be set to be of the same length - say a...

How to Create an approximation of a 2-d Arc with line segments?

I have a poly-line-contour consisting of line segments and arcs of circles which i want to extrude to prisms. As my extrusion functions only support straight-edge polygons, i need to approximate the arcs using line segments. The arcs are defined through a starting point, center point and sweep angle (CCW). The sweep-angles i need to d...

Difference among approximatelyEqual and essentiallyEqual in The art of computer programming

I get this code snippet from some where else. According to the webmaster, the code is picked from The art of computer programming by Knuth Since I do not have a copy of that book, may I know what is the difference among the two functions? bool approximatelyEqual(float a, float b, float epsilon) { return fabs(a - b) <= ( (fabs(a) < ...

Algorithm for online approximation of a slowly-changing, real valued function

Hi all, I'm tackling an interesting machine learning problem and would love to hear if anyone knows a good algorithm to deal with the following: The algorithm must learn to approximate a function of N inputs and M outputs N is quite large, e.g. 1,000-10,000 M is quite small, e.g. 5-10 All inputs and outputs are floating point values, ...