Numerical

These are a few modules created in order to practice using computational analysis to solve problems.

gcd_iter

Display an iterative method for determining the greatest common denominator.

Jan 17, 2019:

Just added in sys so that we accept input from the user.

pyutil.numerical.gcd_iter.gcd_iter(a, b)[source]

Find the greatest common denominator with 2 arbitrary integers.

Parameters
  • a (int) – User provided integer

  • b (int) – User provided integer

Returns

gcd – Greatest common denominator.

Return type

int

gcd_recur

Find the greatest common denominator using a slightly different algorithm.

Plot Examples

(Source code, png, hires.png, pdf)

_images/numerical-1.png
pyutil.numerical.gcd_recur.gcd_recur(a, b)[source]

Find the greatest common denominator with 2 arbitrary integers.

Parameters
  • a (int) – User provided integer

  • b (int) – User provided integer

Returns

gcd

Return type

int