These are chat archives for sympy/sympy/optics

2nd
Jun 2014
Ondřej Čertík
@certik
Jun 02 2014 17:04
hi
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:04
Hi
Did u see my work till now?
Sorry for being late
Ondřej Čertík
@certik
Jun 02 2014 18:06
Yes, I've been following your PRs a bit
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:08
When I was writing my proposal I read few books from my library(I've mentioned them in the reference) and added a topic called SHM
Now I am facing design issues while implementing it
Ondřej Čertík
@certik
Jun 02 2014 18:08
Is the issue that your rewrite function is not being called?
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:08
yea
Ondřej Čertík
@certik
Jun 02 2014 18:09
I would have to debug it to see what's doing on
besides that, which other issues are you facing?
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:09
I did that
using winpdb
after _eval_rewrite it ends up calling __str__.
It's similar to the behavior when we call sin(x).rewrite('cos')
Ondřej Čertík
@certik
Jun 02 2014 18:12
Hm.
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:15
No other issues yet.
These days I'm also devoting time on other issues in SymPy.
It helps me to understand SymPy better.
Ondřej Čertík
@certik
Jun 02 2014 18:19
Absolutely. I really appreciate all the work you do
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:20
Thanks! :smile:
Ondřej Čertík
@certik
Jun 02 2014 18:20
We need to understand why __str__ would be called from _eval_rewrite, if this is how things work or what the idea is. On some example inside sympy. Then we need to figure out how to hook your own code into it.
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:21
yea
It'll be better if we also add it in docs like manipulation.rst.
Ondřej Čertík
@certik
Jun 02 2014 18:25
Yes, definitely.
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:30
Thanks a lot for suggestions!
I'm going to dig deeper to resolve this.
I'll update the PR as soon as I fix that.
Ondřej Čertík
@certik
Jun 02 2014 18:32
Excellent, thanks.
Sudhanshu Mishra
@debugger22
Jun 02 2014 18:39
Bye!
Ondřej Čertík
@certik
Jun 02 2014 18:39
bye!
Sean Vig
@flacjacket
Jun 02 2014 23:11
Hmm, @debugger22 so your function isn't rewriting because it isn't called by the Basic._eval_rewrite function

if you add something like:

if hasattr(self, rule):
    return getattr(self, rule)(*terms)

it should work as expected

i'm not sure why it doesn't do this...
I'm running tests with that change to see if it breaks anything
@asmeurer is there some reason that function is only called for Atoms?
L1542 in core/basic.py
also, the Basic._eval_rewrite implementation wouldn't respect a deep=False hint, like Function._eval_rewrite does
This message was deleted
Aaron Meurer
@asmeurer
Jun 02 2014 23:44
no idea