Questions tagged [approximation]

Approximation algorithms are algorithms used to find approximate solutions to optimization problems.

Approximation algorithms are algorithms which generate feasible solutions to optimizazion algorithms. Although permitted to generate solution which are not optimal, there is an algorithm-dependent bound for the ratio of the objective of an optimum and the objective of the generated solution; this ratio is termed the approximation ratio.


Useful links


Related tags

523 questions
0
votes
2 answers

Why the outcome of approximation algorithm more precise then the minimum step?

In this approximate research algorithm, I set epsilon to 0.01 and step to 0.0001. The run outcome is: ans = 0.9949999999999067. Since ans adds 0.0001 each step, the outcome should be precise to fourth digit after the point. How come it has so…
Annie
  • 1
  • 1
0
votes
1 answer

What is the difference between a probabilistic data structure and a sketch?

According to this StackOverflow question, probabilistic data structures are data structures that give approximate, as opposed to precise, answers. In particular, they have very low time and space complexities and are easily parallelizable, making…
Shuklaswag
  • 1,003
  • 1
  • 10
  • 27
0
votes
1 answer

Upper bound on MST for the points lying in a semicircle

Consider a semicircle C with radius r in the plane and a set P of n points lying on or inside C. Can we give an upper bound on the cost of an MST of P as a function of r (independent of n)?
0
votes
1 answer

Plotting the mean curve based on multiple curves/dataset in R

I want to estimate an "Average curve" from curves of multiple trials. I have done this before using approx() , but then I had a fixed set of x-axis values against which y was measured. In this dataset, values are mixed for both x and y (i.e., there…
Shishir
  • 11
  • 1
  • 2
0
votes
0 answers

Multi Dimensional approximation in Python

I need to approximate (by the gaussian function) 2 or 3 dimensional data sets using Python, but i found only interpolation methods. Anyone have heard about some library, that can do that ?
0
votes
1 answer

Functional form of density with approxfun

I got a problem while trying to approximate the functional form of a density in R with approxfun(). The minimal example is as follows. Example = seq(0.5, 1.5, 0.005) dens = density(Example) estim = approxfun(dens) plot(estim) plot(dens) The…
Taufi
  • 1,557
  • 8
  • 14
0
votes
1 answer

What value should I use to approximate gradient of a function in practice?

For some function f(x), I want to find f'(x) and f''(x) using the following approximation: [f(x+h) - f(x)] / h Which values of h should I choose in each scenario? I know for f'(x) it should be h = sqrt(epsilon) where epsilon is the machine epsilon.…
0
votes
1 answer

Euler method approximation is too accurate

I'm trying to code Euler's approximation method to solve the harmonic oscillator problem, and then compare it on a plot with the exact solution. However, I'm finding that my approximation seems to be too good (even for larger step sizes), especially…
curious_cosmo
  • 1,184
  • 1
  • 18
  • 36
0
votes
0 answers

Not able to understand why MIPS code will not approximate the square root of a value under specific iterations

I'm not entirely sure where to turn to so I thought I'd give here a go. I was wondering if any of you could help me out with this MIPS code I've designed, yet will not give me the results I'm aiming for. The purpose is to essentially utilize a given…
0
votes
0 answers

Approximation of cosh and sinh functions that give large values in MATLAB

My calculation involves cosh(x) and sinh(x) when x is around 700 - 1000 which reaches MATLAB's limit and the result is NaN. The problem in the code is elastic_restor_coeff rises when radius is small (below 5e-9 in the code). My goal is to do another…
Nabs
  • 362
  • 1
  • 3
  • 10
0
votes
2 answers

Square root approximation Clojure

I am getting an error and do not know how to fix it. I have to calculate square root with approximation and it should stop on the 20th element. Unable to resolve symbol: aprox in this context, compiling:(/home/jdoodle.clj:2:2) Code: (defn msqrt…
FatTommy
  • 177
  • 1
  • 1
  • 10
0
votes
1 answer

Approximation of double variables in C++

I'm trying to run this program, in which you insert two double values and you get in return which of the two numbers is bigger, a message "the numbers are equal" if the value of the two double are the same, and a message "the numbers are almost…
0
votes
1 answer

OpenCL, C - Leibniz Formula for Pi

I'm trying to get some experience with OpenCL, the environment is setup and I can create and execute kernels. I am currently trying to compute pi in parallel using the Leibniz formula but have been receiving some strange results. The kernel is as…
BodneyC
  • 110
  • 1
  • 11
0
votes
1 answer

Approximate logarithm uses inaccurate approximation for log_2(1+x)-x but it still works

In this article a rational approximation f(z) for g(z) = log_2(1 + x) - x is used for fastlog2 but when plotting f(z) and g(z) they look very different. Oddly enough the results of fastlog2 are very accurate. If I adjust f(z) to resemble g(z) more…
Shiro
  • 2,610
  • 2
  • 20
  • 36
0
votes
1 answer

count how many element are associated between index(zset) in Redis

I have many index in Redis who store key name associated with their timestamp (it's a zset) imagine I have 5 index : Apple -> 1 , 2 , 3 Red -> 1, 2 green -> 3 big -> 3 , 2 small -> 1 I want to know how many Red Apple are big (I can accept a little…