Git Product home page Git Product logo

genpo's Introduction

Genpo

A python library and a simple CLI program to generate and manipulate polynomials, with roots simple to find by hand. The degree of the polynomial, the number of roots and the multiplicities of these roots, are all tweakable to generate polynomials with different grades of difficulty.

I started this library while studying for a math exam where it was required to be able quickly find the roots of a polynomial of degree 3 or 4. It helped me pass it.

Python library

Polynomials as arrays

The polynomials in this library are all represented as arrays, in which the element at position i in the array is the coefficient of x^i. I chose this representation because its simple to understand and manipulate. I didn't wrap it in a class because I think it would only create unnecessary complexity.

Modules

The genpo library modules are mainly divided in 2 section: manipulation and random generators.

Manipulation modules

These modules provide functions to manipulate polynomials: creation, arithmetic operations and string representations

genpo.polynomials

Pure functions for creating polynomials from parameters. For example, parabolas.

genpo.operations

Arithmetic operations on polynomials.

Operations actually supported:

  • sum between polynomials
  • multiplication between polynomials
  • multiplication of a polynomial by a factor (numeric or fraction)
  • evaluation of a polynomial and its derivative in one point

genpo.roots

Utilities functions to work with roots and multiplicities.

genpo.representation

String representations of polynomials. The functions provided here were all thought to print their output in the terminal

Random generators (genpo.random)

All modules under genpo.random have the scope of generating random roots and polynomials. All values generated are roots and values simple to find and to calculate for a person that is resolving a polynomial by hand.

values

Generators for intervals of values, simple fractions or expanding randomly a list of items. This module is used internally in more complex generators

roots

Generators for random polynomials roots and multiplicities. All generated roots are integers numbers not too big, simple to find by hand.

polynomials

Generators for polynomials, with or without roots. This is the core of the genpo library, where many parts of the library are used. The functions in this file are divided in two categories, based on the generated polynomials:

  • generators for polynomials in which the sum of multiplicities of their zeroes equals its degree;

  • generators for polynomials with an arbitrary sum of zeroes' multiplicity.

fz "full zeroes" generators

Functions in the genpo.random.polynomials with fz in the name, are functions that returns polynomials that I defined full zeroes, polynomials in which the sum of multiplicities of their zeroes equals its degree.

Genpo cli

Coming soon. Stay tuned ;)

genpo's People

Contributors

luckv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.