Question

So, for example, I have the code here:

initialXArr = {Subscript[x, 0][0], Subscript[x, 1][0],

Subscript[x, 2][0], Subscript[x, 3][0], Subscript[x, 4][0]}

xarr = {15, 16, 17, 18, 19}

So I have two arrays now equal to the stuff above. I want code that is able to combine the two lists into one and just output the following list:

{Subscript[x, 0][0] == 15, Subscript[x, 1][0]==16,

Subscript[x, 2][0] == 17, Subscript[x, 3][0] == 18,

Subscript[x, 4][0] == 19}

I do not want to evaluate anything, I just need the output to the the above.

What I’ve Tried

Just setting the arrays equal. I just get False back.

{Subscript[x, 0][0], Subscript[x, 1][0],

Subscript[x, 2][0], Subscript[x, 3][0], Subscript[x, 4][0]} == {Subscript[x, 0][0] == 15, Subscript[x, 1][0]==16,

Subscript[x, 2][0] == 17, Subscript[x, 3][0] == 18,

Subscript[x, 4][0] == 19}

This is the only thing I’ve tried as of now. Honestly, I don’t know where to begin trying solutions. This seems like an unusual thing to be trying to get Mathematica to do.

Notes

If possible, I would like this code to be extendable to any two lists with matching numbers of entries.

I really appreciate any help I can have on this issue.

Thank you very much!

=================

=================

1 Answer

1

=================

Try this:

MapThread[Equal, {initialXArr, xarr}]

(* {Subscript[x, 0][0] == 15, Subscript[x, 1][0] == 16,

Subscript[x, 2][0] == 17, Subscript[x, 3][0] == 18,

Subscript[x, 4][0] == 19} *)

Have fun!