It looks like a silly question, but I could not find any answers online. Your help is greatly appreciated!

Say I have two lists now.

L1={{k},{2k+1},{3k+3},{4k},{5k-4},{6k}};

L2={“>0″,”<0",">0″,”>0″,”>0″,”<0"}; (*it's in string form, mathematica wont let me run >0 without quotation marks*)

and I want to form a matrix like this shown as result (no string form contained)

result={{k>0},{2k+1<0},{3k+3>0},{4k>0},{5k-4>0},{6k<0}} so that I can use Reduce to find the range of k for all elements in the result list. Thanks in advance!! ================= ================= 3 Answers 3 ================= Use a different format from the start to avoid this complication. L1 = {k, 2 k + 1, 3 k + 3, 4 k, 5 k - 4, 6 k}; L2 = {1, 2, 1, 1, 1, 2}; MapThread[{# > 0, # < 0}[[#2]] &, {L1, L2}] {k > 0, 1 + 2 k < 0, 3 + 3 k > 0, 4 k > 0, -4 + 5 k > 0, 6 k < 0} Thanks Mr. Wizard! I will try this as well! – user11726 Feb 1 '15 at 3:53 Also: L2a = L2 /. {">0″ -> (Greater[#, 0] &), “<0" -> (Less[#, 0] &)};

MapThread[Apply, {L2a, L1}]

(* {k > 0, 1 + 2 k < 0, 3 + 3 k > 0, 4 k > 0, -4 + 5 k > 0, 6 k < 0} *)
Or
Apply @@@ Thread[{L2a, L1}]
(* {k > 0, 1 + 2 k < 0, 3 + 3 k > 0, 4 k > 0, -4 + 5 k > 0, 6 k < 0} *)
List /@ Apply @@@ Thread[{L2a, L1}]
(* {{k > 0}, {1 + 2 k < 0}, {3 + 3 k > 0}, {4 k > 0}, {-4 + 5 k > 0}, {6 k < 0}} *)
Congratulations on entering the 60K club! 🙂
– Mr.Wizard♦
Jan 30 '15 at 8:57
thank you @Mr.Wizard.
– kglr
Jan 30 '15 at 17:46
Thanks for your answer, kguler!
– user11726
Feb 1 '15 at 3:53
How about
ClearAll[k]
L1 = {{k}, {2 k + 1}, {3 k + 3}, {4 k}, {5 k - 4}, {6 k}};
L2 = {">0″, “<0", ">0″, “>0”, “>0”, “<0"};
result = MapThread[{ToExpression@StringJoin[ToString[First@#1], #2]} &, {L1, L2}]
It works like a charm! Thanks Nasser!
– user11726
Jan 30 '15 at 2:28
Sorry to bother you. It seems that the code does not work with symbol with subscript. For example, replace k with Subscript[k, 1]. I found this problem because I have all symbols with subscripts. It there a way to work around this? Maybe change the forms
– user11726
Jan 30 '15 at 2:54