1
$\begingroup$

I have a list of graphics

p1 = Plot[x Sin[x] - 1, {x, -2.5, 2.5}]
p2 = Plot[Evaluate[D[x Sin[x] - 1, x]], {x, -2.5, 2.5},PlotStyle -> Red]
ListNew = {p1, p2};

I can use Show to combine them:

Show[p1,p2]

I can also use MapThread if I understand correctly here:

MapThread[f,{x1,x2}] = f[x1,x2]

But I dont understand why using MapThread with Show wont work?

MapThread[Show,ListNew]
$\endgroup$
2
  • $\begingroup$ You want Apply not MapThread. $\endgroup$
    – b3m2a1
    Aug 12, 2019 at 23:07
  • $\begingroup$ MapThread is for mapping a multivariate function over multiple lists of arguments, not for applying such a function to a sequence of arguments. $\endgroup$
    – m_goldberg
    Aug 13, 2019 at 1:25

1 Answer 1

3
$\begingroup$

MapThread does not work the way you believe. Run your actual code:

 MapThread[f,{x1,x2}]

You get an error message: "Object x1 at position {2,1} in MapThread[f,{x1,x2}] has only 0 of required 1 dimensions." Basically, you are being told that MapThread wants Lists as the elements in the second argument. Your expression x1 is not a List nor is x2, nor is p1 or p2. As stated in the documentation under Possible Issues: "All arguments must be lists of the same length." (Although, as set forth in the documentation, MapThread can also work with Associations).

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.