fjames86 / fpoly

Manipulate dense multivariate polynomials
0 stars 0 forks source link

bug in parser #16

Closed fjames86 closed 11 years ago

fjames86 commented 11 years ago

incorrectly parses terms with multiple signs, e.g.

{1 ++ 4x} -> #{2 + 4x}

{1 -- 4x} -> #{4x}

Something strange happening here...

fjames86 commented 11 years ago

in fact, also applies to any negative sign, e.g. #{1 - 4x + 7} -> #{-6 -4x}

fjames86 commented 11 years ago

the above issue is now fixed. but the double sign problem remains and looks to be difficult to fix. double signs should not be allowed anyyway

fjames86 commented 11 years ago

could be fixed by adding a 2nd accumulator to build-monomial, so there is a separate accumulator for the total polynomial (which gets summed) and the monomial (which gets multiplied).

fjames86 commented 11 years ago

now fixed, so that e.g. #{-4} -> #{-4} instead of #{-3} as before, similarly #{++++} -> #{0}. However, multiple signs still aren't really correctly handled, since multiple negative signs don't work. so #{--3} -> #{-3} instead of #{3}.

fjames86 commented 11 years ago

parser can't deal with fractional coefficients, although they are perfectly permissible. probably should add this functionality to the parser.

fjames86 commented 11 years ago

could also add arbitrary expressions for exponents, e.g. #{x ^ (3*4)} -> #{x^7}

fjames86 commented 11 years ago

bug fixed. extensions to the parser could be added at a later date but are not essential at this time.