I'm using Python and Numpy to calculate a best fit polynomial of arbitrary degree. I pass a list of x values, y values, and the degree of the polynomial I want to fit (linear, quadratic, etc.).
This much works, but I also want to calculate r (coefficient of correlation) and r-squared(coefficient of determination). I am comparing my re...
Given a function y = f(A,X):
unsigned long F(unsigned long A, unsigned long x) {
return ((unsigned long long)A*X)%4294967295;
}
How would I find the inverse function x = g(A,y) such that x = g(A, f(A,x)) for all values of 'x'?
If f() isn't invertible for all values of 'x', what's the closest to an inverse?
(F is an obsolete...
I have a large set of numbers, probably in the multiple gigabytes range. First issue is that I can't store all of these in memory. Second is that any attempt at addition of these will result in an overflow. I was thinking of using more of a rolling average, but it needs to be accurate. Any ideas?
These are all floating point numbers.
T...
I need to manage lists with find-command. Suppose the lists have random names in non-distinct lists (ie their intersection is not empty set). How can I do:
A \ B
find files in the list A except the files in the list B
A intersection B
find files common to the lists A and B
Please, consult here.
A union B
find all files ...
Hi, I'm not very good with more advanced maths, so I have to ask this:
If I have a camera which gives out 360 degree pan (x) and tilt (y) values, and I want to get the pan and tilt values of where I have my cursor in the camera's view, how would I convert that?
More info:
It's a Flash/AS3 project.
The pan and tilt values are from the c...
I need to know if a number compared to a set of numbers is outside of 1 stddev from the mean, etc..
...
I'm computing the ordinate y of a point on a line at a given abscissa x. The line is defined by its two end points coordinates (x0,y0)(x1,y1). End points coordinates are floats and the computation must be done in float precision for use in GPU.
The maths, and thus the naive implementation, are trivial.
Let t = (x - x0)/(x1 - x0), then...
Hello all,
I am trying to write a function in C++ that solves for X using the quadratic equation. This is what I have written initially, which seems to work as long as there are no complex numbers for an answer:
float solution1 = (float)(-1.0 * b) + (sqrt((b * b) - (4 * a * c)));
solution1 = solution1 / (2*a);
cout << "Solution 1: " <...
How can I find prime numbers through bit operations in C++?
...
Hello,
In my 3D application I store object's position in a vector and it's rotation around the origin in a quaternion. I need to rotate the object around a vector with an arbitrary origin. I tried converting the position - vectorOrigin and the rotation into a matrix, rotating the matrix and then extracting the position and rotation as a...
Sometimes I see and have used the following variation for a fast divide in C++ with floating point numbers.
// orig loop
double y = 44100.0;
for(int i=0; i<10000; ++i) {
double z = x / y;
}
// alternative
double y = 44100;
double y_div = 1.0 / y;
for(int i=0; i<10000; ++i) {
double z = x * y_div;
}
But someone hinted recently that t...
Would it be an polynomial time algorithm to a specific NP-complete problem, or just abstract reasonings that demonstrate solutions to NP-complete problems exist?
It seems that the a specific algoithm is much more helpful. With it, all we'll have to do to polynomially solve an NP problem is to convert it into the specific NP-complete p...
I was glancing through the contents of Concrete Maths online. I had at least heard most of the functions and tricks mentioned but there is a whole section on Special Numbers. These numbers include Stirling Numbers, Eulerian Numbers, Harmonic Numbers so on. Now I have never encountered any of these weird numbers. How do they aid in com...
My drive has DMG-blocks. The sum of their sizes is strictly below 47GB. I have 11 DVDs, each of the size 4.7GB. I want to use as small amount of DVDs as possible, without using compressing (the problem may be superflous, since it considers the most optimal combinations in terms of DMG-files. You can think it in terms of compressed files,...
We are looking to do display some mathematical data in a Flex GUI chart. We need to do plot for two array of data the following.
cross-correlation of both
auto-correaltion of each
and correlation coefficient
It looks like Flex does not support scientific formula like cross-correlation,auto-correlation and co-relation co-efficient nativ...
Hi,
Here's the binary tree in question, poor quality image I know but hopefully it's legible. The leaves are a,b,c,d and the edges are labelled 0 or 1.
EDIT: Transcripted tree
.
/ \
a .
/ \
b .
/ \
c d
It seems to me that it is a full binary tree, as every node is either a leaf or has two child ...
Ok so I have to prove the following sequent:
(p -> r) ^ (q -> r) |- p ^ q -> r
I understand why that is clearly correct and I also understand the rules of natural deduction. What I don't understand is how I go about proving it. Here is the model answer provided:
1. (p -> r) ^ (q -> r) |- p ^ q -> r premise
2. p ^ q ...
Hi all,
I have big square. And I would like to split this square into small squares. I need all possible combinations. I know that there are infinity count of combinations but I have one limitation. I have fixed size for smallest square.
I can implement it using brute force. But it is too long.
Is any preferable algorithm for this tas...
I have a simple object that allows you to assign three properties (x,y,z) (lets call this object a "point", because that is what it is). I then have a second object with a method that accepts two instances of the first object, and returns the distance between the two "points" in three dimensional space. i also need a method that will a...
I am doing a behind the curtains 3d simulation while rendering the world in my 2d isometric engine. I've never done an isometric engine before, and my matrix math is rusty in general so I am having problems.
I have a projection matrix, which in its simplest form is this:
0.7 0.35 0
0 -0.87 0
-0.71 0.35 1...