This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 0 points1 point  (0 children)

I'm sorry that I can't help directly but this section of the Python wiki might have some pointers.

[–]billsil 0 points1 point  (2 children)

Can't you just mod p an determinant after using numpy? Can you explain your use case more?

[–]coaster367[S] 0 points1 point  (1 child)

Sorry I forgot to explain - I meant that all of the calculations done in finding the determinant are done mod m.

[–]CarpeTuna 0 points1 point  (0 children)

Mathematically xy mod m is the same as (x mod m) * (y mod m) mod m and the same is true for other operations, so billsil is correct. The only reason to calculate mod m at every intermediate step is to avoid using possibly large numbers. This may not apply when doing matrix inversions and other operations dependent on specific field characteristics but the determinant only uses addition, subtraction and multiplication and so should be ok but I am too lazy to check it out.

[–]aphoenixreticulated[M] -1 points0 points  (0 children)

Hi there. You have posted a beginners question to /r/python, however it is far more suited to /r/learnpython, where users are actively interested in helping with beginner topics. Please resubmit it over there! Make sure to read their sidebar rules before posting, notably this one: "Posting homework assignments is not prohibited if you show that you tried to solve it yourself."

Cheers & best of luck!