Typed variables
I want Sage to solve equations in Zmod(n)
for a fixed n
. To state the equations i declare
variables with var
, so they are in SR
instead of Zmod(n)
. The domain
keyword only
allows a small set of possible domains (as strings).
Is there a way to declare the type of a variable besides the domain
parameter?
Equations in how many variables? Is
n
prime by any chance? The usual approach is to work with ideals and varieties, but this is best supported over fields.The first application that came to mind was to show that there are no ISBN10 numbers where swaps of (non-identical) consequitive digits result the same checksum digit. That would be nine or ten variables in
Zmod(10)
. But it would be of general interest to know if variables in sage necessarily can only have a handful of types (the strings allowed for thedomain
keyword).So the question is rather... "is there a way to declare the type of variables inside
var
, so that evensolve
understands them..."?! Well, yes, just extend the sage code to work for the own purposes.Instead, why not use sage with the given functionality?
Zmod(10)
is a finite ring, and a small number of digits can be easily parsed and accepted / rejected based on some special conditions (given by the equations in the OP).(Asking as Anonymous is not really a good way...)