I would like to plot a function but have a domain defined elsewhere as follows:
xrange = Sequence[0, 2π];
Plot[Sin[x], {x, xrange}]
However, this doesn't work resulting in the error Range specification {x, xrange} is not of the form {x, xmin, xmax}.
I've tried to put an Evaluate
around {x, xrange}
but Mathematica was not impressed.
I can think of two easy workarounds:
xrange = {0, 2π};
Plot[Sin[x], {x, xrange[[1]], xrange[[2]]}]
Plot[Sin[x], Evaluate[{x, ##} & @@ xrange]]
While these are fine solutions, they involve changing xrange to a List
in a place where Sequence
seems to fit perfectly. Is there a Sequence
solution that I can use?
Comments
Post a Comment