Giter Club home page Giter Club logo

polynomial-roots-calculator's Introduction

Polynomial roots calculator

A simple polynomial roots calculator script written in python.

It uses Gauss Lemma to get the potential roots of an integer coefficients polynomial. Then it does Ruffini's rule for each potential root and determine if each value is a root. If a root is found the quotient polynomial is evaluated with the root just found to get double, triple, etc roots and not loose solutions.

Remember that a n grade polynomial must have n number of roots, so if the roots that the script finds are less than the grade of the polynomial, assume complex roots (which cannot be found using Gauss Lemma & Ruffini)

Requirements

Instalation

$ pipenv install

Limitations

  • Meant to be used for real coefficients polynomials (complex polynomials are not supported by design, since Gauss Lemma only gets potential roots for integer coefficients polynomials)
  • It uses the Gauss Lemma for finding the polynomials roots, so you need to input integer coefficients. If your polynomial has rational / irrationals coefficients try multiplying the whole polynomial by an integer that gets rid of the denominators. The resulting polynomial will share roots with the original one. Example:
P(x) = (3/2)(x^4) + (5/2)(x^3) - 2(x^2) + (3/2)x + (9/2)
2P(x) = 3(x^4) + 5(x^3) - 2(x^2) + 3x + 9   <-- Shares roots with P(x)

Features

  • Rational display of floats ('0.33333333333' will be displayed as '1/3')
  • Square root display of irrational floats (sqrt(2) = โˆš2)
  • Support for any degree polynomial
  • Support for nth (double, triple, etc) roots (will be displayed n number of times)
  • Partial support for complex roots (conjugate ones only)

Usage

To perform a run, prompt:

$ python3 roots.calculator.py

polynomial-roots-calculator's People

Contributors

m-ivan avatar

Stargazers

Lucio Caridi 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.