Skip to content

Nqsir/Computor_V1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Computor_V1

Simple Polynomial equation solver (degree 2 max.)

Example: py ComputorV1.py

Please enter your polynomial expression : 5 * X^0 + 4 * X^1 - 9.3 * X^2 = 1 * X^0

Polynomial degree = 2
Reduced form:  4 * X^0 + 4 * X^1  -9.3 * X^2 = 0
Discriminant is strictly positive, the two solutions are:
 0.9052 

-0.4751

Example: py ComputorV1.py -d for detailed mode

Please enter your polynomial expression : 5 * X^1 - 9.3 * X^2 = 1 * X^0

/*/-------
 Detailed mode activated 
/*/-------

Please enter your polynomial expression : 5 * X^1 - 9.3 * X^2 = 1 * X^0 

/*/-------
Pattern catched [('', '', '5', '1'), ('', '-', '9.3', '2'), ('=', '', '1', '0')]     
/*/-------


/*/-------
Prepared pattern to simplify [['', '', 5.0, 1], ['', '', -9.3, 2], ['', '', -1.0, 0]]
/*/-------


/*/-------
Reduced pattern [['', '', -1.0, 0], ['', '', 5.0, 1], ['', '', -9.3, 2]]
/*/-------

Polynomial degree = 2
Reduced form:  -1 * X^0 + 5 * X^1  -9.3 * X^2 = 0

/*/-------
Discriminant = -12.200000000000003
/*/-------

Discriminant is strictly negative, the two solutions are:
(-5 - i * √-12.20) / 5.0 

(-5 + i * √-12.20) / 5.0 

About

Simple Polynomial equation solver (degree 2 max.)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages