Questions tagged [approximation]
For challenges relating to approximating a value, typically a constant or something related to the program's input
23 questions
19
votes
17
answers
2k
views
Approximate my atomic weight
Each element on the periodic table of the elements has an atomic weight. For example, boron (element 5) has an atomic weight of 10.81. Your challenge is to write a program which takes as input the ...
28
votes
55
answers
4k
views
Approximation of e
We all know that the Euler's number, denoted by \$e\$, to the power of some variable \$x\$, can be approximated by using the Maclaurin Series expansion:
$$e^x=\sum_{k=0}^{\infty}{\frac{x^k}{k!}}=1+x+\...
22
votes
11
answers
3k
views
How powerful must this e approximation be?
This challenge was inspired by this non-challenge about the natural logarithm base \$e\$ and the following pandigital approximation to \$e\$ appearing on a Math Magic page:
$$\left|(1+9^{-4^{7×6}})^{3^...
49
votes
22
answers
6k
views
"As we travel the universe..."
You'll be given the name of one of the 20 biggest objects in the Solar System. Your task is to return an approximation of its radius, expressed in kilometers.
This is a code-challenge where your ...
19
votes
67
answers
11k
views
Pi Calculation Code Golf [closed]
The Challenge
You must calculate pi in the shortest length you can. Any language is welcome to join and you can use any formula to calculate pi. It must be able to calculate pi to at least 5 decimal ...
26
votes
25
answers
3k
views
Approximate the Dottie number to arbitrary precision
The Dottie number is the fixed point of the cosine function, or the solution to the equation cos(x)=x.1
Your task will be to make code that approximates this constant. Your code should represent a ...
38
votes
23
answers
4k
views
Natural Pi #0 - Rock
Goal
Create a program/function that takes an input N, check if N random pairs of integers are relatively prime, and returns <...
28
votes
35
answers
4k
views
Monte Carlo estimator of Pi
Happy Pi Day everyone! For no reason at all, I'm trying to construct a Monte Carlo estimator of Pi that is as short as possible. Can we construct one that can fit in a tweet?
To clarify, what I have ...
14
votes
13
answers
2k
views
Diophantine Approximation: find lowest possible denominator to approximate within given precision
Challenge
Given a number x and a precision e, find the lowest positive integer q such that <...
27
votes
19
answers
2k
views
Approximate Brun's Constant
Brun's constant is the value to which the sum of the reciprocals of twin prime pairs (1/p and 1/(p+2) where ...
26
votes
17
answers
2k
views
Khinchin's constant to as many decimal places as possible in 64 bytes or less
Khinchin's constant is a curious mathematical constant that, according to Wolfram MathWold, is "notoriously difficult to calculate to high precision".
Here it is to 100 digits:
2....
29
votes
9
answers
3k
views
Approximate when you are going to die
A mortality table or life table is an actuarial tool that gives the probability that a person aged \$A\$ years will die in the next year, and is used to help calculate the premiums for life insurance, ...
4
votes
22
answers
2k
views
Rounding Numbers
Task
Given a number between 0 and 1 and another integer, print the approximated value of the first number rounded off to the specified number of digits given by the second integer. For example, if ...
21
votes
18
answers
5k
views
Let the trigonometry begin!
Introduction:
The sine of \$x\$ is given by the formula:
$$\sin(x) = x - \frac {x^3}{3!} + \frac {x^5}{5!} - \frac {x^7}{7!} + \frac {x^9}{9!} - \frac {x^{11}}{11!} + \cdots$$
The cosine of \$x\$ is ...
10
votes
19
answers
1k
views
Approximate My Squares
Inspired by this video by tecmath.
An approximation of the square root of any number x can be found by taking the integer square root ...