Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular equations #129

Closed
Bodigrim opened this issue Aug 17, 2018 · 3 comments
Closed

Modular equations #129

Bodigrim opened this issue Aug 17, 2018 · 3 comments

Comments

@Bodigrim
Copy link
Owner

Bodigrim commented Aug 17, 2018

Provide high-level functions to solve linear and quadratic equations by modulo.

Implement solveLinear satisfying propLinear and solveQuadratic satisfying propQuadratic.

solveLinear :: Mod m -> Mod m -> [Mod m]
solveLinear = undefined 

propLinear :: Mod m -> Mod m -> Bool 
propLinear a b = 
  all 
    (\x -> (a * x + b == 0) == x `elem` solutions) 
    [minBound .. maxBound]
  where 
    solutions = solveLinear a b

solveQuadratic :: Mod m -> Mod m -> Mod m -> [Mod m]
solveQuadratic = undefined 

propQuadratic :: Mod m -> Mod m -> Mod m -> Bool 
propQuadratic a b c = 
  all 
    (\x -> (a * x ^ 2 + b * x + c == 0) == x `elem` solutions) 
    [minBound .. maxBound]
  where 
    solutions = solveQuadratic a b

Applications: solveLinear can be used instead of solveCongruence in #110, solveQuadratic may be used to solve norm (z :+ 1) == 0 in quadratic fields (Gaussian, Eisenstein, etc.) for purposes discussed in #111.

@Bodigrim
Copy link
Owner Author

I'll assign myself to this issue.

@rockbmb
Copy link
Contributor

rockbmb commented Aug 21, 2018

@Bodigrim I was browsing other open issues since I put my two open PRs on hold while I solve some problems with them (one of them solved by this issue), I'll keep an eye on this to use it in #118.

@b-mehta
Copy link
Contributor

b-mehta commented Aug 22, 2018

@Bodigrim For efficient implementation of solveQuadratic for prime powers, Hensel's lemma is likely a good approach (and of course for other composites, the Chinese remainder theorem will reduce the problem to this case).

@b-mehta b-mehta mentioned this issue Aug 22, 2018
7 tasks
This was referenced Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants