I wasn't aware of "box" or "paren" in EXPR INT. That's really interesting. Apparently "distribute" reliably works as advertised:
distribute(f) e*xpands all the kernels in f that are formally enclosed by a box <http://fricas.github.io/api/ExpressionSpace.html#l-expression-space-box> or paren <http://fricas.github.io/api/ExpressionSpace.html#l-expression-space-paren> expression.* I've tried to figure out what "box" is actually doing. By (17) and (18) below I would bet it's like "invisible parentheses"? (1) -> paren(a+b)*(a+b) (1) (b + a)(b + a) Type: Expression(Integer) (2) -> distribute % 2 2 (2) b + 2a b + a Type: Expression(Integer) (3) -> kernels % (3) [b,a] Type: List(Kernel(Expression(Integer))) (4) -> kernels (paren(a+b)*(a+b)) (4) [(b + a),b,a] Type: List(Kernel(Expression(Integer))) (5) -> kernels (paren(a+b)*(a+b)).1 (5) (b + a) Type: Kernel(Expression(Integer)) (6) -> name % (6) %paren Type: Symbol ... (13) -> paren(a*(b+c)) (13) (a c + a b) Type: Expression(Integer) (14) -> paren(a*paren(b+c)) (14) (a(c + b)) Type: Expression(Integer) (15) -> distribute % (15) a c + a b Type: Expression(Integer) (16) -> box(a*(b+c)) (16) a c + a b Type: Expression(Integer) (17) -> box(a*box(b+c)) (17) ac + b Type: Expression(Integer) (18) -> distribute % (18) a c + a b Type: Expression(Integer) On Friday, 27 January 2017 17:04:45 UTC+1, Waldek Hebisch wrote: > > Constantine Frangos wrote: > > ... > Some people want to stop transformation of expressions to get > desired output for printing expressions. In FriCAS you can > use box and paren: > > (9) -> x*(y + x) > > 2 > (9) x y + x > Type: > Polynomial(Integer) > (10) -> x*box(x+z) > > (10) xz + x > Type: > Expression(Integer) > (11) -> x*paren(x+z) > > (11) x(z + x) > Type: > Expression(Integer) > > FriCAS will keep content of box (or paren) together. Box prints without > parenthesis which is appropriate for sums, but as (10) above shows > is confusing for products. Note: if you want to do computations > with then note that in most cases you need to remove them by > hand if you want to combine content with what is outside. > > -- > Waldek Hebisch > -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.