I want to plot graphs of polynomials, and the solutions to equations, modulo a prime. So for example, for modulus 5 plot the graph of $x^2$, or the solutions to $x^2+y^2=2$, as subsets of $\mathbb{F}_5\times\mathbb{F}_5$. Of course I can do it by hand. And I can imagine ways to program it by generating and plotting lists but I have no experience programming, and since I do not really want many examples it might be the easiest for me to just do it by hand.

Does Mathematica have a command for this? Or are there examples on line doing it?

For example, the graph of $x^2$ modulo 7 contains the pairs

$\{0, 0\}, \{1, 1\}, \{2, 4\}, \{3, 2\}, \{4, 2\}, \{5, 4\}, \{6, 1\}$ and so it can be plotted by

ListPlot[{{0, 0}, {1, 1}, {2, 4}, {3, 2}, {4, 2}, {5, 4}, {6, 1}}]

Or again it might be nicer to represent the integers mod 7 by $\{-3,-2,-1,0,1,2,3\}$. And ListPlot with no further specifications does not produce very nice coordinate axes for this purpose since they have tick marks that make no sense as integers mod 7. If I keep working on it I'll get the job done but I wonder if someone has already got it well routinized.

  • $\begingroup$ I don't very understant what you want to draw.Can you give a example by your hand? $\endgroup$ – yode Feb 26 '17 at 16:11

Is it what you need?

ListPlot[{x, y} /. Solve[x^2 + y^2 == 2, Modulus -> 10], 
 GridLines -> (Range[Ceiling@#1, Floor@#2] &), AspectRatio -> 1, 
 Frame -> True, PlotRange -> {{-0.1, 10.1}, {-0.1, 10.1}}, 
 FrameTicks -> {Range[0, 10], Range[9]}, 
 PlotStyle -> {Black, PointSize[0.02]}]

enter image description here

  • $\begingroup$ Nice that you make so many parameters explicit, so they can easily be changed if desired. $\endgroup$ – Colin McLarty Feb 26 '17 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.