Re: Question - Function Definition
- To: mathgroup at smc.vnet.net
- Subject: [mg63712] Re: Question - Function Definition
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 10 Jan 2006 04:50:38 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <dpvn16$m16$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
actuary at mchsi.com wrote: > Hello: > > I'm working my way through the text "A Course in Computational Number > Theory". A function in the text is defined in the following manner > xxx[a_Integer,b_Integer,c_List,d_: Infinity]:= yyyyyyyy. > > What does ":Infinity" do in "d_: Infinity" > > Thanks > > Larry > Hi Larry, From the _The Mathematica Book_, section 2.3.9 "Optional and Default Arguments": "Sometimes you may want to set up functions where certain arguments, if omitted, are given "default values". The pattern x_:v stands for an object that can be omitted, and if so, will be replaced by the default value v. (http://documents.wolfram.com/mathematica/book/section-2.3.9)" In your example, d has a default value that will be taken by d if a value for d is not explicitly entered -- that is you calls the function with only the first three mandatory parameters -- and that default value is equal to positive infinity. Best regards, /J.M.