I'm trying to get my simulation to stop on a specific point. I have my starting position, an ending position, my current velocity and the time I'd like to take to get there. Since:
d = vt + (at^2)/2
I was figuring that
d = (end - start)
a = 2(d - vt) / t^2
but my end point is way off when I run it. I've tried using two simple updat...
Hi, I'm writing a solution for the Usaco problem "Electric Fences".
In the problem you have to find the optimal location for a point among a large amount of linesegments, so the sum of point-linesegment distances is smallest possible.
I had an idea, that it might be possible to do a hillclimb, and it worked for all testcases. The given ...
I am calculating g with e and s, which are all doubles. After that I want to cut off all digits after the second and save the result in x, for example:
g = 2.123 => x = 2.12
g = 5.34995 => x = 5.34
and so on. I Use...
g = 0.5*e + 0.5*s;
x = floor(g*100)/100;
...and it works fine most of the time. But sometimes I get strange results...
I don't know if I've chosen the appropriate title for this question (if not, please change it accordingly) but consider the following simplified table structure I'm working with:
----------------------------------------------
| date | i | j | k | x | y | z |
----------------------------------------------
| 100209 | 1 | ...
What I am hoping to achieve is the ability to generate 'teams' of users. I will have x amount of men, weighted (decimal skill weight, like 75.23) and y amount of women (also with a skill weight value).
Given that list of users, I would then take for input the number of teams to make (let us say, 6 teams). Then, I go through the list o...
Hi,
I tried to solve problem# 276 from Project Euler, but without success so far.
Consider the triangles with integer
sides a, b and c with a ≤ b ≤ c. An
integer sided triangle (a,b,c) is
called primitive if gcd(a,b,c)=1. How
many primitive integer sided triangles
exist with a perimeter not exceeding
10 000 000?
The bo...
What is the most efficient way to use a pair of six sided dice to generate a random number in [1, 4] unevenly: it should produce 1 in 40% of the time, 2 in 30%, 3 in 20%, and 4 in 10%.
Please justify the correctness of the method and give an algorithm.
Dice could be of different colors.
Note: the only random number generators availa...
I have a triangulated isometric grid, like this:
In my code, triangles are grouped by columns.
As I hover the mouse, I want to calculate what triangle the mouse coordinates are in. Is there a simple algorithm to do that?
...
hi,
I am writing a code in C++ and want to compute distance between two points.
Question 1:
I have two points P(x1, y1, z1) and Q(x2, y2, z2) , where x, y and z are floats/doubles.
I want to find the distance between these two points. One way to do it is :
square_root(x_diff*x_diff + y_diff*y_diff + z_diff*z_diff)
But this is ...
I've written a program that attempts to find Amicable Pairs. This requires finding the sums of the proper divisors of numbers.
Here is my current sumOfDivisors() method:
int sumOfDivisors(int n)
{
int sum = 1;
int bound = (int) sqrt(n);
for(int i = 2; i <= 1 + bound; i++)
{
if (n % i == 0)
sum = s...
In trying to solve a particular Project Euler question, I ran into difficulties with a particular mathematical formula. According to this web page (http://www.mathpages.com/home/kmath093.htm), the formula for determining the probability for rolling a sum, T, on a number of dice, n, each with number of sides, s, each numbered 1 to s, can...
$value = '100.00';
echo $value * 100/100;
Or should I be rounding incase there's a value such as '100.70'? I'm displaying this for a table that displays daily rates, the total value contains the digits so I assume the user won't have to really worry about decimal values...
...
I already have prime factorization (for integers), but now I want to implement it for gaussian integers but how should I do it? thanks!
...
I'm looking for a very simple algorithm for computing the polygon intersection/clipping.
That is, given polygons P, Q, I wish to find polygon T which is contained in P and in Q, and I wish T to be maximal among all possible polygons.
I don't mind the run time (I have a few very small polygons), I can also afford getting an approximation...
I want to be able to make image move realistically with the accelerometer controlling it, like any labyrinth game. Below shows what I have so far but it seems very jittery and isnt realistic at all. The ball images seems to never be able to stop and does lots of jittery movements around everywhere.
- (void)accelerometer:(UIAccelerometer...
how to convert Quaternion orientation output of wintracker II device to Euler Angles output only. Because Wintracker II device Output Euler angles and Quaternion orientation. i want to Euler angles output only.
...
Is there already a python package allowing to graphically edit the graph of a function?
...
If I have a string '1+1' is there a way, other than eval(string) to get the numerical value of it i.e. I want to turn '1+1' into 2.
...
Hi All,
I used tf/idf to calculate consine similarity between two documents. It has some limitation and does not perform very well.
I looked for LDA (latent dirichlet allocation) to calculate document similarity. I don't know
much about this. I couldn't find much stuff too about my problem.
Can you please provide me any tutorial relate...
I have a file with a sequence of event timestamps corresponding to the times at which someone visits a website:
02.02.2010 09:00:00
02.02.2010 09:00:00
02.02.2010 09:00:00
02.02.2010 09:00:01
02.02.2010 09:00:03
02.02.2010 09:00:05
02.02.2010 09:00:06
02.02.2010 09:00:06
02.02.2010 09:00:09
02.02.2010 09:00:11
02.02.2010 09:00:11
02.02....