-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Le 10/04/2015 09:42, Jori Mantysalo a écrit :
> On Wed, 8 Apr 2015, Guillaume CONNAN wrote:
> 
>>>> p1 = lambda z: ((3*z^3 | 2*z^2) ^^ 5*z) + 2
>>> 
>>> What is the supposed result of
>>> 
>>> 3*z^3 | 2*z^2
>> 
>> p1(2) is ((24 | 8) ^^ 10) + 2 = 20
> 
> Understood. You can not define it like
> 
> p1(z)=((3*z^3 | 2*z^2) ^^ 5*z) + 2
> 
> but you can just make a function:
> 
> def p1(z): return ((3*z^3 | 2*z^2) ^^ 5*z) + 2 p1(2)
> 
> outputs 20. You can have function taking function as parameter(s),
> like
> 
> def p2(f, z): return f(z)^f(z) p2(p1, 2)
> 
> outputs 104857600000000000000000000.
> 
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
-
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call
last)
<ipython-input-2-d41626504269> in <module>()
- ----> 1 e = ((Integer(3)*z**Integer(3) | Integer(2)*z**Integer(2)) ^
Integer(5)*z) + Integer(2)

TypeError: unsupported operand type(s) for |:
'sage.symbolic.expression.Expression' and
'sage.symbolic.expression.Expression'

and that was my question actually : is there something already done to
do it ? Or is it something interesting to investigate ?

- --
G.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iF4EAREIAAYFAlUtDZkACgkQ3evBxNNLf8isDwD/ZlqNGZaxwhIVS45LkvT7ZQSI
4giLftswOvQkPvMRPsYA+wU5tq0X31LDVTiMmOj5ecrF6y1qwleU8n7Rlj7dkQZm
=Fz0H
-----END PGP SIGNATURE-----

-- 
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.

Reply via email to