Ask Your Question

Revision history [back]

Does the following answer your question ?

sage: import itertools
sage: R = lambda r,u,B : [r+u+b for b in B]
sage: Y = lambda r,u,B,M: [rr*bb*mm for (rr,bb,mm) in itertools.izip(R(r,u,B),B,M)]

sage: M = [1,2,3,4,5]
sage: B = [6,7,8,9,0]

sage: R(sqrt(2), pi, B)
[pi + sqrt(2) + 6,
 pi + sqrt(2) + 7,
 pi + sqrt(2) + 8,
 pi + sqrt(2) + 9,
 pi + sqrt(2)]

sage: Y(sqrt(2), pi, B, M)
[6*pi + 6*sqrt(2) + 36,
 14*pi + 14*sqrt(2) + 98,
 24*pi + 24*sqrt(2) + 192,
 36*pi + 36*sqrt(2) + 324,
 0]

Does the following answer your question ?

sage: import itertools
sage: R = lambda r,u,B : [r+u+b for b in B]
sage: Y = lambda r,u,B,M: [rr*bb*mm for (rr,bb,mm) in itertools.izip(R(r,u,B),B,M)]

sage: M = [1,2,3,4,5]
sage: B = [6,7,8,9,0]

sage: R(sqrt(2), pi, B)
[pi + sqrt(2) + 6,
 pi + sqrt(2) + 7,
 pi + sqrt(2) + 8,
 pi + sqrt(2) + 9,
 pi + sqrt(2)]

sage: Y(sqrt(2), pi, B, M)
[6*pi + 6*sqrt(2) + 36,
 14*pi + 14*sqrt(2) + 98,
 24*pi + 24*sqrt(2) + 192,
 36*pi + 36*sqrt(2) + 324,
 0]

Symbolically :

sage: var('m1','m2','b1','b2','u','r')
(m1, m2, b1, b2, u, r)
sage: M=[m1,m2]; B=[b1,b2]
sage: Y(r, u, B, M)
[(b1 + r + u)*b1*m1, (b2 + r + u)*b2*m2]

Does the following answer your question ?

sage: import itertools
sage: R = lambda r,u,B : [r+u+b for b in B]
sage: Y = lambda r,u,B,M: [rr*bb*mm for (rr,bb,mm) in itertools.izip(R(r,u,B),B,M)]

sage: M = [1,2,3,4,5]
sage: B = [6,7,8,9,0]

sage: R(sqrt(2), pi, B)
[pi + sqrt(2) + 6,
 pi + sqrt(2) + 7,
 pi + sqrt(2) + 8,
 pi + sqrt(2) + 9,
 pi + sqrt(2)]

sage: Y(sqrt(2), pi, B, M)
[6*pi + 6*sqrt(2) + 36,
 14*pi + 14*sqrt(2) + 98,
 24*pi + 24*sqrt(2) + 192,
 36*pi + 36*sqrt(2) + 324,
 0]

Symbolically It also works symbolically :

sage: var('m1','m2','b1','b2','u','r')
(m1, m2, b1, b2, u, r)
sage: M=[m1,m2]; B=[b1,b2]
sage: Y(r, u, B, M)
[(b1 + r + u)*b1*m1, (b2 + r + u)*b2*m2]

Does the following answer your question ?

sage: import itertools
sage: R = lambda r,u,B : [r+u+b for b in B]
sage: Y = lambda r,u,B,M: [rr*bb*mm for (rr,bb,mm) in itertools.izip(R(r,u,B),B,M)]

sage: M = [1,2,3,4,5]
sage: B = [6,7,8,9,0]

sage: R(sqrt(2), pi, B)
[pi + sqrt(2) + 6,
 pi + sqrt(2) + 7,
 pi + sqrt(2) + 8,
 pi + sqrt(2) + 9,
 pi + sqrt(2)]

sage: Y(sqrt(2), pi, B, M)
[6*pi + 6*sqrt(2) + 36,
 14*pi + 14*sqrt(2) + 98,
 24*pi + 24*sqrt(2) + 192,
 36*pi + 36*sqrt(2) + 324,
 0]

It also works symbolically with symbolic variables :

sage: var('m1','m2','b1','b2','u','r')
(m1, m2, b1, b2, u, r)
sage: M=[m1,m2]; B=[b1,b2]
sage: Y(r, u, B, M)
[(b1 + r + u)*b1*m1, (b2 + r + u)*b2*m2]