Re: [sympy] AlphaGeometry and future of symbolic computation

2024-08-23 Thread Chris Smith
Area method: https://github.com/sympy/sympy/issues/22160 Angle method: https://github.com/sympy/sympy/issues/22644 /c On Friday, August 23, 2024 at 6:24:36 PM UTC-5 Oscar wrote: > On Fri, 23 Aug 2024 at 23:29, Sangyub Lee wrote: > > > > To be more productive, SymPy itself can enhance its geome

Re: [sympy] Re: Smith Form Decomposition

2024-08-17 Thread Chris Smith
lowing the algorithms based on that > > On Friday, August 16, 2024 at 4:44:45 PM UTC+2 Oscar wrote: > >> It would be good to have this in SymPy but unfortunately it is not >> implemented yet. >> >> It is also not available in python-flint or Flint eit

[sympy] Re: Smith Form Decomposition

2024-08-16 Thread Chris Smith
As far as I can tell, these matrices are not computed implicitly. You would have to copy the appropriate actions onto an augmented identity matrix to see what has happened (https://www.youtube.com/watch?v=UhyzLfiO4Ow). /c On Thursday, August 15, 2024 at 10:51:31 AM UTC-5 bulk...@gmail.com wrote

Re: [sympy] Replace first occurrence in expression

2024-08-13 Thread Chris Smith
Though you solved your issue, you might also want to be aware of the tools in core/traversal -- ne of the preorder_traversal or postorder_traversal tools allows you to exit after the first occurrance -- and simplify/epath. /c On Friday, August 2, 2024 at 2:48:11 PM UTC-5 thomas...@gmail.com

Re: [sympy] Unable to solve the following set of equations

2024-05-28 Thread Chris Smith
`nsolve(eqs,list(ordered(eqs.free_symbols)),(.4,3,10))` (with eqs defined with x1= 0,y1=10, x2=10, y2=10, length = 20) gives `Matrix([[0.326920231236118], [-3.26920231236118], [10.0]])` I doubt there is a closed form solution. You can easily solve the first two equations for `a`

Re: [sympy] Re: Real-Root Isolation

2024-05-22 Thread Chris Smith
You might try def distinct_intervals(p): P=Poly(p) iv = P.intervals() print(iv) for i in range(len(iv)-1): (lo,hi),n=iv[i] (LO,HI),N=iv[i+1] while hi==LO: if lo!=hi: (lo,hi),n=iv[i]=P.refine_root(lo,hi,(hi-lo)/2),n else: assert LO!=HI (LO,HI),N=iv[i+1]=P.refine_root(LO,HI,(HI-LO)/2),N return i

[sympy] Re: Apply factor to subexpressions

2024-05-21 Thread Chris Smith
xpression with all subexpressions factored. """ if isinstance(expr, sp.Add): return sp.Add(*[arg.factor() for arg in expr.args]) elif isinstance(expr, sp.Mul): return sp.Mul(*[arg.factor() for arg in expr.args]) else: return sp.factor(expr) ​ On Tuesday, May 21, 2024 at 10:30

[sympy] Re: Apply factor to subexpressions

2024-05-21 Thread Chris Smith
I would use expr.factor(deep=True) and if that didn’t work, then expr.replace(lambda x: x.is_Mul or x.is_Add, lambda x: x.factor()). Regarding formatting in Google groups, see here where the rec

[sympy] Re: Real-Root Isolation

2024-05-21 Thread Chris Smith
I strongly suspect that the roots returned by `Poly.intervals` have only one root in them (by definition). If you use `refine_root(lo,hi,eps)` to refine the root bounds to arbitrary width and give it an interval in which there is more than one root, it will raise an error. /c On Tuesday, May 2

Re: [sympy] Area of circle by integration

2024-04-23 Thread Chris Smith
Your second arg is being interpreted as a flag for the `integrate` routine. You should not be telling it the integration variable via second arg when you have a limits: ```python integrate(y,x) -> x*sqrt(1 - x**2)/2 + asin(x)/2 integrate(y,(x,1) -> pi/4 integrate(y,(x,0,1)) -> pi/4 ``` /c On Tu

[sympy] live.sympy.org

2024-04-09 Thread Chris Smith
Lately, the live.sympy.org page never finishes loading for me. Does anyone know why this might be? /c -- 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..

[sympy] allowing Eq as recognized subs argument?

2024-03-27 Thread Chris Smith
In https://github.com/sympy/sympy/pull/26399 there is proposal to allow `subs` to recognize `Eq` so ` x.subs(x, 1) = x.subs( Eq(x, 1) ) = x.subs( [ Eq(x, 1) ] ) = 1` but `x.subs(Eq(1, x)) = x`. It would be good to see if there is any strong senitment and rationale for or against this. In favor

[sympy] Re: Contributing

2024-03-21 Thread Chris Smith
Check out the contribution guidelines at https://docs.sympy.org/latest/contributing/index.html For development, workflow check out https://github.com/sympy/sympy/wiki/Development-workflow. Browse through GitHub issues to find out issues labeled "easy to fix". /c On Thursday, March 21, 2024 at

Re: [sympy] Re: How to avoid distributing a constant factor after differentiation?

2024-02-28 Thread Chris Smith
eb 26, 2024 at 1:54 PM Chris Smith wrote: > > > > It seems that the tests could be marked as passing for both forms to see > where tests fail because a routine is broken. Broken routines could be > fixed (as necessary) so they are not assuming distribution. Would the > decorat

Re: [sympy] Re: How to avoid distributing a constant factor after differentiation?

2024-02-26 Thread Chris Smith
pen anyway, as even currently > automatic distribution is not guaranteed. For example, it doesn't > happen with 2*x*(x + y). And it's not uncommon to have un-distributed > expressions because functions like factor() create them. > > Aaron Meurer > > On Thu, Feb 22, 2024 at 2:15 

Re: [sympy] Re: How to avoid distributing a constant factor after differentiation?

2024-02-22 Thread Chris Smith
, February 21, 2024 at 6:07:35 PM UTC-6 Aaron Meurer wrote: > On Wed, Feb 21, 2024 at 4:09 PM Chris Smith wrote: > > > > > There is a distribute() context manager > > > > I had forgotten about that, thanks for the reminder! > > We probably shouldn't advertise it t

Re: [sympy] Re: How to avoid distributing a constant factor after differentiation?

2024-02-21 Thread Chris Smith
y the better solution. There's really no guarantees about what > the form of an expression from diff() will look like. > > Aaron Meurer > > On Sun, Feb 18, 2024 at 12:10 PM Chris Smith wrote: > > > > Autodistribution of Number into an Add is how SymPy works and there is

[sympy] Re: How to avoid distributing a constant factor after differentiation?

2024-02-18 Thread Chris Smith
Autodistribution of Number into an Add is how SymPy works and there is no flag for differentiation (or for many functions) that would prevent it. Simply pass the expression to `factor_terms` to get it cleaned up. (But that will extract a factor of `t-t0`, too, which you might not want so you co

[sympy] solving

2023-11-18 Thread Chris Smith
There is a fairly recent (2021) paper about a method for solving "complex systems of linear equations" and they show that it fares well in comparison to a matlab routine `mldivide`. I'm not sure it there is anything in the method that might benefit any of the routines that we use. Perhaps this i

Re: [sympy] Re: Are all sympy Floats rational?

2023-11-04 Thread Chris Smith
The `is_rational` flag can be used by the assumption system to make inferences about properties. Currently it is failing to allow `Eq(i/2, 0.5)` to be true (for integer `i`) because the rational lhs has a non-rational rhs. Yet, `Eq(S.Half, 0.5)` evaluates to True. So either we should make the l

[sympy] Re: Expressing exponents as fractions (not decimals)

2023-10-27 Thread Chris Smith
Enter the exponent as `(S(1)/4)` or the power as `root(m*w, 4)`. /c On Thursday, October 26, 2023 at 9:16:53 PM UTC-5 sonn...@gmail.com wrote: > In this simple string below, the result is a decimal. I have fooled a lot > with the documentation but cannot see how to get my output as fractions >

Re: [sympy] Trouble with a simple trig equation and solveset

2023-10-06 Thread Chris Smith
https://github.com/sympy/sympy/issues/25768 On Thursday, October 5, 2023 at 11:07:53 AM UTC-5 Oscar wrote: > This is a bug. Can you open an issue with sympy on GitHub? > > The correct answer is given if you use exact rational numbers (S(1)/2 > or Rational(1, 2)) rather than the float 1/2: > > In

[sympy] odd testing failure report

2023-09-30 Thread Chris Smith
Has anyone else noticed a discrepancy between what is reported in a test run report and what is actually wrong in the code? Here is the report for doctests from #25726 hash ef34167 . ``` __

[sympy] [RFC] Subs as container for parametric expressions

2023-09-22 Thread Chris Smith
When SymPy returns an expression and needs to include a parameter, this presents some api challenges because in order for the use to use it in a `subs` call the user must know what the variable is. So sometimes we give the user the option to select the parameter or use a default symbol in the e

Re: [sympy] Re: looking for a numerical expression to fail this test

2023-09-22 Thread Chris Smith
the thing that causes > SymPy to hang on very simple things that should return instantly (see > https://github.com/sympy/sympy/issues/10800 for another example of > this). We need to move to a model where evalf is never called > automatically, except for cases where it is known that it will

[sympy] Re: looking for a numerical expression to fail this test

2023-09-19 Thread Chris Smith
`eq=(cos(2)**2+sin(2)**2-1/S(10**120))` rounds to 1 but neither `eq<1` nor `eq>1` evaluates but the correct value for `int(eq)` is 0. /c On Tuesday, September 19, 2023 at 8:14:35 AM UTC-5 Chris Smith wrote: > Given > ``` > def f(self): > from sympy.core.numbers import

[sympy] looking for a numerical expression to fail this test

2023-09-19 Thread Chris Smith
Given ``` def f(self): from sympy.core.numbers import int_valued r = self.round(2) i = int(r) if int_valued(r): # non-integer self should pass one of these tests if (self > i) is S.true: return i if (self < i) is S.true: return i - 1

[sympy] Re: SymPy running on Mobile platform (as Math Solver)

2023-09-14 Thread Chris Smith
I was able to use the link you gave at the github site to find the app, otherwise I could not find it by name. It's interesting to see what can be done on just a phone. I like that it tries to present the output in a useful manner, e.g. factored or solutions if an "=" is included. Getting a qui

Re: [sympy] Solving Linear Programming Problem in SymPy

2023-09-05 Thread Chris Smith
There are now functions for doing linear programming in the `simplex.py`. Here is a similar question at SO with answer: https://stackoverflow.com/a/77045152/1089161 /c On Tuesday, September 5, 2023 at 2:40:49 AM UTC-5 geo...@gmail.com wrote: > Does Sympy have a backend to interface with Pyomo?

[sympy] need eyes on PR#25614

2023-09-05 Thread Chris Smith
If this PR is added, number comparisons will be consistent with expr behavior in terms of equality: `x**2 != x**2.0` and (new change) `Integer(2) != Float(2)`. In addition there will no longer be a `Float(0)` -- it will collapse to `S(0)`. I really need input on whether this is going to work, e

[sympy] Re: Unexpanded coefficients of a polynomial

2023-04-27 Thread Chris Smith
The things you call "coefficients" are called "terms" of the sum. If you know you have a sum then `eq.args` will give you the terms. If the equation might have a single term then `Add.make_args(eq)` will give you 1 or more terms. /c On Thursday, April 27, 2023 at 12:02:33 PM UTC-5 distan...@gm

Re: [sympy] Enabling precommit.ci to fix common PR problems automatically

2023-03-31 Thread Chris Smith
I like the idea of the following With https://github.com/sympy/sympy/pull/24908 you can pip install pre-commit and then any time you want to run the precommit checks you just run: $ pre-commit flake8...Passed ruff

Re: [sympy] Re: ChatGPT and SymPy

2023-03-30 Thread Chris Smith
Use with caution -- the set-up can be right and the answer wrong as in: What is the norm of vector (1/2, 1, 1)? The norm of a vector is defined as the length or magnitude of the vector. The norm of a vector v = (v1, v2, ..., vn) is given by the formula: ||v|| = sqrt(v1^2 + v2^2 + ... + vn^2) S

Re: [sympy] Re: Summing calls to undefined functions

2023-03-24 Thread Chris Smith
>>> sum(f(i) for i in range(3)) == Sum(f(i), (i,0,2)).doit() == f(0) + f(1) + f(2) True On Friday, March 24, 2023 at 3:31:32 AM UTC-5 da...@dbailey.co.uk wrote: > On 24/03/2023 02:25, Chris Smith wrote: > > David, please start a new thread (and try IndexedBase instead of &g

[sympy] Re: Summing calls to undefined functions

2023-03-23 Thread Chris Smith
David, please start a new thread (and try IndexedBase instead of Function and use [] instead of ()). WRT CHATGPT: talk with it for a while trying to get it to compute the norm of (1/2, 1, 1). When you tell it not to skip steps it can get it right, but it is hard to get it to give you the correc

Re: [sympy] Self Introductory and Gröebner Bases

2023-03-18 Thread Chris Smith
There is some preliminary work at https://github.com/sympy/sympy/issues/23665 that aims to improve exponentiation of certain types of polynomials. It might be a good GSOC task. /c On Saturday, March 18, 2023 at 9:18:10 PM UTC-5 Chris Smith wrote: > update: When reviewing this it is not cl

Re: [sympy] Self Introductory and Gröebner Bases

2023-03-18 Thread Chris Smith
update: When reviewing this it is not clear to me how much of this already made it in in some form or another. Look for PRs be author:pernici that were committed. Search also for lpoly. /c On Saturday, March 18, 2023 at 11:57:58 AM UTC-5 Chris Smith wrote: > There was some promising work

Re: [sympy] Self Introductory and Gröebner Bases

2023-03-18 Thread Chris Smith
There was some promising work (as I recall) that stalled at https://github.com/sympy/sympy/pull/609. See discussion there for idea to get that work from level 0 representation of Poly to level 1. /c On Friday, March 17, 2023 at 8:16:48 PM UTC-5 Oscar wrote: > On Fri, 17 Mar 2023 at 20:39, Aaro

Re: [sympy] Re: Sympy doesn't simplify expression

2023-03-17 Thread Chris Smith
I opened issue #24928 for this. /c On Friday, March 17, 2023 at 1:16:01 PM UTC-5 antonv...@gmail.com wrote: > Sympy 1.6 is an old version. > How to fix these errors? What is the mechanism? I need to open an issue on > github? > > пятница, 17 марта 2023 г. в 05:24:23 UTC+3, souvikchak...@gmail.c

[sympy] Re: Sympy doesn't simplify expression

2023-03-16 Thread Chris Smith
I get a worse result: >>> simplify(asinh(2)+sqrt(5)-oo) 0 >>> simplify(asinh(2)+sqrt(5)+oo) oo On Sunday, March 12, 2023 at 6:55:50 AM UTC-5 antonv...@gmail.com wrote: > Hi, i have an expression: > expr = sympify("asinh(2)+sqrt(5)-oo") > When i try to simplify this expression: > expr_simplified

[sympy] Re: Introduction for GSOC'23

2023-03-11 Thread Chris Smith
please see https://github.com/sympy/sympy/wiki/Introduction-to-contributing On Saturday, March 11, 2023 at 1:38:11 AM UTC-6 suja...@gmail.com wrote: > Hey! I hope @everyone is doing awesome > > I'm Sujant, a 3rd year engineering student at National Institute of > Technology Surathkal, India. I r

[sympy] Re: problem trying to solve an equation

2023-03-06 Thread Chris Smith
An answer is given in https://github.com/sympy/sympy/issues/24824 On Sunday, March 5, 2023 at 1:26:50 PM UTC-6 toaff...@gmail.com wrote: > I think you should simplifythe equation and reduce the computational > complexity as much as possible. It may also be helpful to check the > implementatio

Re: [sympy] sort expression for power series

2023-03-06 Thread Chris Smith
oeff, t in (term.as_coeff_Mul() for term in expList)] On Monday, March 6, 2023 at 9:08:45 PM UTC-6 Chris Smith wrote: > I thought I would try this in ChatGPT since one of the answers sounded > gpt-ish. Quite surprised by the results in terms of level of detail about > what is going on in the routine t

Re: [sympy] sort expression for power series

2023-03-06 Thread Chris Smith
I thought I would try this in ChatGPT since one of the answers sounded gpt-ish. Quite surprised by the results in terms of level of detail about what is going on in the routine that it presented. I marked the line that was needed to make the function of the gpt-answer work: def printSeries(

[sympy] Re: factoring square roots

2023-02-24 Thread Chris Smith
cf https://github.com/sympy/sympy/pull/23936 On Friday, February 24, 2023 at 3:58:37 AM UTC-6 atharv@gmail.com wrote: > Lack of ability to factor out square roots seems to be a particular cause > for simplification issues like #23641 > . For exam

[sympy] Re: factoring square roots

2023-02-24 Thread Chris Smith
This sort of problem can be solved by identifying the generator with the smallest power. In this case `g = x**1/2` so `sqrt(x) + x -> y + y**2` which factors as `y*(1 + y) -> sqrt(x)*(1 + sqrt(x))`. /c On Friday, February 24, 2023 at 3:58:37 AM UTC-6 atharv@gmail.com wrote: > Lack of abili

[sympy] negative-weight single source shortest paths in near-linear time

2023-01-19 Thread Chris Smith
Just read about https://arxiv.org/abs/2203.03456 in Quanta artical https://www.quantamagazine.org/finally-a-fast-algorithm-for-shortest-paths-on-negative-graphs-20230118/. One of the algorithms used in the solution computes a low-diameter decomposition of the graph, identifying groups of nodes

[sympy] Re: Regarding contributing to sympy

2023-01-04 Thread Chris Smith
Welcome, Devi. Please see https://github.com/sympy/sympy/wiki/Introduction-to-contributing . If you have questions, you can ask them here or on [gitter](https://gitter.im/sympy/sympy). /c On Wednesday, January 4, 2023 at 1:25:09 PM UTC-6 sanik...@gmail.com wrote: > hello everyone, > Hello ev

Re: [sympy] curvilinear coordinates

2022-12-22 Thread Chris Smith
If you want to ignore `Abs`, replace it: `expr.replace(Abs, Id)` /c On Wednesday, December 21, 2022 at 10:13:22 PM UTC-6 arthur...@gmail.com wrote: > Staffan, > > Just a guess, but sin(phi) goes negative even for positive values of phi. > You’d have limit the range to 0 <= phi <= pi. > > — A

Re: [sympy] Re: ChatGPT and SymPy

2022-12-17 Thread Chris Smith
In reviewing a PR related to units, I found ChatGPT to get correct the idea that a foot is bigger than an inch, but it said that a volt is bigger than a statvolt (see quoted GPT response [here](https://github.com/sympy/sympy/pull/24325#issuecomment-1354343306)). /c On Thursday, December 15, 20

[sympy] Re: can't solve equation

2022-12-05 Thread Chris Smith
Although I am not sure why `solve` doesn't do so automatically, you can find the solutions for `e` and `f` by sending only the pertinent expressions to `solve`: solve([ (g + (g - 1)*exp(a*e)*exp(b*f))*(exp(c*e)*exp(d*f) + 1) , (h + (h - 1)*exp(c*e)*exp(d*f))*(exp(a*e)*exp(b*f) + 1)], e, f) [(lo

Re: [sympy] Displaying quantities in SI base units

2022-11-29 Thread Chris Smith
I referenced this discussion in https://github.com/sympy/sympy/issues/23022 /c On Monday, November 28, 2022 at 4:51:07 PM UTC-6 gu...@uwosh.edu wrote: > Teo, > > My solution is to treat units as positive valued symbols and skip the > units tool in sympy. Then you just define things in the set o

Re: [sympy] Simple methods for row operations

2022-11-05 Thread Chris Smith
See also 'elementary_row_op' and consider storing the string hints as 'mul, swap, add' and redefine (for typing convenience) the method as `do`: mul = "n->kn" swap = "n<->m" add = "n->n+km" Matrix.do = Matrix.elementary_row_op e=eye(3) assert e.do(mul, 0, 5) == Matrix([[5, 0, 0], [0, 1, 0], [0, 0

Re: [sympy] refine with multiple variables

2022-11-04 Thread Chris Smith
For simple domains like this, the old assumptions work. Just define `var('z w', positive=True)` and then the inequalities evaluate. You might try AccumBounds for more complicated expressions B = AccumBounds (z**2 - w**2).subs(z,B(0,1)).subs(w,B(0,2)) AccumBounds(-4,1) /c On Thursday, November

Re: [sympy] Simple methods for row operations

2022-11-04 Thread Chris Smith
Instead of redefining the class, why not use Python's ability to modify the class directly. Use the built-in `row_op` in the sugar you wish to add: >>> row_add = lambda M,i,j,m=1: M.row_op(i,lambda v,k: v+m*M[j,k]) >>> Matrix.row_add = row_add >>> N = eye(3) >>> N.row_add(0,1); N

[sympy] Re: Method of Picard's successive iterations

2022-10-22 Thread Chris Smith
see also https://github.com/sympy/sympy/pull/20040 /c On Friday, October 14, 2022 at 10:17:47 AM UTC-5 Chris Smith wrote: > I am not aware of any existing function that does this automatically. > > /c > > On Friday, October 14, 2022 at 2:23:14 AM UTC-5 ishan90...@gmail.com

[sympy] Re: Method of Picard's successive iterations

2022-10-14 Thread Chris Smith
I am not aware of any existing function that does this automatically. /c On Friday, October 14, 2022 at 2:23:14 AM UTC-5 ishan90...@gmail.com wrote: > I tried implementing Picard's successive iterations for some given number > of iterations using sympy. I was wondering if there is a function >

Re: [sympy] get sqrt to work

2022-09-03 Thread Chris Smith
+989102116325 <+98%20910%20211%206325> > and at > z.kari...@gmail.com > 🌧️🌍🌱 > > On Fri, 2 Sep 2022, 16:31 Chris Smith, wrote: > >> You can replace any function with any other using `subs`, so just replace >

Re: [sympy] get sqrt to work

2022-09-02 Thread Chris Smith
Account @zohrehkarimzad1 > +989102116325 <+98%20910%20211%206325> > > Value Water))) > > On Fri, Sep 2, 2022 at 1:55 AM Chris Smith wrote: > >> This is somewhat painful to read

Re: [sympy] get sqrt to work

2022-09-01 Thread Chris Smith
This is somewhat painful to read because none of the code snippets are formatted as Python code. If possible, please post working code snippets. As to using string or SymPy (and then converting to string): I prefer the latter because you get automatic syntax checking and a good visual of the ob

Re: [sympy] get sqrt to work

2022-08-19 Thread Chris Smith
If you are trying to fit data, see the recent post about Trendy which might already do what you are trying to do. Or maybe you could look and see how lambdify is used in that project. Trendy announcement /c On Friday, August 19, 2022 at 10:11:2

Re: [sympy] Solving set of inequalities

2022-08-15 Thread Chris Smith
ational_inequalities([[x*5 + y*2 > +z*3=5,x*2-y-z>5,x <= 1, x >= 0, y <= 1, y >= 0,z <= 1, z >= 0]], [x,y,z])) > > I see no obvious way to apply your method to a set of multiple equations, > but > it might due to my lack of experience with linear programming. &

[sympy] Re: f string used to make symbols

2022-08-13 Thread Chris Smith
`var` will inject the symbols into the namespace. But you could also use parse_expr and pass it a dictionary with the symbols to use: from sympy import parse_expr, symbols, var v = ['xa', 'xb'] xa, xb = map(var, v) ok = xa*xb better = parse_expr('xa*xb', local_dict=dict(zip(v, symbols(v Chr

Re: [sympy] Solving set of inequalities

2022-08-10 Thread Chris Smith
You can't enter your expressions with `=` to create and Equality. You would have to reenter as Eq(5*x+2*y,10) or `parse_expr('5*x+2*y=10',transformations=T[1,9]')` (see [here](https://stackoverflow.com/a/73307040/1089161)). Past that, there is no SymPy function that will solve this, but in PR

Re: [sympy] Re: solve doesn't return when solving a simultaneous equation

2022-08-06 Thread Chris Smith
ugust 5, 2022 at 4:50:09 PM UTC-7 Oscar wrote: >>>>> >>>>> I just had a quick look and I think that maybe this has a >>>>> positive >>>>> >>>>> dimensional solution set. >>>>> >>>>> >>

[sympy] Re: solve doesn't return when solving a simultaneous equation

2022-08-05 Thread Chris Smith
If you remove the radicals (`sympy.solvers.solvers.unrad(eq1)`) and replace `Q1` and `Q2` with `x` and `y` and `Q_dp_1` with a and `s1` with `b` you will get an expression that is of degree 4 in every variable and can be split into a term with `a` and `b` and a term with only `b` -- both with `

[sympy] Re: padepy

2022-08-02 Thread Chris Smith
Thanks for sharing this link. It might be good to add this to the "projects that use SymPy" page (https://www.sympy.org/en/). /c On Sunday, July 31, 2022 at 10:40:17 AM UTC-5 rafael...@gmail.com wrote: > Hello > > padepy is a Python library for Padé approximation calculation with > infinite (a

[sympy] Re: Reduced density matrix

2022-08-02 Thread Chris Smith
A search of SymPy *.py files for "reduced density" gives a hit in method `_reduced_density` which is called from the private method `Qubit._eval_trace` which is called by `Trace(qubit).doit()`. Does that get you any closer to a solution? Chris /c On Sunday, July 31, 2022 at 1:36:47 AM UTC-5 hm

[sympy] Re: How to get started with Contributions

2022-07-21 Thread Chris Smith
Hi Vaani, You might start here, https://www.sympy.org/en/development.html /c On Sunday, July 17, 2022 at 2:00:01 PM UTC-5 vaanipa...@gmail.com wrote: > Respected sir/madam, > I am Vaani Pathariya ,a Computer Science undergrad.I will be entering my > second year of college at JSSATE Noida. I am

Re: [sympy] more unified (and usable) solve output

2022-07-08 Thread Chris Smith
return __solve(a, **c, dict=True) The first step in removing the automatic identification of undetetermined coefficient systems in implemented in PR #23699: a flag can disable this detection so an algebraic result is returned. /c On Monday, July 4, 2022 at 10:41:11 PM UTC-5 Chris

Re: [sympy] RFC on solve being used to solve for undetermined coefficients

2022-07-01 Thread Chris Smith
A deprecation is possible. Here is a potential docstring addition: ** Automatic detection of undetermined coefficients** When solving a single equation that is not passed in a list and is passed with more than 1 variable for which to solve a check is made to see whether the equation and variabl

Re: [sympy] RFC on solve being used to solve for undetermined coefficients

2022-06-30 Thread Chris Smith
" bit. I would say it > should be deprecated, although if there are other kinds of cleanups > that can be done with solve, it might make sense to do them all > together (but this could be a big project). > > Aaron Meurer > > On Thu, Jun 30, 2022 at 6:39 PM Chris Smith

[sympy] RFC on solve being used to solve for undetermined coefficients

2022-06-30 Thread Chris Smith
Nearly from the beginning, `solve` has recognized the `undetermined coefficients` case wherein a single equation is solved for a set of symbols which will simultaneously set it equal to zero. This is different than the normal use of `solve`, however, and might be considered a bug or feature. As

Re: [sympy] New SymPy shell based on JupyterLite and Pyodide

2022-05-14 Thread Chris Smith
Ivan, this is really nice! Thanks. /c On Wednesday, May 11, 2022 at 3:21:07 PM UTC-5 Aaron Meurer wrote: > You can run JupyterLite with a full blown Jupyter Lab here > https://jupyterlite.readthedocs.io/en/latest/_static/lab/index.html. > It includes SymPy. It seems to offer persistence. It's no

Re: [sympy] Re: Improving SymPy's Solvers Documentation: GSoD'22

2022-05-06 Thread Chris Smith
I enjoyed reading the analysis and appreciate the sentiment expressed: "to document commonly-requested types of "solving" regardless of the SymPy function best suited to the task." Looking forward to seeing the work progress. /c On Thursday, May 5, 2022 at 7:28:56 PM UTC-5 Jeremy Monat wrote:

Re: [sympy] Re: SymPy documentation website down

2022-04-21 Thread Chris Smith
Having had a similar experience before the most frustrating aspect of this is the lack of actionable material in the accusation. If I am reading correctly, "There is a problem. We can't tell you what it is. You need to shut down your site." It would be nice if github would not require a change

[sympy] Re: sympy exception invalid input mod

2022-04-20 Thread Chris Smith
> I can't see why something that should work the same every time suddenly fails with an exception Since you don't pass variables to the function, it's return value will depend on the value of those variables in the calling context ``` def f(): return i >>> for i in range(2): f() ... 0 1

Re: [sympy] Keeping expressions short and concise

2022-04-20 Thread Chris Smith
> assumes that all symbols that do not have an explicit dependence on the variable of differentiation are constants `idiff` will allow you to do the differentiation of symbols without functions, e.g. `dydx for idiff(2*x - y**2, y, x) -> 1/y` /c On Wednesday, April 20, 2022 at 7:37:33 AM UTC-5

[sympy] Re: SymPy vector error

2022-03-29 Thread Chris Smith
These two imports do not cause me a problem in the current development version. /c On Tuesday, March 29, 2022 at 5:48:37 PM UTC-5 cing...@gmail.com wrote: > Hey guys, when i add interesting vector import my code, i display that > error : *TypeError: unsupported operand type(s) for +=: 'NoneTyp

Re: [sympy] Release 0.9.1 of Algebra-with-Sympy package...

2022-03-25 Thread Chris Smith
Jonathan, I left a comment at https://github.com/sympy/SymPEPs/pull/1#issuecomment-1078989487 about a possible way to think about Eqn (or something similar) that may help to relax concerns about mathematical correctness. /c On Friday, March 25, 2022 at 7:22:26 AM UTC-5 gu...@uwosh.edu wrote:

Re: [sympy] more unified (and usable) solve output

2022-03-24 Thread Chris Smith
Is there an example of when a parameter other than an integer would be necessary? /c On Thursday, March 24, 2022 at 2:21:07 PM UTC-5 Aaron Meurer wrote: > On Wed, Mar 23, 2022 at 5:52 PM Chris Smith wrote: > > > > Except for booleans, consider single and system output: >

Re: [sympy] more unified (and usable) solve output

2022-03-23 Thread Chris Smith
Except for booleans, consider single and system output: If it is a single equation the output depends on whether symbols are given or not: * list of expressions if a single variable is given (or the expression is univariate and no symbol is given) * if multiple variables are given and the syste

Re: [sympy] musings about roots of expressions

2022-03-19 Thread Chris Smith
Cancellation of terms will cause that routine trouble. On Friday, March 18, 2022 at 8:46:25 AM UTC-5 Chris Smith wrote: > > why do you need an alternative to factoring > > I want to separate variables in an expression. It is not important the > factors be factored since each

Re: [sympy] musings about roots of expressions

2022-03-18 Thread Chris Smith
ot e.is_Add: return e i, d = e.as_independent(Add) if not d: return e return factor_terms(i) + d n, d = [factor_terms(bottom_up(i, do)) for i in e.as_numer_denom()] return factor_terms(signsimp(n/d)) On Wednesday, March 16, 2022 at 5:35:16 PM U

[sympy] Re: musings about roots of expressions

2022-03-12 Thread Chris Smith
://byjus.com/maths/factoring-polynomials/ On Friday, March 11, 2022 at 5:13:35 PM UTC-6 Chris Smith wrote: > Given two expressions, `p` and `q` > > p = x*y + x + y*z > q = p + z > > it is easy to show that `q = (x + z)*(y + 1)`. But I'm wanting to avoid > factoring but wo

[sympy] musings about roots of expressions

2022-03-11 Thread Chris Smith
Given two expressions, `p` and `q` p = x*y + x + y*z q = p + z it is easy to show that `q = (x + z)*(y + 1)`. But I'm wanting to avoid factoring but would like to know whether a solution for `x` from `p = 0` or `q = 0` is a factor or not. For `q`, the root `x = -z` represent a simple factor wh

[sympy] Re: Modifying a part of the expression tree

2022-03-11 Thread Chris Smith
This is what `epath` is made for, I believe. I have not spent enough time with it to provide much help, however -- only a pointer. /c On Friday, March 11, 2022 at 11:32:41 AM UTC-6 octe...@gmail.com wrote: > > Hello, > I would like to modify a part of an expression so as to obtain: > `EXPR.args

Re: [sympy] more unified (and usable) solve output

2022-03-09 Thread Chris Smith
> in their APIs that mean we still just want to make a new solve > function that isn't compatible with any of the existing ones. > > > On Fri, Mar 4, 2022 at 8:27 AM Oscar Benjamin > > wrote: > > > > > > On Fri, 4 Mar 2022 at 14:57, Chris Smith wrote:

[sympy] git add -p not working

2022-03-07 Thread Chris Smith
Has anyone ever resolved an issue where the git command `git add -p` just hangs and does nothing? The only thing I notice is that when I ctrl-C to get back to the prompt, the intensity of the prompt is higher. /c -- You received this message because you are subscribed to the Google Groups "sy

Re: [sympy] more unified (and usable) solve output

2022-03-05 Thread Chris Smith
One sort of "Solution" structure that could be used is something like this: Solution({a: [-1, 1], x: [2 + y], y: [4, 5]}) This structure could be iterated with backsubstitution done in JIT manner: [{a:-1, x:6, y:4}, ... /c On Saturday, March 5, 2022 at 10:35:10 AM UTC-6 Chris S

Re: [sympy] more unified (and usable) solve output

2022-03-05 Thread Chris Smith
would be good to have a working replacement ready before we do any > renaming. > > On Fri, Mar 4, 2022 at 8:27 AM Oscar Benjamin > wrote: > > > > On Fri, 4 Mar 2022 at 14:57, Chris Smith wrote: > > > > > > We could just make a wrapper named `solved = lambda

Re: [sympy] more unified (and usable) solve output

2022-03-04 Thread Chris Smith
(maybe with a deprecation >> warning. You could call it `solve_equations` or something. >> >> Jason >> moorepants.info >> +01 530-601-9791 <(530)%20601-9791> >> >> >> On Thu, Mar 3, 2022 at 11:45 PM Oscar Benjamin >> wrote: >> >&

[sympy] more unified (and usable) solve output

2022-03-03 Thread Chris Smith
The output from solve for algebraic equations is not usable without testing output because of the variable types of output. CASE 1: If no variables are given we get the following from the input: * univariate equation -> list of values >>> solve(x**2 - 4) [-2, 2] * multivariate equation -> list o

[sympy] more unified (and usable) solve output

2022-03-03 Thread Chris Smith
The output from solve for algebraic equations is not usable without testing output because of the variable types of output. CASE 1: If no variables are given we get the following from the input: * univariate equation -> list of values >>> solve(x**2 - 4) [-2, 2] * multivariate equation -> list o

Re: [sympy] Results of the SymPy Documentation Theme Survey

2022-03-01 Thread Chris Smith
For anyone else not familiar yet with the "bus factor", I learned from wikipedia that "The bus factor is a measurement of the risk resulting from information and capabilities not being shared among team members, derived from the phrase "in case they get hit by a bus." /c On Tuesday, March 1, 20

[sympy] Re: Comparing expressions with \pm to FiniteSets

2022-02-23 Thread Chris Smith
Could you show the creation of that pm object, please? /c On Tuesday, February 22, 2022 at 4:46:27 AM UTC-6 kevi...@gmail.com wrote: > Hello - I want to be able to compare a math expression using the > plus/minus symbol (\pm) with a FiniteSet. How can I check that \pm 3 = > FiniteSet(-3,3)? >

[sympy] Re: Feedback requested on new deprecations policy

2022-02-18 Thread Chris Smith
A concern I have about the policy is that "positional argument names are not Public API". I hope this is not correct, because if a function `f(a, b)` is changed to `f(b, a)` this would start failing without warning. I'm not even sure that `f(a, b, c=1, d=2)` should be allowed to be changed to s

Re: [sympy] Optimum factoring of multinomial expression

2022-02-17 Thread Chris Smith
See also the examples in https://github.com/sympy/sympy/issues/23072 /c On Wednesday, February 16, 2022 at 5:38:30 PM UTC-6 Oscar wrote: > On Wed, 16 Feb 2022 at 22:26, brombo wrote: > > > > Does sympy have the capability to optimally factor (minimum number of > numerical operations) a polynom

[sympy] Re: problem with subs: solved, but might be interesting

2022-02-12 Thread Chris Smith
Do you maybe have smart quotes around the m in the symbols arg? /c On Friday, February 11, 2022 at 4:14:31 PM UTC-6 thomas...@gmail.com wrote: > I have a test program: > > from sympy import symbols, Rational > m = symbols('m') > temp = Rational(0) > temp = temp.subs(m, m) > temp = 0 > temp = tem

[sympy] Re: Using sympy.physics.units

2022-02-04 Thread Chris Smith
If you are using the unit system you probably have an idea of what unit a given quantity should be represented, so there is no need to create dummy place holders for units. That is what the units in SymPy are for: >>> var('n P V T') (n, P, V, T) >>> from sympy.physics.units import * >>> gas = E

  1   2   3   4   5   6   7   8   9   10   >