Structure of the Diophantine equation module

The structure of the module is going to be essentially the same as SymPy’s ODE module. ODE module and Diophantine equations (DE) module both need to pattern match a given equation to identify which category it falls and carry out solution procedure accordingly. Below is a pseudo-code representation of the rough structure I wish to follow in the DE module.


type = classify_diop(eq)
# The required solution routine will be called based on the type
# returned by classify_diop(). The types returned will be linear,
# quadratic, pell, and so on.


# Matching “eq” with currently solved equations takes place here.
# This will return the type of DE and information that was found during
# matching which will be helpful in solving equation.
# eg: linear, quadratic, pell … etc.


# This will solve linear DEs.


# This will solve Pell’s equations.



A separate method will be implemented for each “type” returned by classify_diop(). This structure provide a convenient interface for adding solutions for new type of equations. We just need to implement a solver function for that method and add a line in diop_solve() to call that function if the type returned by classify_diop() is the same.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: