optional arguments



Robert,

Try

f([a]) := ....

and then treat a as a list, eg a[1], length(a) etc.

Also,

f(a,[b]) works, with a first argument and then the "rest".

Try 
describe("function");

and then choose "Function."

All the best,
Chris


On Wed, 30 Nov 2005, Robert Jerrard wrote:

> Is it possible to define functions that have optional arguments? For
> instance, I have defined the function:
> 
> polarplot(expr,range) :=
> block([theta_var:range[1]],set_plot_option([nticks,500]),set_plot_option([gnuplot_preamble,"set key off; set size ratio -1"]), plot2d( ['parametric, cos(theta_var)*expr, sin(theta_var)*expr, range]))$
> 
> but would like it to have the option of including an xrange and a
> yrange. So I would like to give the command in a number of ways, for
> example,
> 
> polarplot(2/(sin(t)+1),[t,0,2*%pi])
> 
> or as 
> 
> polarplot(2/(sin(t)+1),[t,0,2*%pi],[x,-5,5])
> 
> or as 
> 
> polarplot(2/(sin(t)+1),[t,0,2*%pi],[x,-5,5],[y,-5,2])
> 
> How do I do this?
> 
> Thanks, Bob
> -- 
> Dr. Robert J. Jerrard, Professor of Mathematics,
> Concordia University College of Alberta,
> 7128 Ada Blvd., Edmonton, Alberta, T5B 4E4, Canada.
> Phone: (780) 479-9291, Fax: (780) 474-1933.
> 
> _______________________________________________
> Maxima mailing list
> Maxima@math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>