Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
Activity
• 09:44
alansammarone starred sympy/sympy
• 09:26
anutosh491 commented #10390
• 09:26
anutosh491 commented #10390
• 09:04
asmeurer commented #22903
• 08:36
NSC9 commented #22903
• 08:36
NSC9 commented #22903
• 08:35
NSC9 commented #22903
• 08:35
NSC9 commented #22903
• 08:35
NSC9 commented #22903
• 08:32
NSC9 commented #22903
• 08:32
NSC9 commented #22903
• 08:32
NSC9 commented #22903
• 08:32
NSC9 commented #22903
• 08:31
NSC9 commented #22903
• 08:30
NSC9 closed #22903
• 07:20
praneethratna commented #22903
• 07:17
praneethratna commented #22903
• 06:52
• 06:48
sympy-bot commented #22870
• 06:48
anutosh491 edited #22870
Craig Russell
@ctr26
These stack traces after running it for a bit longer
https://pastebin.com/SCHykTyR https://pastebin.com/WRgXuTHu
Eva Tiwari
@evatiwari
I'll try looking into this. If I find something I'll let you know.
Shreyas M S
@Shreyas-MS
Hi, I'm trying to write a parser that converts expressions from my custom expression language to sympy friendly expressions. Does anyone have any resources that would help me? my end goal is to convert expressions written in my language and translate it to something I can evaluate in sympy/numpy.
Nicolai Prebensen
Hi. I am having some trouble implementing inverse_phi (euler's totient) with prime factorization for very large numbers. Does sympy have any inverse_totient functionality, or could someone possibly point me in the right direction for implementing this using SymPy?
Given (p-1)(q-1) I want to find n, for phi(n) = (p-1)(q-1). I.e: phi(n) = 24 --> n = pq = 35 , except I need it to handle numbers as large as 4529255040439033800342855653030016000000000++
Hi, Is there some way to access the function which is to be differentiated i.e. the argument of the Derivative, for e.g. In y=Derivative(x2+2,x), how can I access x2+2.
Kalevi Suominen
@jksuom
In [13]: y.args[0]
Out[13]:
2
x  + 2
Thanks a lot!! :)
Vishesh Mangla
@Teut2711
I want to solve a bvp numerically with steps. This is my relation. 1<i, j<5 . the number of equations are huge. How can I make them and then solve with the help of sympy?
shardul semwal
@Shardul555

Hello all, I was adding a test case for an issue where I encountered assertion error, I do not have much idea about it. Can someone guide me how it can be resolved?

Traceback (most recent call last):
File "/home/shardul/sympy/sympy/series/tests/test_series.py", line 208, in test_issue_9173
assert Q.series(y, n=3) == b_2y**2 + b_1y + b_0 + O(y**3)
AssertionError

Vishesh Mangla
@Teut2711
why don't you use the debugger @Shardul555 ?
shardul semwal
@Shardul555
@XtremeGood okay I was unaware of it , thank you.
JSS95
@JSS95
Hi, is there any way to convert expression containing power, like expr = (x^2 * y^3), to unevaluated Mul like Mul(x, x, y, y, y, evaluate=False)?
Sayandip Halder
@sayandip18
Can anyone tell me if it is possible to pull changes from an old PR? Two of my PRs were from a system which has broken down and now I'm unable to work on them.
11 replies
Aitik Gupta
@aitikgupta
@sayandip18 You can always fetch from someone's (in your case, your own) fork, and checkout that branch.
Sayandip Halder
@sayandip18
Thanks!
Sayandip Halder
@sayandip18
Suppose, I've defined a Sympy function of the type f(a-x) or f(x-a), for example, Heaviside(4-x). Is there any way to access this a-x(here, 4-x) from outside?
shardul semwal
@Shardul555
I run the code for this expression in the terminal having installed sympy version 1.7.1 but here the coefficients of y**2 and y are not simplified to final answer. Anyone guide me regarding this issue whether it is done with some purpose or this should be fixed?(Sympy live shell is giving final simplified answer)
>>> from sympy import *
>>> from sympy.abc import y
>>> var('p_0 p_1 p_2 p_3 b_0 b_1 b_2')
(p_0, p_1, p_2, p_3, b_0, b_1, b_2)
>>> Q = (p_0 + (p_1 + (p_2 + p_3/y)/y)/y)/(1 + ((p_3/(b_0*y) + (b_0*p_2 - b_1*p_3)/b_0**2)/y + (b_0**2*p_1 - b_0*b_1*p_2 - p_3*(b_0*b_2 - b_1**2))/b_0**3)/y)
>>> Q.series(y, n=3)
y*(b_0*p_2/p_3 + b_0*(-p_2/p_3 + b_1/b_0)) + y**2*(b_0*p_1/p_3 + b_0*p_2*(-p_2/p_3 + b_1/b_0)/p_3 + b_0*(-p_1/p_3 + (p_2/p_3 - b_1/b_0)**2 + b_1*p_2/(b_0*p_3) + b_2/b_0 - b_1**2/b_0**2)) + b_0 + O(y**3)
>>> simplify(y*(b_0*p_2/p_3 + b_0*(-p_2/p_3 + b_1/b_0)) + y**2*(b_0*p_1/p_3 + b_0*p_2*(-p_2/p_3 + b_1/b_0)/p_3 + b_0*(-p_1/p_3 + (p_2/p_3 - b_1/b_0)**2 + b_1*p_2/(b_0*p_3) + b_2/b_0 - b_1**2/b_0**2)) + b_0 + O(y**3))
b_2*y**2 + b_1*y + b_0 + O(y**3)
4 replies
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)?
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!
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