[sympy] Re: behavior of asec()

2021-04-09 Thread 'B A' via sympy
My previous message can be ignored -- as Aaron pointed out (thank you!) this has been fixed, I was not using a recent-enough release. Sorry for the noise. Python 3.9.2 (default, Mar 31 2021, 11:25:52) [Clang 10.0.1 (clang-1001.0.46.4)] on darwin Type "help", "copyright", "credits" or "license"

Re: [sympy] Re: Simplifying expressions involving the Abs function

2021-04-01 Thread 'B A' via sympy
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 combi

[sympy] Re: Simplifying expressions involving the Abs function

2021-03-30 Thread 'B A' via sympy
Here is one solution that seems to work. To simplify Z I use Z.replace(Abs, MyAbs) with def MyAbs(x): x1=symbols('x1',real=True,positive=True) x1 = x.evalf(subs={a:0.573}) if x1 < 0.0: return S(-1)*x else: return x Is this a reasonable way to go, or are there gotc

[sympy] Re: Simplifying expressions involving the Abs function

2021-03-30 Thread &#x27;B A&#x27; via sympy
Could anyone suggest a solution for this? I can make a list of substitutions by hand (as below) and pass that to the .subs() method, but surely there is a better way. s_list={ Abs(a - 1) : S(1) - a, Abs(a - 2) : S(2) - a, Abs(2*a - 3) : S(3) - S(2)*a, Abs(a

[sympy] Simplifying expressions involving the Abs function

2021-03-28 Thread &#x27;B A&#x27; via sympy
I am a sympy beginner, and fairly new to python, so I suspect that my question has a simple answer, but have not been able to figure it out myself. I have sympy expressions containing the built-in Abs function. The arguments of Abs() are polynomials in a=symbol('a', real=True,positive=True) .