5 kyu

Constructing polynomials

56 of 73FArekkusu
Description
Loading description...
Mathematics
Performance
Fundamentals
  • Please sign in or sign up to leave a comment.
  • artem-totality Avatar

    Solved this Kata in Python. Firstly wrote code in JS then translated it into Python. In JS it passed test cases for 1 - 10 roots, but failed for some '625-675 roots' cases. And it is impossible to debug it uses error message: expected 'x^673 - 2153x^672 + 1140664x^671 + 86…' to equal 'x^673 - 2153x^672 + 1140664x^671 + 86…' because in this message we can't undestand what is going wrong!!! More over the same Code translated to Python passed all tests! It is needed to do something with it!

  • Krillan Avatar

    This 5kyu kata is much more difficult than similar 4kyu("Simplifying multilinear polynomials" and "Differentiate a polynomial"). Its level needs to be raised to 3 kyu, then it will be solved and it will not gather dust at the bottom

  • heptapod Avatar

    hello creator, cannot access the sympy module. Is it not allowed to be used? If it is, may you please make it accessible? Thank you.

  • Jomopipi Avatar

    excellent kata

  • semmra7 Avatar

    I think the term 'quotient' in the description should be changd to 'coefficient'.

  • ZED.CWT Avatar

    JavaScript, random tests exceed Number.MAX_SAFE_INTEGER

    Expected:
    'x^10 + 98x^9 - 15191x^8 - 1626408x^7 + 73971954x^6 + 9353828652x^5 - 116846046934x^4 - 22160573349992x^3 - 28332247244755x^2 + 18091430222952452x + 120855021275386130 = 0',
    instead got:
    'x^10 + 98x^9 - 15191x^8 - 1626408x^7 + 73971954x^6 + 9353828652x^5 - 116846046934x^4 - 22160573349992x^3 - 28332247244755x^2 + 18091430222952450x + 120855021275386130 = 0'
    
  • Blind4Basics Avatar

    This comment has been hidden.

  • narayanswa30663 Avatar

    One more quick issue: you need to define clearly that the coefficient for the highest degree term must always be 1; there are actually an infinite number of polynomials for any set of given roots without this restriction.

  • Blind4Basics Avatar

    This comment has been hidden.

  • Blind4Basics Avatar

    one problem, though:

    currently, your tests about the simplifications of the expression are almost only fixed tests because the random ranges you use have very little chances to generate the 0 coef for the degree 0 of the polynome. For instance, I passed several times the full batch of random tests while failing 4 fixed tests. So you have to update your random tests to be sure that several tests about each edge case will show up.

    EDIT: why a "performances" tag?? I don't see the point for this kind of task... :o

  • Blind4Basics Avatar

    Really cool one! Funny tests comments! But really too long test suite!!! ("Seriously", yeah!!?). No seriously, that makes chock my browser. It least, silence the assertions when they are succesful, so that you do not have so much display in the console. And that may make the test suite a bit faster too (currently 9s...)