Look:

rs:=rule cos(x)*sin(y)-sin(x)*cos(y)  == sin(y-x)
rc:=rule  cos(x)*cos(y)-sin(x)*sin(y) == cos(x+y)

t1 := paren(cos(x)*sin(y)-sin(x)*cos(y))
t2 := paren(cos(x)*cos(y)-sin(x)*sin(y))
expr := t1*cos(x3) + 5 + tan(q)*tan(w) + t2*w*cos(a)+ t1*t2*r3

rc rs expr -- voilĂ  ;-)

more below ...

On Monday, 30 January 2017 15:45:50 UTC+1, Bill Page wrote:
>
> Why do you find it interesting? 'box' and 'paren' are just kernels 
> with no automatic simplifications. 


That's the interesting part (at least to me) when dealing with rules. If I 
had known 'paren' before I wouldn't have suggested the construction using 
equations (see former post).
 

> On output 'box' is invisible but 
>

Indeed, but tex or html output uses  parens ... so I'm wondering why not in 
algebraic mode?  
 

> 'paren' displays as parenthesis. As with all kernels in Expression the 
> arguments of the kernel are themselves members of Expression 
> (recursively). This seems to be of limited usefulness to me - a kind 
> of a hack to avoid some forms of autosimplification. 'distribute' just 
> evaluates 'box' and 'paren' as identities (selectively in the two 
> argument for). 


It would certainly be of limited use without 'distribute', however, as long 
as we have an 'inverse' it seems to me well defined as any other 'hack' ;-)
 

> I rather think that it attempts to solve the problem at 
> the wrong level. 
>
>
Is it a problem at all? 
If you're alluding on symbolic expressions then I'll fully agree. 
 

> On 29 January 2017 at 22:37, Kurt Pagani <[email protected] <javascript:>> 
> wrote: 
> > I wasn't aware of "box" or "paren" in EXPR INT. That's really 
> interesting. 
> > Apparently "distribute" reliably works as advertised: 
> > 
> >   distribute(f) expands all the kernels in f that are formally enclosed 
> by a 
> > box or 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 [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/fricas-devel. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to