MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: A set of several questions

  • To: mathgroup at
  • Subject: [mg90120] Re: A set of several questions
  • From: David Bailey <dave at>
  • Date: Sun, 29 Jun 2008 05:37:41 -0400 (EDT)
  • References: <g451va$pq7$>

Aaron Fude wrote:
> Hi,
> 1. How does one switch between windows within Mathematica. Ctrl-Tab
> does not seem to work.
> 2. When I use the ContourPlot, I am not able add Text outside of the
> plot area by doing Show[plot, text]. The text simply doesn't show up.
> 3. How does one add a common legend for plots in a GraphicsGrid?
> 4. I'm trying to master the Mathematica documentation, but I am still
> at a loss as to where some of the options are hiding. For example,
> Ticks is an option under Plot, but it is nowhere to be found under the
> documentation for Plot. OK, with "Ticks" I guessed to search for
> "Ticks", but with another option I may not be so lucky.
> 5. Does Mathematica have something equivalent to structures. Suppose I
> have an project with twenty parameters and part of the project is a
> function f(x) that, of course, depends on those parameters. Ideally,
> I'd like to write something along the lines of:
> f[s_, x_]:= Integrate[Sin[y], {y, s.a,s.b}] + Cos[s.H1 + s.H2] + x +
> s.H + s.d*s.e
> as opposed to
> f[a_, b_, c_, d_, e_, H1_, H2_, x_] := ...
> I guess I could use a list "s" and access it by saying s[[H1]] where
> H1=6, but is there a better solution?
> Many thanks in advance!
> Aaron
Let me concentrate on question 5. One way to effectively obtain the 
functionality of structures, is to pick a head that has no meaning and 
use it to make a structure:


Such an object could be passed to a function defined as:

f[s_,x_]:= .......

or, preferably

f[s_myStruct,x_]:= .............

The latter form will only accept a myStruct object as its first 
argument, and is thus preferable.

To extract the fourth item of the structure (say), you could write 

Of course, this is a little ugly, so you might prefer to write an 
extraction function with an informative name to do this job:


Many people just use lists as their structures, but this can become 
confusing a in a large project.

David Bailey

  • Prev by Date: Re: One thing in two ways, with different result.
  • Next by Date: Re: One thing in two ways, with different result.
  • Previous by thread: A set of several questions
  • Next by thread: Re: A set of several questions