Typed variables

asked 2020-06-10 03:13:21 -0600

anonymous user

Anonymous

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?

edit retag flag offensive close merge delete

Comments

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.

rburing gravatar imagerburing ( 2020-06-10 07:28:22 -0600 )edit

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 the domain keyword).

Xwa8HbPzuSQPGrut gravatar imageXwa8HbPzuSQPGrut ( 2020-06-10 09:53:15 -0600 )edit

So the question is rather... "is there a way to declare the type of variables inside var, so that even solve 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...)

dan_fulea gravatar imagedan_fulea ( 2020-06-12 07:28:33 -0600 )edit