Message Boards Message Boards

2 Replies
0 Total Likes
View groups...
Share this post:

An automatic way to input x, xmin, xmax for a RegionPlot?

Posted 11 years ago

I have currently a kind of function that returns dimensions for a set of data, of this sort:
In[82]:= CF[cf]
Out[82]= {a00->-10,a02->1,a10->-1}
Out[83]= {{a02,-2,2},{a10,-2,2}}
So, a00 and so on are my dimensions on which I am plotting. However, if I use the return value as input for the second and third argument of my plot, I get an error as (I guess) a02 and a10 are protected (I guess Mathematica use them as variable during the processing).

Is there a way for me to use this output? Currently I have to copy/paste Out[83] manually, and when trying to automatize the vizualisation of several dataset if become tedious...

Thanks, please let me know of any inaccuracies, I am still learning to use Mathematica.
2 Replies
Posted 11 years ago
It is a little hard to make out what you are doing from the code fragment. But if you are able to assign Out83 to a variable, and you want to use it as the two lists required by a plotting routine, then the problem is that the plotting routine wants two arguments, and this is a single list containing two lists. This can be remedied by replacing the Head (the first level of the list) with Sequence, which can be done by Applying Sequence to it, the short form being @@.

For example:
range = {{x, 0, 3}, {y, -5, 5}};

Plot3D[Sin[x] Sin[y], Sequence @@ range // Evaluate]

You will note that the syntax checking in the Front End still suggests more input. But once the Sequence@@ is evaluated, Plot3D has the two lists it wants for range specifications.
POSTED BY: David Keith
Posted 11 years ago
Thanks, that is indeed exactly what I needed.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract