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
-1
votes
1 answer

How can I use the Approximate algorithm in this problem?

Imagine that a needle in the speedometer, which shows the speed, has fallen off. It was reattached, but not at the right angle. So, although the speedometer showed the value of the current speed v, its actual value was v+k, where k is an unknown…
redflag
  • 27
  • 5
-1
votes
1 answer

How can I improve this python code approximating pi?

My way of calculating pi is: import math a = 2 n = int(input('number:')) for i in range(n): a = 2 - math.sqrt(4-a) print((2**(i+2))*math.sqrt(a)) If this worked well, the printout would have become very close to pi. But when I tried this…
-1
votes
2 answers

How to compute approximate natural log of 2 n times in java?

The instructions were: 1. Compute the ln of 2, by adding up to n terms in the series. a) You can approximate the natural logarithm of 2 with a series. The more terms you use, the closer you get to the natural logarithm of 2. b) ln 2 = 1 - 1/2 + 1/3…
-1
votes
1 answer

fast double exp2 function in C

I need a version of the following fast exp2 function working in double precision, can you help me ? Please don't answer saying that it is an approximation so a double version is pointless and casting the result to (double) is enough..thanks. The…
elena
  • 233
  • 1
  • 7
-1
votes
1 answer

Approximating a smooth multidimensional function using Keras to an error of 1e-4

I am trying to approximate a function that smoothly maps five inputs to a single probability using Keras, but seem to have hit a limit. A similar problem was posed here (Keras Regression to approximate function (goal: loss < 1e-7)) for a…
-1
votes
2 answers

How to write a while loop in python

I am really having trouble getting started on this assignment and would really appreciate some help as a newbie! We need to write a program called PiApproximator that approximates the mathematical constant π by summing a finite number of terms in a…
user14321588
-1
votes
1 answer

Installation of sollya tool on windows

I've heard a lot of this free math tool sollya mentioned in many answers concerning approximations for floating point arithmetic. I know it is not specifically a programming question, and i aimed to fit the case tools used regularily by…
-1
votes
2 answers

Checking if two values are approximately the same in python

I have two functions which give me very small numbers. I want to define a IF statements in which If two values are approximately the same print them otherwise pass a = (x, y) b = (h, p) If a == b: print(a, b) else: pass for this we cannot use…
Ma Y
  • 696
  • 8
  • 19
-1
votes
3 answers

Infinite series approximation of pi in C not terminating

Here is my code, when using print statements it appeared to be an infinite loop: some potential issues i can troubleshoot are integer division, and perhaps figuring out if the algorithm terminates, and if it always has the correct output, perhaps…
Ben French
  • 13
  • 4
-1
votes
1 answer

Python: solve system of linear integer equations with approximate values of x

I want to solve a system of 8 linear integer equations, A y = b. It's clear that if I knew the exact value of the coefficients I should use one of the methods described here: Solve system of linear integer equations in Python but in my case I have…
-1
votes
3 answers

Approximation and modification of dictionary variables

I have a question I have a dictionary called (plane) where I can call variables such as 'name' or 'speed'. These values ​​give me this kind of output for example: print(plane.get('name')) print(plane.get('altitude')) Output: 'name'=…
-1
votes
1 answer

Multiple values of tuples

I have problem with approximation in python. I have a function, which gives me a dict with results. For example {1: 0.5, 2: 0.25}. It means that f(1)==0.5, f(2)==0.25, etc. Below is what I do after getting values from my function. lists =…
-1
votes
1 answer

Duplicate Programs

I want to write a code that can find similarity between code files (maybe find similarity by percentage or at least "guess" which files could of been copied), I run it for 30 files and maximum 500 lines in each file. I want to identify duplicate…
-1
votes
2 answers

Solving 'a = b ln [ max (11, b) ]' for b

Given: a = b ln [ max (11, b) ] If a is known, how can one compute b? (Do I need to use an iterative approximation method?)
bestrong
  • 151
  • 10
-1
votes
1 answer

Resto is 12.7 and method getTagli return 10.0 , 2.0 , 0.5 but my result had to be 10.0, 2.0, 0.5, 0.2

Is easy, have two collections set (list) and tagli; scroll list and when resto> item in list, pickup that item and subtract that item until resto is equal 0. public static ArrayList getTagli(Double resto) { Set list =…
1 2 3
34
35