Re: [sympy] integrate tan(x) for real argument

2016-02-22 Thread Carsten Knoll
Thanks. Both variants are helpful! Carsten On 02/19/2016 08:23 PM, Aaron Meurer wrote: > It looks like the meijerg algorithm gives the better form: > > In [33]: integrate(tan(x), x, meijerg=True) > Out[33]: -log(cos(x)) > > Aaron Meurer > > On Fri, Feb 19, 2016 at 2:21 PM, Ondřej Čertík > wr

Re: [sympy] integrate tan(x) for real argument

2016-02-19 Thread Aaron Meurer
It looks like the meijerg algorithm gives the better form: In [33]: integrate(tan(x), x, meijerg=True) Out[33]: -log(cos(x)) Aaron Meurer On Fri, Feb 19, 2016 at 2:21 PM, Ondřej Čertík wrote: > On Fri, Feb 19, 2016 at 8:45 AM, Aaron Meurer wrote: >> trigsimp() will convert the sin to cos. To r

Re: [sympy] integrate tan(x) for real argument

2016-02-19 Thread Ondřej Čertík
On Fri, Feb 19, 2016 at 8:45 AM, Aaron Meurer wrote: > trigsimp() will convert the sin to cos. To remove the negative and > square, you'll have to use expand_log(force=True), which gives a > complex constant (which can be ignored, since this is an integral). > > It would definitely be better if in

Re: [sympy] integrate tan(x) for real argument

2016-02-19 Thread Aaron Meurer
trigsimp() will convert the sin to cos. To remove the negative and square, you'll have to use expand_log(force=True), which gives a complex constant (which can be ignored, since this is an integral). It would definitely be better if integrate at least gave log(1 - sin(x)**2) so that the result is

[sympy] integrate tan(x) for real argument

2016-02-19 Thread Carsten Knoll
I want to calculate the antiderivative for tan(x) In [4]: x = sp.Symbol('x', real=True) In [5]: sp.integrate(sp.tan(x), x) Out[5]: -log(sin(x)**2 - 1)/2 This result is technically correct, but I would (for didactic purposes) prefer something like -log(cos(x)). How can I achieve this? Thanks.