Generates the fundamental solution to Pell's equation and creates a class and several functions for performing calculations in
Calculates the fundamental solution using the chakravala method. Example usage:
>>> smallest_solution_Pell(34)
[35,6]
>>> 35**2 - 34*6**2
1
enables you to easily make a scatter plot of the solutions, using the MatPlotLib module. Type
>>>plot(100)
to plot the smallest solutions of the first 100 values of d. Optional arguments are: Xscale (integer, default 1000) that determains the size of the plot, and logaritmic (boolean, default False) that determains whether the axes are logarithmic or not.
Given a,b,d and f, represents the number
Example usage:
>>> alpha = ZfZsqrtd(35,6,34,17)
>>> print(alpha)
1+6sqrt{34} (mod 17)
>>> print(alpha*alpha)
1+12sqrt{34} (mod 17)
>>> print(orde(alpha,17))
17
PWS_chakravala is released under the MIT License.
Copyright (c) 2015 Pim Spelier