davidedc / Algebrite

Computer Algebra System in Javascript (Typescript)
http://algebrite.org
MIT License
966 stars 59 forks source link

Solving equations with modular arithmetic #87

Open jarble opened 5 years ago

jarble commented 5 years ago

I tried to solve an equation with modular arithmetic, but there seems to be a syntax error here:

(x % 4)+1=3

(x % ?  4)+1=3
Stop: ) expected

Is Algebrite able to solve equations that include modular arithmetic?

davidedc commented 5 years ago

Hi @jarble, not right now I'm afraid.

If you mean finding roots/factoring/determine irreducibility of polynomials over Z/n or N (seems to be your example), then yes it's in the roadmap.

If you have something more general in mind, then can you give more examples of what you'd like to achieve?

jarble commented 5 years ago

One of my goals is to solve Zhegalkin polynomials, which are Boolean formulas written in terms of modular arithmetic.

davidedc commented 5 years ago

@jarble if you want to find the solutions of a1*x + a0 = 0 (mod n) (with all coefficients and n in N or maybe even Z, and n of "reasonable" size), that could be done with coming work on polynomials that I mentioned.

If you want to do it earlier, this seems to be a "specified enough" problem that you could try to make an Algebrite function f(a1,a0,n) (returning the array of solutions, if n is of a "reasonable" size) that does that - there are enough functions in Algebrite that would seem to make that possible.