My introduction

54 views
Skip to first unread message

kirch...@gmail.com

unread,
May 6, 2018, 12:27:04 AM5/6/18
to sympy
Hello all, I am Kircheis I'm a graduate mathematician looking to get into programming. I have done a little bit of programming in Python and C, mostly solving project Euler problems, I came across sympy after getting tired of writing the same old functions over and over and now I would like to contribute. My familiarity with maths is fairly good, my background is mostly in combinatorics, graph theory and number theory - but until recently I had never programmed, I am hoping that contributing to open source will get my coding style to be something conventional and understandable.

I am quite interested in solving sums, I have implemented Zeilberger's algorithm (http://mathworld.wolfram.com/ZeilbergersAlgorithm.html) for finding recurrences that a sum satisfies, for example if we take F(n, k) = binomial(n, k) and take f(n) the sum in k, it will helpfully tell us that f(n+1) = 2f(n). Less trivially it can tell us that for F(n, k) = binomial(n - k - 1, k) we have f(n+2) = f(n+1) + f(n), or that taking F(n, k) = (n-i)!(n-j)!(i-1)!(j-1)!/((n-1)!(k-1)!(n-i-j+k)!(i-k)!(j-k)!) we have f(n+1) = f(n), it also provides a function that serves as a proof of these recurrences. It is essentially just a rewrite of the algorithm described on page 106 of https://www.math.upenn.edu/~wilf/AeqB.pdf.

If this is something of interest then I am happy to try and tidy it up a bit, but if not I am happy to be directed to look at something else.

Along the lines of tidying up, a question, I want to use linsolve, but the solution may have some free variables, I would like to set all the free variables to 0 except for one, which should become 1. At present I find the first free variable, and then set all variables to 0 except this one, is there are more pleasant way to do this?




kirch...@gmail.com

unread,
May 6, 2018, 4:06:19 PM5/6/18
to sympy
I decided to put it as a patch request.

Am I correct in thinking that tests are implemented after the merge to master? Presently if I try to set up tests I can't call the functions I've defined as they're not part of sympy, i.e. 'from sympy.concrete.zeilberger import zb_recur' isn't something that works.

Aaron Meurer

unread,
May 6, 2018, 6:34:00 PM5/6/18
to sy...@googlegroups.com
Here is the pull request https://github.com/sympy/sympy/pull/14701

The tests should be included with the pull request, not after it is
merged. The tests are what tells us that the code is correct and
doesn't have bugs.

> Presently if I try to set up tests I can't call the functions I've defined as they're not part of sympy, i.e. 'from sympy.concrete.zeilberger import zb_recur' isn't something that works.

It should work if you put the test file in
sympy/concrete/test_zeilberger.py. Then run the tests using ./bin/test
zeilberger

> Along the lines of tidying up, a question, I want to use linsolve, but the solution may have some free variables, I would like to set all the free variables to 0 except for one, which should become 1. At present I find the first free variable, and then set all variables to 0 except this one, is there are more pleasant way to do this?

You might need to use the Matrix methods directly, like M.nullspace()
and so on.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/623f2b62-25a0-483f-80e8-9073a3eba789%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages