Coder Social home page Coder Social logo

gdelaurentis / pyadic Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 0.0 2.74 MB

p-Adic numbers and finite fields in Python

Home Page: https://gdelaurentis.github.io/pyadic/

License: GNU General Public License v3.0

Python 99.03% Makefile 0.97%
finite-fields p-adic-numbers rational-reconstruction

pyadic's People

Contributors

gdelaurentis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyadic's Issues

Problem with the integers

Sorry, not sure if this related to the update just pushed, or some other issue, but now there seems to be some problem with the integers? Both with as_tuple and even with normal arithmetic... could be my misunderstanding of the correct behavior though. This is with the most recent version just pushed.

The powers of p have the same tuple representation

>>> PAdic(1,2,4)
1 + O(2^4)
>>> PAdic(2,2,4)
1*2 + O(2^5)
>>> PAdic(4,2,4)
1*2^2 + O(2^6)
>>> PAdic(1,2,4).as_tuple
(1, 0, 0, 0)
>>> PAdic(2,2,4).as_tuple
(1, 0, 0, 0)
>>> PAdic(4,2,4).as_tuple
(1, 0, 0, 0)

Normal arithmetic seems broken

>>> PAdic(2,2,4) + PAdic(2,2,4) == PAdic(4,2,4)
False
>>> PAdic(2,2,4) + PAdic(2,2,4)
1*2^2 + O(2^5)
>>> PAdic(4,2,4)
1*2^2 + O(2^6)

Difference between negative integers and equivalent negative fractions?

Thank you for this package, it has been really helpful trying to build an intuition for p-adic numbers. In playing around I came across an odd behavior that think may be a bug. Specifically, when converting from a negative integer -x I seem to get a different PAdic than when I convert from the equivalent trivial fraction(-x,1).

PAdic(-2, 2, 4)
12 + 12^2 + 12^3 + O(2^4)
PAdic(Q(-2,1), 2, 4)
1
2 + 12^2 + 12^3 + O(2^5)
Q(-2,1) == -2
True

when prime is 2

屏幕截图 2024-03-13 110837

May the circumstance of prime 2 has something weird.

Second, the significant digits. Could them not be figured out by the method itself instead of being indicated by users?

Thanks.

p-adic numbers with denominators that are multiples of p do not work

PAdic(Q(1/5), 5, 20)*5 should just produce 1, but instead gives 1*5^3 + 2*5^5 + 2*5^6 + 4*5^7 + 2*5^8 + 2*5^9 + 2*5^11 + 1*5^12 + 4*5^13 + 4*5^17 + 4*5^18 + 3*5^20 + 3*5^21 + 3*5^22 + O(5^23)

I believe this to be because a proper representation of 1/5 in 5-adic numbers is ...0000.1 . This would be 1*5^-1 in your representation, but that is not what is outputted. The issue also exists for other bases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.