improved Non-linear equation derivations and code organization