I am writing a function along the lines of the following:
func[basis_,coordinates_,vars_]:=Table[Function[vars,monomial]@@@coordinates,{monomial,basis}]
The idea would be to call somethings like
func[{x,x*y},{{0,1},{1,2}},{x,y}]
and then receive as output
{{0,1},{0,2}}
However, vars
as it appears on the right hand side is not the same vars
as appears on the left hand side because of how Function
works. (Mathematica warns of this by highlighting vars
in red with the message "A variable name has been used twice in a nested scoping construct, in a way that is likely to be an error.")
First, how can I get around the name scope problem that Mathematica warns about? Then, is this even a appropriate way to go about what I am trying to do?
Thanks!
{x, x*y} /. Thread[{x, y} -> Transpose@{{0, 1}, {1, 2}}]
orbasis /. Thread[vars -> Transpose@coordinates]
(providedbasis
consists of poly/mo-nomials). $\endgroup$ – Michael E2 Jul 7 '17 at 16:50