Help modifying Sympy Gamma

44 views
Skip to first unread message

Eric Tilley

unread,
Jan 22, 2015, 9:22:51 PM1/22/15
to sy...@googlegroups.com
Hello!

I am hosting a copy of Sympy Gamma on a Google App Engine server and using its JSON interface as a backend for my project. I am strong in C# and Python but no so great at web languages, so modifying the backend has been a challenge for me. I have made some modifications to Gamma to make fit my needs but have been stumped by one problem: I noticed that Gamma treats the ^ character as ** while Sympy Live treats is as an xor. I cannot seem to find a way to change this behavior in Gamma. Does anyone have any suggestions about how this could be implemented?

Thanks,
Eric

Sahil Shekhawat

unread,
Jan 23, 2015, 12:27:28 AM1/23/15
to sy...@googlegroups.com
I couldn't find a way to use xor in Gamma, so a hack would be skip transformation of ^ to ** which is here:https://github.com/sympy/sympy_gamma/blob/master/app/logic/logic.py#L154
e.g.
transformations.extend(tuple(custom_implicit_transformation))

Sahil Shekhawat

unread,
Jan 23, 2015, 12:33:04 AM1/23/15
to sy...@googlegroups.com
Sorry the example actually raises an exception, My bad. So you can either comment out that line which will also skip other transformations or you can replace convert_ops to something else already included in the standard_transformations if you don't want to change the current behavior. e.g:
auto_number is already included in the standard transformations and thus, can be causes no behavior changes except converting xor.
transformations.extend((auto_number, custom_implicit_transformation))

Eric Tilley

unread,
Jan 24, 2015, 1:40:00 AM1/24/15
to sy...@googlegroups.com
Thanks for your help! I opted to remove all transformations in favor of performing transformations manually in my frontend.
Reply all
Reply to author
Forward
0 new messages