Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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
  • 06:53
    moorepants commented #22626
  • 04:03
    bertiewooster updated the wiki
  • 01:01
    oscarbenjamin commented #22607
  • 00:59
    oscarbenjamin commented #22607
  • 00:46
    ThePauliPrinciple commented #22607
  • 00:42
    ThePauliPrinciple commented #22607
  • 00:38
    oscarbenjamin commented #22607
  • 00:27
    oscarbenjamin commented #22607
  • 00:26
    oscarbenjamin commented #22607
Hang
@lh6210
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?
In Mathematica, I'd match a pattern like f_[x]
pillsy
@pillsy
Variations on this don't work:
sympify('f(x)').match(Function(Wild('g'))(Symbol('x')))
(Stripping the commutative assumption off of the Wild symbol doesn't do the trick....)
pillsy
@pillsy
OK, I can do something like this:
F_x = Wild('F', properties=[lambda e: e.args == (x,)])
Swagat S. Bhuyan
@SwagatSBhuyan
Hello, I'm Swagat from india. Looking forward to contributing to Python. If anyone would be kind enough to guide me in these initial stages of getting the hang of it and starting to contribute, that would be really great. Thanks!
Tirthankar Mazumder
@wermos
I too am looking to contribute to SymPy!
Sidharth Mundhra
@0sidharth
https://github.com/sympy/sympy/wiki/Introduction-to-contributing has some pointers to help get you started
Anutosh Bhat
@anutosh491
Hello ,I am trying to approach couple of issues involving Sum.doit() but I am not able to understand completely how doit works for a Sum/Integral ( sometimes the recursive call and other times the not so self-explanatory variables like 'rep','did' etc (yeah i know its not possible to write self-explanatory variables always) in the code throw me off and finding it a bit tough to relate as a whole .
any guidance by someone familiar with doit/concrete module regarding how does doit calculate a basic sum like an infinite geometric series would be great ! Thanks
ThePauliPrinciple
@ThePauliPrinciple
Just wanted to point out that I wrote some ideas/examples in https://github.com/sympy/sympy/discussions/22219 looking forward to any feedback
ThePauliPrinciple
@ThePauliPrinciple
Thanks for the reply @oscarbenjamin !
falematte
@falematte
image.png
I think that I found a bug on the evaluation of the limits of a function that I summarize in this pic. Any tips? I can also provide the code to reproduce it.
Of course L and r are symbols positive defined
falematte
@falematte
I have opened and Issue here, please contribute sympy/sympy#22220