fix polynomial to accept any exponents
This commit is contained in:
45
README.md
45
README.md
@@ -16,31 +16,30 @@ this project uses submodules (maybe recursively), so either :
|
||||
## steps
|
||||
|
||||
1. lexer
|
||||
-> tokens[] :
|
||||
{
|
||||
PLUS -> +
|
||||
MINUS -> -
|
||||
VARIABLE -> x
|
||||
NUMBER -> int or double
|
||||
POWER -> ^
|
||||
MULTIPLICATION -> *
|
||||
DIVISION -> /
|
||||
END -> null
|
||||
}[]
|
||||
-> tokens types :
|
||||
- TOKEN_VARIABLE // x, y, etc.
|
||||
- TOKEN_NUMBER_INT // int
|
||||
- TOKEN_NUMBER_DOUBLE // double
|
||||
- TOKEN_POWER // ^ or **
|
||||
- TOKEN_SIGN_PLUS // +
|
||||
- TOKEN_SIGN_MINUS // -
|
||||
- TOKEN_FACTOR_MULT // *
|
||||
- TOKEN_FACTOR_DIV // / or :
|
||||
- TOKEN_EQUAL // =
|
||||
- END // null
|
||||
2. parser
|
||||
-> terms[] :
|
||||
{
|
||||
SIGN -> + or -
|
||||
COEFFICIENT -> double
|
||||
EXPONENT -> double
|
||||
}[]
|
||||
-> terms :
|
||||
- POSITION // left or righ from =
|
||||
- SIGN // + or -
|
||||
- COEFFICIENT // double
|
||||
- EXPONENT // double
|
||||
3. reduce
|
||||
-> polynom :
|
||||
{
|
||||
a -> double
|
||||
b -> double
|
||||
c -> double
|
||||
}[]
|
||||
-> polynom :
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- ...
|
||||
4. print reduced form
|
||||
5. find degree
|
||||
6. print degree
|
||||
|
||||
Reference in New Issue
Block a user