ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 18 Jun 2017 10:50:08 -0500Generic discrete_loghttps://ask.sagemath.org/question/37996/generic-discrete_log/ I've been struggling with discrete_log function. The docs say it is the generic BSGS algorithm that is supposed to work in any group. The function works e.g. if I write
discrete_log(Mod(9, 17), Mod(2, 17), 16, operation='*')
However it keeps returning 0 when I put operation='other', e.g.
discrete_log(9, 2, 16, operation='other', op=lambda x, y: (x * y) % 17)
The op function is not even called once.
Is there something that I'm doing wrong or is discrete_log not really generic?Sat, 17 Jun 2017 19:11:41 -0500https://ask.sagemath.org/question/37996/generic-discrete_log/Comment by dan_fulea for <p>I've been struggling with discrete_log function. The docs say it is the generic BSGS algorithm that is supposed to work in any group. The function works e.g. if I write</p>
<p>discrete_log(Mod(9, 17), Mod(2, 17), 16, operation='*')</p>
<p>However it keeps returning 0 when I put operation='other', e.g.</p>
<p>discrete_log(9, 2, 16, operation='other', op=lambda x, y: (x * y) % 17)</p>
<p>The op function is not even called once.
Is there something that I'm doing wrong or is discrete_log not really generic?</p>
https://ask.sagemath.org/question/37996/generic-discrete_log/?comment=38000#post-id-38000For my version 7.5.1 the first line does not work,
sage: discrete_log(Mod(9, 17), Mod(2, 17), 16, operation='*')
runs into
ValueError: No discrete log of 9 found to base 2
However...
sage: discrete_log(Mod(9, 17), Mod(2, 17), 8, operation='*')
7
Typing `??discrete_log` i could not find the path really considering the `'other'` operation... So why not use the operations * and + available? (Or write the corresponding adapted code to search for the discrete log in a very special situation...)Sun, 18 Jun 2017 10:50:08 -0500https://ask.sagemath.org/question/37996/generic-discrete_log/?comment=38000#post-id-38000