Constantine Frangos cited Kurt:
> Am 25.01.2017 um 17:56 schrieb Constantine Frangos:
> > 
> > (a) any symbolic arguments appearing in the trigonometric 
> > functions, for example,
> > cos(x1)*sin(y)-sin(x1)*cos(y), 
> > cos(x3)*sin(z)-sin(x3)*cos(z), etc
> 
> That's the point. If you're using t1,t2 this way, look what happens:
> 
> (1) -> t1 := cos(x)*sin(y) - cos(y)*sin(x)
> 
>    (1)  cos(x)sin(y) - cos(y)sin(x)
>                                                     Type: Expression(Integer)
> (2) -> t2 := - sin(x)*sin(y) + cos(x)*cos(y)
> 
>    (2)  - sin(x)sin(y) + cos(x)cos(y)
>                                                     Type: Expression(Integer)
> (3) -> expr := tan(q)*tan(w) + t1*cos(x3) + t2*w*cos(a) + r3*t1*t2 + 5
> 
>    (3)
>                                          2
>      tan(q)tan(w) - r3 cos(x)sin(x)sin(y)
>    +
>                        2                             2
>        (r3 cos(y)sin(x)  - w cos(a)sin(x) + r3 cos(x) cos(y) + cos(x)cos(x3))
>     *
>        sin(y)
>    +
>                        2
>      (- r3 cos(x)cos(y)  - cos(x3)cos(y))sin(x) + w cos(a)cos(x)cos(y) + 5
>                                                     Type: Expression(Integer)
> (4) ->
> 
> 

and wrote:
> %I was not aware of this behaviour. However, I believe that fricas should not
> %automatically expand expressions that the user inputs. If this can be
> %modified then it would be very helpful.
> %Note that another public domain CAS called Maxima does not expand the above
> %expression. In addition, the user can perform the above simplification 
> %by using a built-in Maxima function called trigreduce().
> %Maybe fricas should consider having such a built-in function. This will 
> %only add to the strong points that it has.

A little additon: FriCAS actually have a function which works
like Maxima trigreduce(), namely expandTrigProducts:

(11) -> expandTrigProducts(cos(x1)*sin(y)-sin(x1)*cos(y))

   (11)  sin(y - x1)
                                                    Type: Expression(Integer)
(12) -> t1 := cos(x)*sin(y) - cos(y)*sin(x)

   (12)  cos(x)sin(y) - cos(y)sin(x)
                                                    Type: Expression(Integer)
(13) -> t2 := - sin(x)*sin(y) + cos(x)*cos(y)

   (13)  - sin(x)sin(y) + cos(x)cos(y)
                                                    Type: Expression(Integer)
(14) -> expr := tan(q)*tan(w) + t1*cos(x3) + t2*w*cos(a) + r3*t1*t2 + 5

   (14)
                                         2
     tan(q)tan(w) - r3 cos(x)sin(x)sin(y)
   + 
                       2                             2
       (r3 cos(y)sin(x)  - w cos(a)sin(x) + r3 cos(x) cos(y) + cos(x)cos(x3))
    *
       sin(y)
   + 
                       2
     (- r3 cos(x)cos(y)  - cos(x3)cos(y))sin(x) + w cos(a)cos(x)cos(y) + 5
                                                    Type: Expression(Integer)
(15) -> expandTrigProducts(expr)

   (15)
                                 2            2
       2tan(q)tan(w) + (r3 sin(x)  + r3 cos(x) )sin(2y) + sin(y + x3 - x)
     + 
                         2                              2
       - r3 sin(2x)sin(y)  + sin(y - x3 - x) - r3 cos(y) sin(2x)
     + 
       w cos(y + x + a) + w cos(y + x - a) + 10
  /
     2
                                                    Type: Expression(Integer)

Let me add that both Maxima trigreduce() and expandTrigProducts
works by _expanding_ products, namely:

(16) -> expandTrigProducts(sin(x)*cos(y))

         sin(y + x) - sin(y - x)
   (16)  -----------------------
                    2
                                                    Type: Expression(Integer)
(17) -> expandTrigProducts(sin(x)*cos(y)*sin(z))

         - cos(z + y + x) + cos(z + y - x) - cos(z - y + x) + cos(z - y - x)
   (17)  -------------------------------------------------------------------
                                          4
                                                    Type: Expression(Integer)

that is _each_ product is replaced, regardless if it leads
to simplification or not.

-- 
                              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].
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