Home > front end >  How to replace list of elements to a list of elements as individual elements
How to replace list of elements to a list of elements as individual elements

Time:10-05

I have 2 arrays of elements

{x,y,z}, {1,2,3}

and formula

x^2 y^2 z^3 x*z

I need to make an replacement rule which would replace similar to the rule

{x->1,y->2,z->3}

using this input lists.

CodePudding user response:

Study https://reference.wolfram.com/language/ref/Thread.html and look carefully at the examples shown.

Then try

rules=Thread[Rule[{x,y,z},{1,2,3}]]

and see if that gives you

{x->1,y->2,z->3}

and then if

x^2   y^2   z^3 x*z/.rules

does the substitution you are looking for

  • Related