I was wondering if there were statistics functions built into math libraries that are part of the standard C++ libraries like cmath. If not, can you guys recommend a good stats library that would have a cumulative normal distribution function? Thanks in advance.
More specifically, I am looking to use/create a cumulative distribution fun...
I've written this very badly optimized C code that does a simple math calculation:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
unsigned long long int p(int);
float fullCheck(int);
int main(int argc, char **argv){
int i, g, maxNumber...
So I have a circle of planes which get constructed as:
plane.x = Math.cos(angle) * radius;
plane.z = Math.sin(angle) * radius;
plane.rotationY = (-360 / numItems) * i - 90;
which calculates how many angular slices there are for total number of planes (rotationY) and places each plane into it's place on a circle of radius.
then to upd...
For a balanced search tree, it is O(log(N)) for all cases. For unbalanced search trees, the worst case is O(N), e.g., insert 1, 2, 3, 4,.. and best case complexity is when it is balanced, e.g., insert 6, 4, 8, 3, 5 7. How do we define the average case complexity for unbalanced search tree?
...
Can anyone provide an example of a function that returns the cross product of TWO 2d vectors? I am trying to implement this algorithm.
C code would be great. Thanks.
EDIT: found another way todo it that works for 2D and is dead easy.
bool tri2d::inTriangle(vec2d pt) {
float AB = (pt.y-p1.y)*(p2.x-p1.x) - (pt.x-p1.x)*(p2.y-p1.y);...
I'm messing around with writing a class similar to mpz (C) or BigInteger (Java). This is just for fun, so please don't go on about how I shouldn't be writing my own.
I have a class similar to:
public class HugeInt
{
public List<Integer> digits;
public HugeInt(String value)
{
// convert string value into its sepera...
I've just started to work with MPFR arbitrary precision library and quite soon encounter very wierd behaviour. The main goal of using it was to improve precision of lagre argument trigs and this works extremly good in MPFR.
But then I decided to check out simple math and it was unbeleavable - even in straightforward examples with strict...
Does |{ x | x = sha1(x)}| > 0 hold?
I'm looking for a proof or a strong argument against it.
...
Hello fellows -
I'm currently in the process of developing a digg-like Ruby on Rails application for my degree's Final Project and I'm stuck in the 5 point ranking algorithm.
There are a couple of factors that need to be involved, here's a breakdown :
Users
They'll have a personal 5 points ranking per category with 5 being the best ...
What is Log-likelihood?
An example would be great.
...
I am trying to implement the SIR epidemic model. Basically, the way I understand the model is that at each time step, it tells us how many nodes get infected and how many nodes are recovered. I am now trying to convert this into an discrete-event simulation and am confused at a point.
The model is generally solved using Euler's method. ...
I m looking for a faster implementation or good a approximation of functions provided by cmath.
I need to speed up the following functions
pow(x,y)
exp(z*pow(x,y))
where z<0. x is from (-1.0,1.0) and y is from (0.0, 5.0)
...
Can anyone give me a quick tip?
For example....how would I find the sine of 90 degrees?
...
I have a 3D surface, (think about the xy plane). The plane can be slanted. (think about a slope road).
Given a list of 3D coordinates that define the surface( Point3D1, Point3D2, Point3D3, and so on), how to calculate the area of the surface?
Note that my question here is analogous to finding area in 2D plane. In 2D plane we have a l...
I've spent a decent amount of time trying to hunt down a simple way of doing this - ideally, a magical library exists out there somewhere that will take my set of 3D data points and return 2 points on the best fit line using either orthogonal regression or least squares and also return the error of the fitted line. Does such a thing exi...
This is a similar question to this one here.
Given a list of 3D coordinates that define the surface( Point3D1, Point3D2, Point3D3, and so on), how to calculate the centroid of the surface?
In 2D the computation is given by the following formula:
What about the 3D analogue?
...
Hi,
I have to calculate the following:
float2 y = CONSTANT;
for (int i = 0; i < totalN; i++)
h[i] = cos(y*i);
totalN is a large number, so I would like to make this in a more efficient way. Is there any way to improve this? I suspect there is, because, after all, we know what's the result of cos(n), for n=1..N, so maybe there's so...
I am trying to find a formula
http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
The one from the above link is too hard to implement.
Is there a nicer and simpler way to sort entities by a five star user rating control ?
Think at jokes. People say jokes and others rate them with 1 to 5 stars.
If
a) 5 users rate a joke ...
I've seen three ways of doing conversion from bytes to megabytes:
megabytes=bytes/1000000
megabytes=bytes/1024/1024
megabytes=bytes/1024/1000
Ok, I think #3 is totally wrong but I have seen it. I think #2 is right, but I am looking for some respected authority (like W3C, ISO, NIST, etc) to clarify which megabyte is a true megabyte. ...
I have a floating point value X which is animated. When in rest it's at zero, but at times an outside source may change it to somewhere between -1 and 1.
If that happens I want it to go smoothly back to 0. I currently do something like
addToXspeed(-x * FACTOR);
// below is out of my control
function addToXspeed(bla) {
xspeed += bla;...