Many years ago, in a universe far, far away, for a different employer,
I wrote a specialized symbolic algebra system in Python.  I need
something similar now, and am casting about to try to figure out how
hard it would be to tweak code from sympy or sympycore (or please feel
free to suggest other packages) to do what I need, or if I should just
write it all again.

Basically, I don't need (or want) real numbers or transcendental
functions or derivatives or any sort of fancy stuff like that.  I need
and want integers only, in the standard way that C and many other
computer and hardware languages deal with them.  This means that I
need simple algebra, bitwise operators, and logic operations.

In my world,  (2X + 6) / 4 is not at all the same as X/2 + 3/2.

But it is the same as (X+1) / 2 + 1, and ideally should have the same
canonical representation.

In my world, x && 3 can only evaluate to two possible answers, while x
& 3 can evaluate to four possible answers.  Likewise, x | 3 can
evaluate to (ideally, an infinite number of answers, but in reality,
and to quote Carl Sagan,) billions and billions of possible answers,
but there is only one answer for x || 3.

Some other things to consider:

(x - 5) && (23 * y)  is equivalent to (x != 5) * (y != 0)

(x - 5) || (23 * y)  is equivalent to ((x != 5)  + (y != 0)) != 0

x ? y : z   (or in new-fangled Python, y if x else z)  is equivalent
to (x!=0) * y + (x==0) * z

If memory serves, when I wrote a library like this before (almost a
decade ago when I was a Python newbie), it was just a few hundred
lines of code.   I've only looked at the sympy code a little, and
don't yet have a good understanding of where I would add this or how
large it would be to add -- the tradeoff of how much reuse I would
gain from the existing sympy code vs. the mental effort of learning
the system.

Any guidance on this would be greatly appreciated.

Best regards,
Pat
-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.


Reply via email to