loda-cpp icon indicating copy to clipboard operation
loda-cpp copied to clipboard

Gaussian elimination not working for A001042

Open ckrause opened this issue 2 years ago • 0 comments

The currently generated formula for A001042 is:

a(n) = a(n-1)^2-a(n-1)+b(n-1), b(n) = -a(n-1)+b(n-1)

Note that by Gaussian elimination we should find a simpler formula for b(n):

a(n)-b(n) = a(n-1)^2 
b(n) = a(n)-a(n-1)^2

Substituting it in the main formula, we can further simplify to:

a(n) = a(n-1)^2-a(n-2)^2

Issue can be reproduced using:

./loda export -l debug A001042

Relevant code is here: https://github.com/loda-lang/loda-cpp/blob/main/src/form/variant.cpp

ckrause avatar Jan 04 '24 13:01 ckrause