Suppose $ L $ be an extension over $ \mathbb{Q} $ of degree $ n $. Let $\{e_{1},e_{2},\dots,e_{n}\} $ be a basis of this extension. Now I know the product $ e_{i}^{2} $ and $ e_{i}e_{j} $ . So we can determine the product $ a *b $ where $ a,b \in L $. But the calculation will so laborious. Is there any computational tool in sage math/programming/Matlab or something else to calculate this product? You can fix $ n $ like $ 6 $ or $8 $ .