Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 11:33
    ThePauliPrinciple commented #22607
  • 10:38
    oscargus commented #22628
  • 10:06
    namannimmo10 labeled #22629
  • 10:06
    ThePauliPrinciple commented #22607
  • 09:46
    rangsimanketkaew starred sympy/sympy
  • 09:29
    github-actions[bot] commented #22630
  • 09:27
    mokeyish starred sympy/sympy
  • 09:21
    github-actions[bot] commented #22630
  • 09:00
    azeem110201 starred sympy/sympy
  • 08:25
    hanspi42 commented #22618
  • 08:25
    hanspi42 commented #22618
  • 08:21
    hanspi42 commented #22618
  • 08:04
    hanspi42 commented #22376
  • 08:03
    hanspi42 synchronize #22630
  • 08:02
    sympy-bot commented #22630
  • 08:01
    hanspi42 opened #22630
  • 07:38
    AdvaitPote commented #22629
  • 07:35
    AdvaitPote commented #22629
  • 07:32
    AdvaitPote commented #22629
  • 07:28
    AdvaitPote commented #22629
Aaron Meurer
@asmeurer
Looks like a bug. Can you open an issue?
Francesco
@cescofran_gitlab
@asmeurer new to the project I will try to look at the reccomanded way to write a issue ..
but if someone already familiar with process do it before ...I will learn directly from it ..
Aaron Meurer
@asmeurer
It's not that complicated. Just go to https://github.com/sympy/sympy/issues/new and note the example that is wrong.
Ayush Bisht
@ayushbisht2001
#4886 I want to work on this issue , can someone suggest me how to start?? where the test file should be added . I am unable to figure out it.
Ayush Bisht
@ayushbisht2001
I have found some conflict with my PR #20935 , can someone help me ??
Francesco
@cescofran_gitlab
Sum(x**2, (x, 1, k)).evalf() and expression which derivative is not a constant raise TypeError
this should come from the euler_maclaurin when it compare a symbolic expression to a float...
why the code does not take in consideration the symbolic case?
Janmay Bhatt
@JANMAY007
Hi everyone, I am Janmay from Nirma University, India and I want to contribute into sympy library. I am CSE student, second year. I have done a research in mathematics related to prime numbers which is prime conjecture(here https://www.ijmttjournal.org/archive/ijmtt-v60p505).
This research have function for series of prime numbers and you can generate the any prime with a reference. I have read about the contribution in sympy so may someone please guide me about gsoc
This will make the prime generation faster and precise, which I want to contribute into sympy as well as for issue #19118 in sympy repository
Ayush Bisht
@ayushbisht2001

I found some unusual behaviour in randprime and I try to fix it.

from sympy import randprime
print(randprime(-2,0))
ValueError: no preceding primes

Can someone please review this PR : #20949

laolux
@laolux:wolkendienst.dynv6.net
[m]
@ayushbisht2001 Wouldn't it make sense to go all the way to 2?
for example
print(randprime(0,2)) should also print "no primes exist in the specified range"
Ayush Bisht
@ayushbisht2001
@laolux:wolkendienst.dynv6.net , Now , Is it good to go ?? #20949 .
1 reply
Aaron Stiff
@AaronStiff
How would I analyze a sympy object to see whether it matches a certain structure? For instance, I want to see if an object/expression matches the structure I*im(z), where z is some complex symbol.
Aaron Meurer
@asmeurer
You can use Wild and match
Aaron Stiff
@AaronStiff
Thanks.
Vishesh Mangla
@Teut2711
class Data:
    def __init__(self, string,symbol, value):
        self.string = string
        self.symbol = sm.Symbol(symbol)
        self.value = value

    def __add__(self, other):
        return self.value + other.value if isinstance(other, Data) else other

    def __str__(self):
        return self.string
    def _repr_latex_(self):
        return display(Latex(' '.join([self.string, f'({self.symbol})' ,r'\equals', self.value] )))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
c:\users\dell\onedrive\desktop\courses sem8\venv\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

<ipython-input-49-83e3f780e89d> in _repr_latex_(self)
     11         return self.string
     12     def _repr_latex_(self):
---> 13         return display(Latex(' '.join([self.string, f'({self.symbol})' ,r'\equals', self.value] )))
     14 # area_each_plate = Data("Area of each plate", 15.8*15.8*SI.cm**2)
     15 # inlet_pressure = Data("Area of each plate", 15.8*15.8*SI.cm**2)

TypeError: sequence item 3: expected str instance, Quantity found
how to get the latex out of sympy's Symbol?
neither does f'({latex(self.symbol)})' work
Aaron Meurer
@asmeurer
"TypeError: sequence item 3: expected str instance, Quantity found"
"item 3" is the item at index 3, which is self.value. join requires that every item is converted to a string, so use latex(self.value).
Also I'm not sure, but I think _repr_latex should return a string, not call display().
Ayush Bisht
@ayushbisht2001

frameerror.PNG

With this command python3 -m doctest -v frame.py , I found these error , can anyone help me , why they are failing??

Sidharth Mundhra
@0sidharth
@ayushbisht2001 It looks like you do not have the development version setup properly. I think it is something like you are using sympy 1.7.1 version to run sympy 1.8-dev files
Ayush Bisht
@ayushbisht2001
@0sidharth , how can I update sympy 1.7.1 ?
because, It's not updating further from 1.7.1
! pip install sympy --upgrade
Sidharth Mundhra
@0sidharth
I think you have to go into sympy directory and do pip install -e . in the virtual environment
Ayush Bisht
@ayushbisht2001
Thanks @0sidharth , Now it's working fine ..
Harshit Yadav
@hyadav2k
Is there some way to return two equations in the same Piecewise condition, like Piecewise(((a, b), Eq(n, 0)), (nan, True)), though writing as Tuple doesn't work? Thanks.
laolux
@laolux:wolkendienst.dynv6.net
[m]
Minor point I just noticed: I don't think you need to check if a<=2, because it is checked already that a<b. But I think this detail also depends on sympy style guides, so somebody else should comment on that
Benoit Martin
@metabsd
Hi, How can I evaluate this in sympy ?
image.png
almighty123789
@almighty123789
@metabsd
b1, b2 = symbols('b1 b2')
f = (5b1 - 3b2)**2
@metabsd
f.expand()
stuzenz
@stuzenz

Hi, I am using sympy to help my daughter go through some IGCSE math (while exposing her to some coding) and I am trying to understand, is there a way to have the below expression displayed versus simplified/calculated out.

2**5

Craig Russell
@ctr26
sympify ("2**5", evaluate=False)
Pow(2,5, evaluate=False) also works
stuzenz
@stuzenz
Excellent - thank you. I had tried a few different things - just not the right combination.
Love the sympy library by the way - I am getting more familiar for the library - this group has some useful information which I have also been reading.
stuzenz
@stuzenz

sympify ("2**5", evaluate=False)

Interesting, simplify("2**5",evaluate=False) didn't work for me, but the Pow function did work with evaluate set to False.

Craig Russell
@ctr26
Sympify vs simplify
stuzenz
@stuzenz
Thanks Craig - that did work
almighty123789
@almighty123789
while running some tests, my code is getting some infinte recursion errors, is there a way t o exactly find which statement/test leads to the infinte recursion error?
Sidharth Mundhra
@0sidharth
The tests generally print the traceback, from where you can see the recurring statements
Bjorn Madsen
@root-11

Hi - I'm learning and am looking for a hint for setting up an equation.
The problem is naturally expressed as:

# maximize:
#   z = 100*x_1 + 60*x_2 + 70*x_3 + 15*x_4 + 15*x_5

# subject to limits:
#   52*x_1 + 23*x_2 + 35*x_3 + 15*x_4 + 7*x_5 <= 60
#      X_1                                    in {0,1}
#               x_2                           in {0,1}
#                        x_3                  in {0,1}
#                                 x_4         in {0,1}
#                                         x_5 in {0,1}

But I can't find a way to express "x_1 in the set containing {0,1}

It's a knapsack problem.

My personal preference is to use the matrix representation

m = Matrix((
    [52,23,35,15,7,-60],
    [1,0,0,0,0,0],
    [0,1,0,0,0,0],
    [0,0,1,0,0,0],
    [0,0,0,1,0,0],
    [0,0,0,0,1,0]

))

...but I'm not sure how to package the variables for the nonlinsolve function.

Bjorn Madsen
@root-11
Sorry if this is a dumb question. I'm just overwhelmed by the amount of documentation.
Bjorn Madsen
@root-11
Whilst reading on I'm drifting towards the conclusion that sympy isn't hot on Linear Programming / Simplex method type problems on its own.
Bjorn Madsen
@root-11
Ok. Nobody is burning my statements. PuLP seems to be what I need.