On Wed, Mar 08, 2023 at 06:42:40PM -0800, 'Nasser M. Abbasi' via FriCAS - 
computer algebra system wrote:
> How does one tell Fricas to simplify sin(x)/cos(x) to tan(x)?
> 
> simplify(sin(x)/cos(x))  does not do the trick.
> 
> I noticed this when integrating 1/cos(x)^2 
> which should return tan(x) but Fricas returned sin(x)/cos(x) 
> (Ofcourse Fricas answer is correct), but tan(x) is simpler.
> 
> Should not this be an automatic simplification?

No.  Transformations of this sort are very undesirable when doing
computations which depend on structure of expressions.  Basicaly,
when such transformations fire in automatic way it is not
possible to usefuly predict form of final result.


During integration FriCAS tries as much as it can preserve structure
of user input.  This means using 'tan' in answer when user input
contains 'tan', using 'sin' and 'cos' when user input is in terms
of 'sin' and 'cos'.  Compare:

(3) -> integrate(1 + tan(x)^2, x)

   (3)  tan(x)
                                         Type: Union(Expression(Integer),...)

Note: FriCAS performs rather drastic transformations during
integration.  Without effort to preserve user input result
would look quite different.  And sometimes this preservation
effort fails.

> Mathematica does it without even calling Simplify.

In FriCAS we have:

(11) -> simplify(tan(x))

         sin(x)
   (11)  ------
         cos(x)
                                                    Type: Expression(Integer)

Many folks consider expression in terms of 'sin' and 'cos' simpler
than expression in terms of 'tan'.  If you are concerned only
with lone 'sin(x)/cos(x)', then rewrite rule can transform it
to 'tan'.  In general, it is easy to replace 'tan(x)' by
'sin(x)/cos(x)', but transformation in opposite direction
is more complicated.  Consider

(cos(x)^2*sin(x)+(6*cos(x)^3+cos(x)))/(sin(x)+2*cos(x)^3)

(which was obtained from '(7 + tan(x) + tan(x)^2)/(2 + tan(x) + tan(x)^3)').
In version 12 of Matematica Simplify and FullSimplify leave
this unchanged.  I am not sure if Matematica can not transform
this back to 'tan' form or maybe it considers version in terms
of 'sin' and 'cos' as simpler.

-- 
                              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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20230309123702.abbau6on7nugydf4%40fricas.math.uni.wroc.pl.

Reply via email to