문제

I am writing my thesis right now and i wonder is that possible to give the function as an input and get the mathematical equation of that function for putting into thesis.

For example this is a function

        public static bool CompareThresholdPassWithList(int irThreshold, List<string> srlstWord1, List<string> srlstWord2)
    {
        int irSameCount = 0;
        int irMinOne = srlstWord1.Count;

        if ((srlstWord2.Count) < irMinOne)
            irMinOne = srlstWord2.Count;

        foreach (string srVariable1 in srlstWord1)
        {
            if (srVariable1.Length > 0)
            {
                foreach (string srVariable2 in srlstWord2)
                {
                    if (srVariable2.Length > 0 && srVariable1 == srVariable2)
                    {
                        irSameCount++;
                    }
                }
            }
        }

        if (((irSameCount * 100) / irMinOne) >= irThreshold)
            return true;
        else
            return false;

    }

Actually generating some output that i can use in my thesis would be sufficient. Maybe pseudo code or flow chart ? or else that can work.

C#

Thank you.

도움이 되었습니까?

해결책

I don't know the kind of terminology you'd probably want for a thesis but I can explain what this code is doing which I think if you understood you'd be in a better position.

You have two sets of words (Set 1 and Set 2), this code is determining the intersection of these two sets and then determining if the size of the set defined by intersection is greater than a defined percentage of the size of the smaller set. If there are duplicates in either set, then these will be counted more than once and empty strings are being excluded from the set defined by the intersection.

I'm not sure why the code would be written like it is, it seems very inefficient and I can't imagine a use case for this behaviour, I suspect it's buggy.

This was from a quick read of the code, If it were my thesis, I'd use something like Snippet Compiler to run the code with sample inputs to test the outputs.

다른 팁

From your description, it sounds like you might be better off working with a functional language, such as Haskell, rather than C#, which is essentially imperative.

For a function to be translatable into a mathematical formula, it needs to be referentially transparent, meaning that it does not cause any side effects during its execution.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top