On Thu, 1 Apr 2021 at 15:43, 'B A' via sympy <sympy@googlegroups.com> wrote:
>
> What is described above has worked well for me.  But there is a further 
> simplification step that I need help with.
>
> I have some long expressions containing terms contain terms which look like 
> this example:
> sqrt(4*a**2 + 1)*sqrt(1/(4*a**6 - 15*a**4 + 12*a**2 + 4))
> How can I instruct sympy to combine such square roots and factor the 
> arguments? In this example that would lead to:
>
> sqrt(factor((4*a**2 + 1)/(4*a**6 - 15*a**4 + 12*a**2 + 4)))
> =
> 1/Abs(a**2 - 2)

You can declare a to be real:

In [12]: a = Symbol('a', real=True)

In [13]: expr = sqrt(factor((4*a**2 + 1)/(4*a**6 - 15*a**4 + 12*a**2 + 4)))

In [14]: expr
Out[14]:
   1
────────
│ 2    │
│a  - 2│


Oscar

-- 
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 sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxQsEEfwf82dD6Fv5aQZtf2gJKjM5%3DSJ%2BB53ZFHSb_t9jA%40mail.gmail.com.

Reply via email to