On Tuesday, April 14, 2015 at 5:52:47 AM UTC-7, Guillaume wrote:
>
> OK and thank you.
> Now I would like to deal with bitwise operations with symbolic
> expressions :
>
> sage: z = var('z')
> sage: e = ((3*z^3 | 2*z^2) ^^ 5*z) + 2
>
Assuming that "^^" means XOR you could spell this
sage: function("OR")
sage: function("XOR")
sage: e = XOR(OR(3*z^3,2*z^2),5*z)+2
If you read up on the NewSymbolicFunction functionality you could even make
them so that you can evaluate the expression for numerical (integer) values
of z.
What you obviously don't get from this approach is that sage can test for
you symbolically that
NOT(AND(x, y)) == OR(NOT(x),NOT(y))
but then again, your stated goal is to work with operations that do not
have nice mutual algebraic relations. It does raise the question what the
benefit is that you'll be deriving from representing such expressions
symbolically.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.