| 1 | initial version |
You may use symbolic variables and interpret the * operator as the inner poduct:
sage: u,v,r = var("u v r")
sage: (u*(v+r*u)).expand()
r*u^2 + u*v
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.