operator for equations, was: Re: [Maxima] Plot options foo=bar vs [foo, bar]
Subject: operator for equations, was: Re: [Maxima] Plot options foo=bar vs [foo, bar]
From: Daniel Lakeland
Date: Sun, 11 Jun 2006 18:50:11 -0700
I appreciate the value of having = be used for true equations, and yet
I can't help leaning towards making plot options similar to those in
R/Splus... where keyword options are specified with = and therefore
plots are done as plot(y ~ x, data=foo,xlim=c(1,2)) etc so there's a
tension here...
I see two basic problems, one is we would like to specify intervals
compactly, and the other is we would like to specify "keyword options"
compactly. Currently we're using a mishmash of things such as
plot2d(expr,[x,start,end])
integrate(expr, x, start, end)
subst([x=a,y=b],expr)
although the last one, subst makes more sense (you're making several
substitutions from a list of equalities, which may be computed rather
than specified by the user), there doesn't seem to be a reason to have
a different treatment between plot2d and integrate. In fact in many
maxima functions there is an expression to be operated on, and then a
variable for which the operation occurs and a definition of the values
that the variable takes on. When the variable takes on more than one
value, such as makelist(x/2,x,1,4) it seems reasonable to specify the
operation as something like this:
operation(expression, var in {MATHEMATICAL OBJECT GOES HERE})
where the mathematical object is either a set, an interval, a list of
values, etc.
There are several languages that have similar ideas, such as haskell
or python list comprehensions.
However, when it comes to plot2d there are additional considerations,
such as the setting of "options" like gnuplot_term and line_style or
whatever. For many of those the : makes sense since we're setting
(locally) the value of certain variables. so we might say
plot2d(expr,x in a..b,
plot_type:gnuplot,plot_options:[foo:bar,baz:quux]);
--
Daniel Lakeland
dlakelan at street-artists.org
http://www.street-artists.org/~dlakelan