I need some help in Mathematica.
I’m trying to plot functions that are stored in lists like:
list = {{3x,1,5},{2x^2,0,4}}
I need get an output similar to if I inputted:
Show[Plot[3x,{x,1,5}],Plot[2x^2,{x,0,4}]]
But I am not quite sure how this is achieved?
Thanks in advance
Of the many possible ways to do this, here’s a perhaps cryptic and terse one-liner, followed by explanation:
First,
#is the operator form ofSlotand##is the operator form ofSlotSequence, andf @@@ expris the infix operator forApply[f,expr,{1}]], so this could be more verbosely expressed as:Thus, for each sub-list of your
list, the elements are passed as arguments to the pure function. In the pure function, # is the first argument (first sub-element, e.g. the function,3x) and##2is the rest of the arguments (starting with the second one as aSequence, e.g.Sequence[0, 4]). For the first element then, the command evaluated would bePlot[3x, {x,0,4}].If the above is too cryptic, you could always define a function and use
Map:Hope that helps!