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

2021-03-30 Thread 'Bruce Allen' via sympy
Hi Aaron, This section of the tutorial may help to clear things up https://docs.sympy.org/latest/tutorial/gotchas.html. This blog post also goes into more detail about how variables work in Python https://nedbatchelder.com/text/names.html. Thanks for the pointers. I'll study them. What I

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

2021-03-30 Thread 'Bruce Allen' via sympy
Hi Aaron, Thanks for your help! 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 - Defining x1 as a symbol does nothing in this code, as you immediately overwrite it with

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

2021-03-30 Thread Oscar Benjamin
On Tue, 30 Mar 2021 at 16:39, 'B A' via sympy wrote: > > 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 >

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

2021-03-30 Thread Aaron Meurer
On Tue, Mar 30, 2021 at 9:39 AM 'B A' via sympy wrote: > > 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 >

Re: [sympy] ODE solver roadmap

2021-03-30 Thread Naveen Saisreenivas Thota
Hi Nijso, I've made some changes to the code - split it up into functions and added all the Riccati ODEs with Rational Solution from the report . The present code can solve all the ODEs, but not completely in the

[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

[sympy] Re: Simplifying expressions involving the Abs function

2021-03-30 Thread Chris Smith
This is a case where you know the magnitude of a is less than 1 so for all the cases where you are working with constants in the integer range, replaceing `a` with a symbolic `1/2` will do the work for you. (Even stating that `a` is positive will work for several cases.) ``` >>> a =

[sympy] Re: Simplifying expressions involving the Abs function

2021-03-30 Thread 'B A' 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,

[sympy] GSOC Proposal Discuss: Improve limits by finding limits for piecewise functions

2021-03-30 Thread Anh Nguyen Phung
Hi everyone, My name is Anh Nguyen Phung. I am a sophomore at The University of Arizona double major in Computer Science and Mathematics. I am currently interested in contributing to the subproject improving limits in the project series expansion. I am thinking about the idea of my proposal is

Re: [sympy] ODE solver roadmap

2021-03-30 Thread nijso.be...@gmail.com
Hi Naveen, This ODE comes from Banks, Gundersen, Laine: Meromorphic Solutions of the Riccati Differential Equation (example 4.2 http://www.acadsci.fi/mathematica/Vol06/vol06pp369-398.pdf) ode = y(x).diff(x) - y(x)**2 - 21/2 + 9/4*x**2 Your current implementation fails to find the solution

Re: [sympy] ODE solver roadmap

2021-03-30 Thread nijso.be...@gmail.com
By the way, Naveen, could you create a repository for your work? It will be easier to work with. Best regards, Nijso On Tuesday, 30 March 2021 at 09:48:48 UTC+2 nijso.be...@gmail.com wrote: > Hi Naveen, Oscar, > I agree with Oscar that there is still much work to be done, even having > 'only'

Re: [sympy] ODE solver roadmap

2021-03-30 Thread nijso.be...@gmail.com
Hi Naveen, Oscar, I agree with Oscar that there is still much work to be done, even having 'only' the rational Riccati solver implemented and tested is still a lot of work, after all you have to implement and test all subcases (movable poles, fixed poles, poles at infinity). And the solver

Re: [sympy] ODE solver roadmap

2021-03-30 Thread Naveen Saisreenivas Thota
Hi Oscar, Should we add all the ODEs of Kamke and Murphy or only Riccati ODEs? In either case, how do we plan on parsing the solution from Maple/Mathematica? I could see that there is a Mathematica Parser, but even that seems to be very basic and is not parsing some complex expressions.