Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 12:15
    oscargus commented #22549
  • 12:01
    github-actions[bot] commented #22376
  • 11:50
    oscargus commented #22376
  • 11:03
    ThePauliPrinciple commented #22553
  • 10:59
    hanspi42 synchronize #22376
  • 10:58
    hanspi42 commented #22376
  • 10:55
    hanspi42 synchronize #22376
  • 10:50
    hanspi42 synchronize #22376
  • 10:46
    hanspi42 synchronize #22376
  • 10:29
    asmeurer closed #22552
  • 10:29
    asmeurer commented #22552
  • 09:12
    github-actions[bot] commented #22554
  • 09:12

    smichr on master

    Revert "Fix benchmarks build on… Merge pull request #22554 from … (compare)

  • 09:12

    smichr on revert-22481-benchmarks-ci-fix

    (compare)

  • 09:11
    smichr closed #22554
  • 09:02
    hanspi42 synchronize #22376
  • 07:54
    smichr auto_merge_enabled #22554
  • 07:53
    sympy-bot commented #22554
  • 07:53
    smichr edited #22554
  • 07:52
    sympy-bot commented #22554
treffenl
@treffenl:matrix.org
[m]
why is sympy having problems evaluating the first expression, but not the second one
With dr = symbols('Delta',real=True,positive=True,nonzero=True) and k = symbols('k',integer=True,real=True)
mostlyaman
@mostlyaman
@s3k:matrix.org Could you please share the expression in code? It could be this sign function.
syn09001
@syn09001
Hi. Question: If I am in interactive session, and I type F, the symbolic representation of defined expression is outputted. But if I write a program which includes print(F), then the output of F is standards, non symbolic. Is there a way to preserve symbolic expressional form after the program is run? Thanks.
treffenl
@treffenl:matrix.org
[m]
@syn09001: there's a pprint function that does this
Abhijay Mitra
@AbhJ
Hello everyone, I am Abhijay, an Electrical engineering student from IIT Kharagpur, India. I would love to contribute as much as I can to Sympy. I have experience with C++, Java, Javascript and Python and know a bit of Kotlin. I would love to get to know you and get started on contribution!
Oscar Gustafsson
@oscargus

@AbhJ Welcome! Please have a look at https://github.com/sympy/sympy/wiki/Introduction-to-contributing and the Easy-to-fix issues https://github.com/sympy/sympy/issues?q=is%3Aopen+is%3Aissue+label%3A%22Easy+to+Fix%22

Note that there are many issues that have some PR already proposed. It makes sense to have a look at those (or pick one without any solution proposed) and see why they didn't get merged yet (maybe because a test is missing or the documentation not updated or something else). If you decide to use a solution attempt from any of them, please make sure that you build on that PR and do not just copy and paste the code.

Zhang
@Naville
Hi:
I'm very new to mathematics or SymPy / SymEngine and is looking for ways to reimplement my simple SymPy code in C++. What's the relationship between SymEngine(which linked SymPy as its homepage) and can I except invoking the same API from SymEngine to work for my SymPy code?
ThePauliPrinciple
@ThePauliPrinciple
You can always run any python code from your c++ program
Zhang
@Naville
Thanks. I'm aware, but I'd prefer avoiding the whole Python GIL and extra dependency with my code, if possible
It seems all SolveSet() related SymPy APIs wont see their existence in SymEngine?
If I'm not mistaken
Meghna Tripathi
@meghna0tripathi
Hello everyone , I am Meghna Tripathi , a computer science student from Delhi Technological University. I have a keen interest in mathematics and also have prior knowledge of C++, python and Javascript . I would love to know more about the project and want to contribute to the project
Shashvat Gupta
@Shashvat6264
Hi everyone, I am Shashvat Gupta, a computer science student from IIT Kharagpur. I have a keen interest in maths and vast knowledge of C++, Python, JS and Java. I would like to know more about the project and get in pace so as to contribute to the project as soon as possible.
Daniel Sears
@highpost
Hi, I have a variable x_i that I've declared as a constant. But when I render it with display(), pprint() or print() it shows only x.
import sympy as sp

