Category : algebra

My code below produces the following error: C2131: expression did not evaluate to a constant. template<int32_t M, int32_t N> [[nodiscard]] constexpr double determinant(const Matrix<M,N> & m) { double det = 0; if constexpr(m.rows() == 2) { return m[0][0]*m[1][1] – m[0][1]*m[1][0]; } else { for(std::size_t col = 0; col < m.cols(); ++col) { det += m[0][col] ..

Read more

This question is more about algebra than programming but maybe I will find some help here 🙂 I am trying to create a QRect around a QLine with given offset(see picture below). Having the segment AB and the offset, how to find all the missing points to create a QRect? Source: Windows Que..

Read more

I wanted to simplify algebraic expressions in c++. I started with something simple: removing brackets from a algebraic expression containing + and – operators. For example, a-(b-c) should be simplified to a-b+c. This link gives the answer to this question. Here is the source code: #include <iostream> #include <string.h> #include <stack> using namespace std; // ..

Read more