Skip to main content

ENG: A module that allows you to solve quadratic and linear equations. | RU: Модуль, позволяющий решать квадратные и линейные уравнения.

Project description

equation_maths_helper

ENG

A module that allows you to solve quadratic and linear equations.

How to use?

Importing

First, import the equation class from the equation_math_helper module.

from equation_maths_helper import equation

The linear_one_variable method

The linear_one_variable method allows you to solve linear equations with a single variable.

The method accepts the coefficients a and b from the formula ax + b = 0. It also has an additional solution parameter, which is responsible for outputting a step-by-step solution to the console. By default it is set to False. The method returns False if it fails (there are no roots), the root of the equation, or True if the root is any number.

Example of using the method:

from equation_maths_helper import equation
equation_answer = equation().linear_one_variable(a=1, b=1, solution=True)
print(equation_answer)

Output the solution to the console:

Root: x = -b / a = x = 1 / 1 = 1.0.
1.0

The quadratic method

The quadratic method allows you to solve quadratic equations.

The method accepts the coefficients a, b, and c from the formula a(x ** 2) + bx + c = 0. It also has an additional parameter solution, which is responsible for displaying the step-by-step solution on the console. By default, it is set to False. The method returns False if it fails (no roots) or a tuple with 1 or 2 roots of the equation.

An example of using the method:

from equation_maths_helper import equation
equation_answer = equation().quadratic(a=1, b=-5, c=6, solution=True)
print(equation_answer)

Output of the solution to the console:

Discriminant: (b ** 2) - 4 * a * c = (-5 ** 2) - 4 * 1 * 6 = 1.
First root: x1 = (-b - sqrt(d)) / 2 * a = (5 - 1.0) / 2 * 1 = 2.0.
Second root: x2 = (-b + sqrt(d)) / 2 * a = (5 + 1.0) / 2 * 1 = 3.0.
Roots: 2.0, 3.0.
(2.0, 3.0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

equation_maths_helper-1.5.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

equation_maths_helper-1.5-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file equation_maths_helper-1.5.tar.gz.

File metadata

  • Download URL: equation_maths_helper-1.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for equation_maths_helper-1.5.tar.gz
Algorithm Hash digest
SHA256 052430a1b0f3fe38d78629e6a251fb41ea23b6c97ea5b9892370d8f5a193ed9b
MD5 d8948e32b8ede5f98a8784c598bae0fc
BLAKE2b-256 b268a12db07d1db44e1731d6d90edf65fdb8f859e93847b983d074a7e8ba4f7f

See more details on using hashes here.

File details

Details for the file equation_maths_helper-1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for equation_maths_helper-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4be326b96375169bb9e0dbadbb592dcb3ce70b32e6c88d91d710639e57b127e6
MD5 a7e860769521a49931a1523203c8fe2a
BLAKE2b-256 c7b18192bb5b28f5402e87194a471c4a61db287dad389e4f89a472c99fb01769

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page