Does this explain what you are seeing?
>>> var('a')
a
>>> expr = 1/sqrt((sec(a)**2-1)**3);expr
1/sqrt((sec(a)**2 - 1)**3)
>>> expr.subs(sec(a)**2 - 1, tan(a)**2)
1/sqrt(tan(a)**6)
>>> var('a', positive=True)
a
>>> (1/sqrt((sec(a)**2-1)**3)).subs(sec(a)**2 - 1, tan(a)**2)
Abs(tan(a))/tan(a)**4
On Tuesday, December 9, 2014 9:13:21 PM UTC-6, Aaron Meurer wrote:
>
> This might be a bug.
>
> Aaron Meurer
>
> On Tue, Dec 9, 2014 at 12:20 PM, Paul Royik <[email protected]
> <javascript:>> wrote:
> > This is just an example.
> > In my program this is done as
> > expr = (sec(a)**2-1)**3
> > expr = 1/sympy.sqrt(expr)
> >
> > In general, I have more complicated expressions, so don't know when to
> > substitute.
> >
> >
> > On Tuesday, December 9, 2014 6:59:24 PM UTC+2, Chris Smith wrote:
> >>
> >> gotcha: 3/2 -> 0. Use S(3)/2 instead or Rational(3, 2)
> >>
> >> On Tuesday, December 9, 2014 6:22:00 AM UTC-6, Paul Royik wrote:
> >>>
> >>> from sympy import *
> >>> a = symbols('a',positive=True)
> >>> (1/(sec(a)**2-1)**(3/2)).subs(sec(a)**2-1,tan(a)**2)
> >>>
> >>> last statement should output something close to 1/tan^3(a), or
> >>> abs(tan(a))/tan^4(a)
> >>>
> >>> But instead it outputs something unrelated: abs(tan(a))/tan^2(a)
> >>>
> >>> Is this a bug or I'm missing something?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "sympy" 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 http://groups.google.com/group/sympy.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/sympy/081c2561-cb00-4092-800a-c2fa10cf06b1%40googlegroups.com.
>
>
> >
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"sympy" 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 http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/c20e2c6b-f507-4301-88a1-bea5d09ba619%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.