
sherifffruitfly wrote: question was a homework problem
Typically this type of problem is a homework problem for an algorithms class. Sounds like it isn't in your case.
"The clue train passed his station without stopping."  John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks"  Pete O'Hanlon





Yupyup  It's all good  I should have realized how my question would appear to the reader.





To qualify as a homework problem, it need to have plz, urgent, hlp me, or any variation of a time constrained desperation.
I did find the Hamiltonian Cycle algorithm my Algorithms professor did a few years ago, a real fun one to read back through, but it works
"The clue train passed his station without stopping."  John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks"  Pete O'Hanlon





hahaha  yeah, gamerspeak is definitely typical. Lots of exclamation marks too!!!elevens!!!





Hi,
I'm just looking to rework part of an application I'm working on that catgorises files by comparing the file path and file name to a lookup table table with multiple string values. Are there any established patterns or algorithms that apply to this scenario?
Something along the lines of how Levenshtien Distance works for comparing two strings, the difference here being that I'm looking at whole words compared to an array of possible matches.
Cheers,





Why can't you use the Levenshtein distance with words, i.e. increment the cost for a different word instead of a letter? You could even use fractional costs according to how much the words differ.





Good Day,
Is there a mathematical formula/theory that can tell how much different (in numbers or percentage) two objects are?
Say, I have 2 files, File A and File B, and the formula can tell how much are they different?
Regards,
Ian
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.





You need some kind of metric by which to measure the difference. For example, length. Text files could differ by the number of different words if you are comparing an original file with a modified one.
So you need to specify what, exactly, you imply by "differ".





Well, I will be comparing binary data. A string of 1's and 0's.
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.






Thank you. But I would be comparing binary data. But this is somewhat along the line of what I need.
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.





You still have to define "different".
Say file REF holds 99 bytes of data.
File APPEND holds the same 99 bytes of data followed by one more byte.
File PREFIX holds that same one byte followed by the original 99 bytes.
Now these three files are different. How different are they? That is up to you.
One would say APPEND is very similar to REF.
One could argue PREFIX is completely different, or very similar. Take your pick.
And some parsers would object to "very similar"; if REF represents a valid image (say something
Image.FromFile understands), then APPEND is not likely to be a valid image (as per Image.FromFile).





I see.
I thought there was a general formula to test for "difference".
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.





It depends on what your goal is.





how about the binary correlation. sum of results where bits equal gives 1 and not equal gives 1 total divided by # bits in file should be useful.





As I said, it depends what your goal is. If this metric is useful for you, go for it.





I want to implement FDIST function in c#. Can any one tell me what is the formula to calculate FDIST. its arguments are :
FDIST(x,degrees_freedom1,degrees_freedom2)
X is the value at which to evaluate the function.
Degrees_freedom1 is the numerator degrees of freedom.
Degrees_freedom2 is the denominator degrees of freedom.
thanks in advance





Where have you searched so far? Did you look in the excel documentation where it tells you that it implements the FDistribution? Have you googled FDistribution?
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."






hi
I have solved FDIST in C#. now I have to find FINV
Which Returns the inverse of the F probability distribution. If p = FDIST(x,...), then FINV(p,...) = x.
Any idea about this. how to find inverse of the F probability distribution
Syntax
FINV(probability,degrees_freedom1,degrees_freedom2)
Probability is a probability associated with the F cumulative distribution.
Degrees_freedom1 is the numerator degrees of freedom.
Degrees_freedom2 is the denominator degrees of freedom.
thanks in advance





Hi sumit7034,
I have trying to develop FDIST and FINV function in C# just like what you did. However I don't have any idea how to start with it until I found your post in code project after several days of searching in google. Could you share with me or guide me on this based on your experience?
Do you manage to develop the FINV function?
I read your post mentioning that you manage to resolved the FDIST where the value is as close as what we get from Excel FDIST. Could you share on that?
Thanks. Hope to hear from you soon.





You might want to look at: http://mathworld.wolfram.com/[^] since you ask for math formulas a lot.
What have you coded so far with the FDIST function? Show what you've done so people don't get the impression you are just throwing a question out there and waiting for someone to do it for you.
"The clue train passed his station without stopping."  John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks"  Pete O'Hanlon





using formula in this link:
http://mathworld.wolfram.com/FDistribution.html[^]
i have written a program in c#
public static double FDIST(double x, double m, double n)
{
double result = gamma((n + m) / 2.0) * Math.Pow(n, n / 2) * Math.Pow(m, m / 2) * Math.Pow(x, n / 21);
result = result / (gamma(n / 2) * gamma(m / 2)* Math.Pow(m+n*x,(n+m)/2));
return result;
}
private static double gamma(double data) {
if (data == 0.0) return 0;
double p0 = 1.000000000190015;
double []p ={76.18009172947146,
86.50532032941677,
24.01409824083091,
1.231739572450155,
1.208650973866179e3,
5.395239384953e6
};
double y=data ; double x = data;
double tmp = x + 5.5;
tmp = (x + 0.5) * Math.Log(tmp);
double summer = p0;
for (int j=0;j<6;++j) {
summer += (p[j] / ++y);
}
return Math.Exp(0  tmp +Math.Log(2.5066282746310005 * summer / x));
}
But still i m not getting accurate answer as in ms excel.
please help





sumit7034 wrote: not getting accurate answer as in ms excel
How high of a precision do you need? For most folks, 7 or 8 decimal digits ought to be more than sufficient.
Tried your code, and based on some test values at http://www.bettersolutions.com/excel/EDH113/QI547610521.htm[^], your code is not outputting those results.
"The clue train passed his station without stopping."  John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks"  Pete O'Hanlon





For your project, are you allowed to use Office Interop Libraries?
"The clue train passed his station without stopping."  John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks"  Pete O'Hanlon



