Okey, this is only half programming, but let's see how you are on terms with manual calculations. I believe many of you did this on your university's while giving "linear systems" ... the problem is it's been so long I can't remember how to do it any more.
I know quite a few algorithms for calculating determinants, and they all work fin...
Mathematica has a built-in function ArgMax for functions over infinite domains, based on the standard mathematical definition.
The analog for finite domains is a handy utility function.
Given a function and a list (call it the domain of the function), return the element(s) of the list that maximize the function.
Here's an example of fin...
There is a special way of mapping a cube to a sphere described here:
http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html
It is not your basic "normalize the point and you're done" approach and gives a much more evenly spaced mapping.
I've tried to do the inverse of the mapping going from sphere coords to cube coords and ...
I am new to C#. I have a datagridview with 9 columns. I am simply trying take the value in column 5 and subtract it from column 6. Then display the result in column 9. It seems simple enough.I know it's done in excel all the time. But I just cannot figure this out. Do I need to create a new class with a method called calculate columns? o...
Hello,
I need to subtract 0.5 from number a and set the answer to number b. My code looks like it would work but I'm not sure what I'm doing wrong. The error I get Is on the subtraction line, the error says incompatible type for argument 1 of 'decimalNumberBySubtracting:'.
Heres my header: (Note: I only showed the numbers because the h...
Take a commonly used binary hash function - for example, SHA-256. As the name implies, it outputs a 256 bit value.
Let A be the set of all possible 256 bit binary values. A is extremely large, but finite.
Let B be the set of all possible binary values. B is infinite.
Let C be the set of values obtained by running SHA-256 on every memb...
Hello:
I have a unit vector in 3D space whose direction I wish to perturb by some angle within the range 0 to theta, with the position of the vector remaining the same. What is a way I can accomplish this?
Thanks.
EDIT: After thinking about the way I posed the question, it seems to be a bit too general. I'll attempt to make it more sp...
help!! i have weird math calculation here. hope someone will explain.
$a = 1.85/100;
$b = 1.5/100;
$c = 1.1/100;
$d = 0.4/100;
$e = 0.4/100;
$f = 0.4/100;
$g = 0.4/100;
$h = $a + $b + $c + $d + $e + $f + $g;
echo $h*100 ."<br>";
$i = $h-$a;
$i = $i-$b;
$i = $i-$c;
$i = $i-$d;
$i = $i-$e;
$i = $i-$f;
$i = $i-$g;
echo $i;
last $i val...
hi,
I'm generating a random number between min and max with this code:
return min + (max - min) * Math.random();
And it works. However, the random numbers are very little usually between "1 or 3" even if the max is 80.
How can I better distribute the random numbers over all range ?
thanks
...
Hi, I develop a Python-based drawing program, Whyteboard. I have tools that the user can create new shapes on the canvas, such as text/images/rectangles/circles/polygons. I also have a Select tool that allows the users to modify these shapes - for example, moving a shape's position, resizing, or editing polygon's points' positions.
I'm ...
There is a very handy set of 2d geometry utilities here.
The angleBetweenLines has a problem, though. The result is always positive. I need to detect both positive and negative angles, so if one line is 15 degrees "above" or "below" the other line, the shape obviously looks different.
The configuration I have is that one line remains s...
I have a 1x8 matrix of students where each student is a 4x1 matrix of scores.
Something like:
SCORES
S [62, 91, 74, 14]
T [59, 7 , 59, 21]
U [44, 9 , 69, 6 ]
D [4 , 32, 28, 53]
E [78, 99, 53, 83]
N [48, 86, 89, 60]
T [56, 71, 15, 80]
S [47, 67, 79, 40]
Main question:
Using sigma notation, or some other mathematical function, h...
I don't really understand how modulus division works.
I was calculating 27 % 16 and wound up with 11 and I don't understand why.
I can't seem to find an explanation in layman's terms online.
Can someone elaborate on a very high level as to what's going on here?
EDIT: Thanks for all your answers. You guys are incredibly quick. It all ma...
Hi,
I am trying to implement my own version of pow() and sqrt() function as my custom library doesn't have pow()/sqrt() floating point support.
Can anyone help?
...
Hey all. I'm computing the angle between two vectors, and sometimes Math.Acos() returns NaN when it's input is out of bounds (-1 > input && input > 1) for a cosine. What does that mean, exactly? Would someone be able to explain what's happening? Any help is appreciated!
Here's my method:
public double AngleBetween(vector b)
{
...
function(deltaTime) {
x = x * FACTOR; // FACTOR = 0.9
}
This function is called in a game loop. First assume that it's running at a constant 30 FPS, so deltaTime is always 1/30.
Now the game is changed so deltaTime isn't always 1/30 but becomes variable. How can I incorporate deltaTime in the calculation of x to keep the "effect per...
I made this method
+ (CGFloat) round: (CGFloat)f {
int a = f;
CGFloat b = a;
return b;
}
It works as expected but it only rounds down. And if it's a negative number it still rounds down.
This was just a quick method I made, it isn't very important that it rounds correctly, I just made it to round the camera's x and y valu...
Suppose I have this program, I want to compare 2 input lists. Assume array A and array B. How do I determine the best case and worst case of the function?
Here is my code in [php]:
foreach($array_1 as $k){
if(!in_array($k, $array_2)){
array_push($array_2, $k);
}
}
What is the best case and worst case of the for loo...
How to prove this:
4n = O(8n)
8n = O(4n)?
So what are the C and n0 values for both cases?
...
Given two polygons:
POLYGON((1 0, 1 8, 6 4, 1 0))
POLYGON((4 1, 3 5, 4 9, 9 5, 4 1),(4 5, 5 7, 6 7, 4 4, 4 5))
How can I calculate the union (combined polygon)?
Dave's example uses SQL server to produce the union, but I need to accomplish the same in code. I'm looking for a mathematical formula or code example in any language that ...