x_i  = sp.symbols('x', constant = True)
display(x)
1 reply
Daniel Sears
@highpost
Thanks!
Hang
@lh6210
5.png
Hi everyone, I cannot see the matrix square brackets in the output. And idea?
Hang
@lh6210
The cmd used to render ? with a square around where the matrix brackets should be.
Kalevi Suominen
@jksuom
@lh6210 Maybe some font set should be installed.
1 reply
Miguel Guthridge
@MiguelGuthridge
Hi all!, I'm having an issue with adding the result of two substitutions if a substitution doesn't take place (since there's no instance of the symbol in expression to substitute into).
Here's a simple replication in the issue:
>>> import sympy
>>> n = sympy.symbols("n")
>>> x = sympy.Subs(1.0, n, 1)
>>> y = sympy.Subs(1.0, n, 2)
>>> x + y
Traceback (most recent call last):
# Shortened for clarity
  File "/mnt/c/Users/migue/Source/Equator/.venv_linux/lib/python3.8/site-packages/sympy/logic/boolalg.py", line 211, in _noop
    raise TypeError('BooleanAtom not allowed in this context.')
TypeError: BooleanAtom not allowed in this context.

During handling of the above exception, another exception occurred:
# Shortened for clarity
Traceback (most recent call last):
  File "/mnt/c/Users/migue/Source/Equator/.venv_linux/lib/python3.8/site-packages/sympy/logic/boolalg.py", line 211, in _noop
    raise TypeError('BooleanAtom not allowed in this context.')
TypeError: BooleanAtom not allowed in this context.
Any ideas why I'm getting that issue? It isn't a problem usually
Like if I make them use the value of n in the substitution then it works completely fine
>>> x = sympy.Subs(n, n, 1)
>>> y = sympy.Subs(n, n, 2)
>>> x + y
Subs(n, n, 1) + Subs(n, n, 2)
Miguel Guthridge
@MiguelGuthridge
The only loosely related thing I can find is this issue, but it doesn't really explain why I'm getting this issue... it's not like I'm working with booleans
sympy/sympy#13427
ThePauliPrinciple
@ThePauliPrinciple
is there any object to indicate something along the lines of a numpy "einsum" in sympy?
Anutosh Bhat
@anutosh491
Hello guys , I need help regarding the setup. I use windows10 and WSL(windows Subsystem for linux) .So I had wanted to create my first PR yesterday and I realized that text_sphinx.sh was the only test failing . I fixed many issues I was facing since morning now I am closer to the finish line but I am just not being able to pass an error.

'Build finished; the LaTeX files are in _build/latex.
Set the environment variable LATEXMKOPTS='-xelatex -silent'
And run `make all' in that directory to run these through xelatex.
latexmk -pdf -dvi- -ps- 'sympy-1.10.dev.tex'
Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Latexmk: applying rule 'pdflatex'...
! Fatal Package fontspec Error: The fontspec package requires either XeTeX or
(fontspec) LuaTeX.
(fontspec)
(fontspec) You must change your typesetting engine to,
(fontspec) e.g., "xelatex" or "lualatex"instead of
(fontspec) "latex" or "pdflatex".

Type <return> to continue.
...

l.45 \msg_fatal:nn {fontspec} {cannot-use-pdftex}'

I have tried everything I had but I am not sure how to get past this , any help would be appreciated !
Oscar Gustafsson
@oscargus
@anutosh491 I think you need to install xelatex as well. It seems like latexmk is executed with the -xelatex option, so my guess is that it cannot find xelatex.
Anutosh Bhat
@anutosh491
thanks a lot @oscargus . I did install xetex using apt-get install texlive-xetex . Not sure if that was a correct way around
Anutosh Bhat
@anutosh491
will running something like this help !
latexmk -pdf -pdflatex="xelatex" -use-make sympy-1.10.dev.tex
ThePauliPrinciple
@ThePauliPrinciple
Also, what is prefered method to change printing behaviour of a specific object in a script (as in, I just want a more convenient format for my usecase)
In particular "Idx(i,(0, N−1)),Idx(j,(0, N−1))" could just "i,j" for me when using the latex printer
*the prefered method
Oscar Gustafsson
@oscargus
@anutosh491 so it works? -pdflatex="xelatex" should be the same as -xelatex as far as I understand. But great if it works!
@ThePauliPrinciple The best way would be to add a _print_Idx-method to the LaTeX printer and it seems like your approach is probably what everyone would like. If you want to make your own, you can subclass the LaTeX printer and (re)define that method.
Oscar Gustafsson
@oscargus
All other printers use these lines, which may do the trick:
def _print_Idx(self, expr):
return self._print(expr.label)
Anutosh Bhat
@anutosh491
@oscargus I was just about to write back to my previous message . Yeah that worked . So so happy ,took me a whole day since 6 am -6pm here in india to figure out so many small small errors due to which test_sphinx.sh wasn't passing . Now I can peacefully contribute/send PR's . All this is due to WSL and its compatibility with different modules/packages in Sympy . Eg inkscape commands haven't been implemented in Ubuntu(20.04/19.04) installed through WSL so had to find a way around that (some dirty trick I had to do) .
ThePauliPrinciple
@ThePauliPrinciple
Hmm, I seem to get some issues now with the colab printing snippit I stole
Anutosh Bhat
@anutosh491
I feel most of the contributors would be setting up sympy on linux and not windows probably hence not all would be facing such errors but still for ones who would eventually set it up on Windows I would be writing a blog of how one can successfully setup up Sympy on windows and get around the shortcomings in WSL1/WSL2 and maybe if that's good enough , i'll ask the community if I can put it up on the developement workflow setup for refernce on github wiki
ThePauliPrinciple
@ThePauliPrinciple

class custom_latex(sy.printing.latex):
def _print_Idx(self,expr):
return self._print(expr.label)

complains "init() takes 3 positional arguments but 4 were given" I feel like I'm writing some typo I don't realise?

Oscar Gustafsson
@oscargus
@anutosh491 I think your are correct. I have not set up document building on my Windows laptop...
@ThePauliPrinciple latex is just a wrapper for the class LatexPrinter.print() if I recall correctly.
So you should subclass LatexPrinter instead and possibly provide a similar command.
ThePauliPrinciple
@ThePauliPrinciple
Ah I see
ThePauliPrinciple
@ThePauliPrinciple
Yeah, got it to work!

class CustomLatexPrinter(LatexPrinter):
def _print_Idx(self,expr):
return self._print(expr.label)

@sym.printing.printer.print_function(CustomLatexPrinter)
def custom_latex(expr,**settings):
return CustomLatexPrinter(settings).doprint(expr)

ThePauliPrinciple
@ThePauliPrinciple
Thanks a lot :)
ThePauliPrinciple
@ThePauliPrinciple
from sympy import IndexedBase,symbols,Idx,Derivative
X = IndexedBase('X')
D = IndexedBase('D')
i= symbols('i', cls=Idx)
Derivative(X[i]*X[i],D[i])
Is there some way to tell sympy that X is a function of D?
pillsy
@pillsy
Is there a way to match (not just replace) a pattern where the argument is fixed and the function is wild?