# Does anyone know how to implement a simple XL Algorithm in sage?

I need to implement the XL algorithm in sage, which i can use to solve over-determined systems of polynomial equations (more equations than variables). Any help on how to do this?

edit retag close merge delete

## Comments

I have had a look at that but i don't really understand what is going on there because it doesn't seem to provide a solution, also i need to do it for a polynomial system. They define a polynomial system with the following

sr = mq.SR(1,1,1,4, gf2=True, polybori=True, order='lex')

F,s = sr.polynomial_system()and i don't really get what kind of polynomial system has actually been implemented there :/

The structure in encapsulated. To see the $36$ polynomials in F:

for pol in F: print pol


There are 20 variables in F.variables(). So there are $\binom{20}2=190$ monomials $ab$, where $a,b$ are variables, $a\ne b$.

Then we build F2 = Sequence(map(mul, cartesian_product_iterator((monomials, F)))). The cartesian product of all monomials $ab$ and all pols $f$ has then $190\cdot 36$ elements, we map them via mul getting all$ab\;f$ of this shape.

The tricky F2.coefficient_matrix(sparse=False) isolates the corresponding matrix, try F2.coefficient_matrix? to see in examples how this works.

From here, standard linear algebra gets the hands on it...

This example may not be related to the own problem, but then we have to know this other problem / situation.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8736518,"math_prob":0.99374735,"size":1605,"snap":"2021-04-2021-17","text_gpt3_token_len":403,"char_repetition_ratio":0.11430356,"word_repetition_ratio":0.0,"special_character_ratio":0.24049844,"punctuation_ratio":0.1574074,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99854255,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-19T18:27:42Z\",\"WARC-Record-ID\":\"<urn:uuid:9de07276-1ed8-43da-9353-db878fb95481>\",\"Content-Length\":\"53650\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:5470ae67-50ca-4c3e-a941-248f6bf0e0f7>\",\"WARC-Concurrent-To\":\"<urn:uuid:360d079e-33e3-4db0-a612-512c281e3905>\",\"WARC-IP-Address\":\"194.254.163.53\",\"WARC-Target-URI\":\"https://ask.sagemath.org/question/41818/does-anyone-know-how-to-implement-a-simple-xl-algorithm-in-sage/\",\"WARC-Payload-Digest\":\"sha1:SUJ5UYXROWGFCNLQ4CQWNSSMM6B6DIOJ\",\"WARC-Block-Digest\":\"sha1:3AIZKCTGDUSAMMGKIDORCVXYAVVW4P56\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618038916163.70_warc_CC-MAIN-20210419173508-20210419203508-00149.warc.gz\"}"}