Git Product home page Git Product logo

computor_v1's Introduction

Computor - Polynomial Equation Solver

About the project

This Python program is designed to solve polynomial equations of the second degree or lower.

It showcases the following functionalities:

Mandatory part

  • Takes a formula in the form of "5 * X^0 + 4 * X^1 - 9.3 * X^2 = 1 * X^0"
  • Displaying the equation in its reduced form
  • Determining the degree of the equation
  • Shows the solutions and the discriminant's polarity if applicable

Bonus part

  • Capability to add formulas like "5 + 4 * X + X^2= X^2"
  • Manage entry mistakes (vocabulary and syntax)
  • Display the intermediate steps
  • Presents solutions as irreducible fractions (for integer numbers)

Additionally, the program supports solving equations of the third degree.

"6 * X^1 - 4 * X^0 = 14 * X^0"

"12 * X^2 = -1 * X^0 - 7 * X^1"

"2 * X^3 + 9 * X^2 + 13 * X^1 + 6 * X^0 = 0"

Introduction

Algorithm

  1. Check the formula for entry mistakes.
  2. Parse and create a dictionary {"x0": [], "x1": [], "x2": [], "x3": []}, where values for each key are added to lists. This is done for displaying the formula in its complete form.
  3. Sum all values in each list, and the dictionary takes the form {"x0": 0, "x1": 0, "x2": 0, "x3": 0} for further calculations.
  4. Find the polynomial - in the dictionary, the first non-zero value from the end is chosen. Choose a solution method based on the polynomial.
  5. Implement solution methods based on the provided code.

Solution Methods

Addition of Monomials

  • Check if the equation is false or an identity and print the appropriate message.

Linear Equation

  • Solve and print the result for a linear equation.

Quadratic Equation

  • Calculate the discriminant and determine the method for further solution.
  • It includes methods for when the discriminant is zero, positive, or negative.

Cubic Equation

  • Find coefficients using the Vieta's method for discriminant calculation.
  • Calculate the discriminant and determine the method for further solution.
  • Determine the method for further solution based on the discriminant.

Specifications

  • Language: Python 3.6.9
  • Programs:
    • computor.py

Installation

$ git clone [email protected]:Anastasiia-Ni/computor_v1
$ cd computor_v1

Usage

To use the program, provide a polynomial equation as a command-line argument:

$ python computor.py "5 * X^0 + 4 * X^1 - 9.3 * X^2 = 1 * X^0"

computor_v1's People

Contributors

anastasiia-ni 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.