Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 16:20
    github-actions[bot] commented #22376
  • 15:55
    github-actions[bot] commented #22376
  • 15:44
    oscarbenjamin labeled #22624
  • 14:45
    hanspi42 commented #22376
  • 14:44
    hanspi42 synchronize #22376
  • 14:38
    kantgreven starred sympy/sympy
  • 14:25
    hanspi42 synchronize #22376
  • 14:18
    fdraxler edited #22624
  • 14:17
    fdraxler opened #22624
  • 14:08
    hanspi42 synchronize #22376
  • 13:47
    hanspi42 synchronize #22376
  • 13:47
    ThePauliPrinciple commented #22607
  • 13:46
    hanspi42 synchronize #22376
  • 13:43
    github-actions[bot] commented #22376
  • 13:36
    github-actions[bot] commented #22376
  • 13:21
    ThePauliPrinciple synchronize #22607
  • 13:10
    MishraAditya12126 commented #22570
  • 13:05
    oscarbenjamin commented #22376
  • 13:04
    oscarbenjamin commented #22376
  • 13:03
    ThePauliPrinciple commented #22570
Sayandip Halder
@sayandip18
solve(x**2 - y**2, [x,y]) returns [(-y, y), (y, y)]. Shouldn't the answer be [(-y,y), (-x,x)] instead?
10 replies
Mohit Dilip Makwana
@mohitdmak
Hey all! I am a cse fresher from Bits Pilani, and new to open-source. I like the features provided by Sympy and would want to know how can I contribute to it. I have a fair amount of experience with python,c++, and framework Django. If any mentor here can help me with how to start, it would be a great help !
Suryam Arnav Kalra
@suryam35
Hi @mohitdmak , you can start with https://github.com/sympy/sympy/wiki/Introduction-to-contributing for starters, and then you can refer to the docs https://docs.sympy.org/latest/index.html. For the later part, refer to https://github.com/sympy/sympy/wiki/Development-workflow.
Sidharth Mundhra
@0sidharth
Can anyone give me some hints on how I can go about debugging a RecursionError (for specifics, sympy/sympy#9449 )? Any hints you can give would be great as I'm seeing this part of the codebase for the first time. Should I focus on the statements before the recursion happens or during (I have tried printing values during both but still wasn't able to figure anything out)?
1 reply
Mohit Dilip Makwana
@mohitdmak
Thanks @suryam35 , on it.
UberGuy
@UberGuy_gitlab
Hey folks. Possibly n00b question. I'm interested in SymPy for its symbolic simplification features, using it to rearrange complicated expressions built by by sometimes naive automation. I'm leaving everything fully symbolic, so none of the Symbols or Functions have assigned values or concrete implementations. I've had great luck using SymPy this way using parse_expr() with a bit of transformation logic to ensure the expressions are well-formatted in ways SymPy expects. I am stumped by one thing, though. Some of my expressions contain functions are logical (boolean) , so I get expressions like f(x) & g(y). But the default transformations turn these into Functions, which aren't considered Booleans, and thus cause TypeErrors when used as arguments to BooleanFunctions like And() or Not().
Is there an accepted way to declare a Function-like symbol that counts as a Boolean type for these purposes? Is there some better way to achieve this?
Thanks for any assistance, and Happy New Year!
1 reply
Michael Phelps
@nottheswimmer
Ola. Anyone happen to know how I can combine two relation objects in sympy like L > 5 and 10 > L to get 10 > L > 5?
Aaron Meurer
@asmeurer
Use And, like And(L > 5, 10 > L)
Michael Phelps
@nottheswimmer
Thanks! From that, I was able to get the domain using .as_set as well which was what I was really after
Aaron Meurer
@asmeurer
If you want the set you can use Interval directly
Michael Phelps
@nottheswimmer
Ah, in my use case I wasn't exactly sure what the interval would be -- needed to derive it from inequalities (unless you can just pass inequalities to interval)
Barabas
@Barabas5532
Hi all, what's the easiest way to perform partial fraction expansion with scypy? I'm trying to do it on H(z) from this paper. So far I've used prem and pquo to make the numerator order lower than the denominator order. However, the result I get makes no sense, when I subtract (quotient + remainder/denominator) from the original fraction, the answer is not zero as it should be. I've tested on a simple case of (2x + 1)/(x + 1) and the answer was fine there.
Barabas
@Barabas5532
Just tried sympy.polys.partfrac.apart, but that just returns the fraction that is given to it.
Aaron Meurer
@asmeurer
apart is the function. You may have to use full=True if it can't factor the denominator.
Sidharth Mundhra
@0sidharth
Is there a function which can break down a Mul which has arguments in terms of +,/ etc into a Mul which has arguments like Add, Rational, Pow etc?
eyJhb
@eyJhb
Can I limit the solve() method, to only show me N solutions? It times out in Jupyter Notebook trying to find solutions, which should be fairly easy. But I suspect that it finds A LOT of solutions, and never finish
Aaron Meurer
@asmeurer
I don't think so, but often when that happens most of the solutions are complex and you only care about real solutions, in which case you can set the variable to be real=True
Mayank-gaur
@Mayank-gaur
Can somebody guide how can I get started on issue #20693. I am a beginner in open source world and would really appreciate any help.
Vishal
@Vishalghyv
Hello all, I am Vishal wanted to contribute to Sympy here is my initial PR please review it sympy/sympy#20726
Yash Patel
@ryuk156
This side Yash Patel here I'm newcomer here can anyone help me how can i start contributing to this community?
Suryam Arnav Kalra
@suryam35
Hi @ryuk156 , you can start with https://github.com/sympy/sympy/wiki/Introduction-to-contributing for starters, and then you can refer to the docs https://docs.sympy.org/latest/index.html. For the later part, refer to https://github.com/sympy/sympy/wiki/Development-workflow.
shardul semwal
@Shardul555

I want the following expression to be simplified in terms of v, I preferred collect() method but it is giving same expression as input .
input expression :(8*c**4*v**2 + 6*c**2*v**4 + 5*v**6)/(16*c**6) + 1
output required:5*v**6/(16*c**6) + 3*v**4/(8*c**4) + v**2/(2*c**2) + 1
through collect():

>>> collect((8*c**4*v**2 + 6*c**2*v**4 + 5*v**6)/(16*c**6) + 1 , v)
1 + (8*c**4*v**2 + 6*c**2*v**4 + 5*v**6)/(16*c**6)

Can anyone suggest better method to do this task

astrojuanlu
@astrojuanlu:matrix.org
[m]
hi all, I'm finding that sin(acos(cos(a) * cos(pi / 2 - 2 * γ))) evaluates directly to sqrt(-sin(2*γ)**2*cos(a)**2 + 1), which is something that I don't want. is there a way to tell SymPy to not perform this sort of simplification?
astrojuanlu
@astrojuanlu:matrix.org
[m]
...found it by chance:
from sympy.core.expr import UnevaluatedExpr
sin(UnevaluatedExpr(acos(cos(a) * cos(pi / 2 - 2 * γ))))
Aaron Meurer
@asmeurer
Or use evaluate=False
2 replies
Arnav Anand
@ArgonArnav
Hello everyone! I am Arnav Anand from India, I have read the instructions for contributing to SymPy, looking forward to working in this organization.
Shatakshi Singh
@shatakshisingh24

Hello everyone!
I am Shatakshi, a third-year Computer Science undergraduate student at Mody University, India.

I have previously worked on research papers so I am comfortable with python and theoretical concepts of Machine Learning and their implementation.

This is the first time I will be contributing to a big project with so many contributors. I have read the instructions to contribute. It will be really helpful if I can get some clue on how to start contributing to this kind of projects.

Suryam Arnav Kalra
@suryam35
@shatakshisingh24 you can start with the easy to fix aka good first issues and get a understanding of the codebase.
Shatakshi Singh
@shatakshisingh24
Thanks @suryam35 , on it!
Craig Russell
@ctr26
Evalf isn't evaluating my integral even with .evalf(subs=dict) any thoughts on why?
I ask because I'm trying to parallelize the computation of my integral over a range
Currently I'm lambdifying it using mpmath as it returns nan with numpy
But I can't get dask to serialise the lambda function to make it parallel
Aaron Meurer
@asmeurer
There can be issues parallelizing things with SymPy because of serialization bugs.
jicky94
@jicky94
Hi everybody, i have a question regarding `nonlinsolve'. When i used it for my system of equations (some of which are non linear), i get solutions in terms of other unknown and not only in terms of the parameters. I checked the documentation but did not see the relevant options. What am I doing wrong? If anyone could help me, that would be fantastic. In other words i am not able to get explicit solutions. I could copy paste my code but it does not seem the right place to do that :) many thanks and have a nice day
Craig Russell
@ctr26
There can be issues parallelizing things with SymPy because of serialization bugs.
@asmeurer K so, the best way to do this is by serialising a function that wraps lambidfy rather than creating your lambidfied function first then trying to serialise that. Thi is working for me in task nicely
def numba_func(consts):
    model = sp.lambdify(tuple(consts.keys()),integral,"mpmath")
    return model(*tuple(consts.values()))

out = client.map(numba_func, consts_list)
result = client.gather(out)
Aaron Meurer
@asmeurer
I don't know how well lambdify functions serialize because they are dynamically created
But other than that, they do not involve SymPy expressions, so they might actually serialize better
Craig Russell
@ctr26
The above code works well with dask as the lambification runs on the workerrs
Aaron Stiff
@AaronStiff
I'm investigating #20762, and I'm pretty sure it's an issue with ANTLR. I've been looking at LaTeX.g4 to see how it handles subscripts, and everything seems correct. The only potential problem I've found is this:
subeq: UNDERSCORE L_BRACE equality R_BRACE; supeq: UNDERSCORE L_BRACE equality R_BRACE;
Not sure if this could be causing the problem, but could anyone familiar with ANTLR comment on whether or not supeq should be using CARET instead?
Sayandip Halder
@sayandip18
I was going through plot.py and came across the check_arguments() function here. Though I sort of understand how it works, I still don't understand it's purpose. The docstrings aren't much of a help either. Can someone tell me why the function behaves that way?
10mayje
@10mayje
hello, I am Tanmay Mondal a second-year student of nit Durgapur, West Bengal, India. I am expressed in python, Django. How can I get started?
Aaron Meurer
@asmeurer
@AaronStiff I think that issue is unrelated to parse_latex. It is parsing the expression right. python() just doesn't print it right.
1 reply
Craig Russell
@ctr26
Anyone know why this simplfies to 0, it doesn't in mathematica?
import sympy as sp
from sympy.concrete.summations import Sum

sp.Derivative(Sum(sp.exp(x*sp.sin(n/m)),(n,1,m)),x).simplify()
Craig Russell
@ctr26
This works fine:
Sum(sp.Derivative(sp.exp(x*sp.sin(n/m)),x),(n,1,m)).doit()
Aaron Meurer
@asmeurer
Looks like it is a bug
Something weird is happening here
>>> Sum(exp(x*sin(n/m)),(n,1,m))
Sum(exp(x*sin(n/m)), (n, 1, m))
>>> Sum(exp(x*sin(n/m)),(n,1,m)).doit()
Piecewise((m*exp(c3_), Eq(exp(c2_), 1)), ((exp(c2_) - exp(c2_*(m + 1)))*exp(c3_)/(1 - exp(c2_)), True))
Alex Nguyen
@rxng8
Hi I'm new to sympy. I hope I can go with sympy and contribute from now on