Re: Why this function does not return a single value

*To*: mathgroup at smc.vnet.net*Subject*: [mg60296] Re: Why this function does not return a single value*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Sat, 10 Sep 2005 06:46:44 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

On 9/9/05 at 4:07 AM, marekbr at gmail.com (Marek) wrote: >I know that Mathematica treats space as a multiplication sign. What >happens here is that when I remove the multiplication signs in Input >mode, convert to Standard mode and then back to Input mode the >multiplication signs reappear. I just did the following experiment. >Opened fresh Mathematica notebook and typed in (in Standard mode) >g[x_,a[1]_]:=a*x (no spaces anywhere) Executed that Then converted to >Input mode and there will be a star between a[1] and the blanc sign _ . In essence, g[x_,a[1]_]:= a*x is meaningless. This defines a function named g having an arbitrary first arguement you are naming x, an arbitrary second argument you are naming as the function a evaluated at 1 returning the product of the function and the first argument. Is this really what you want? Perhaps, you want to create a function that returns the product of somehing and the first element of something else. That could be simply done as g[x_, a_]:= x*First[a] Or perhaps you want to return the product of something an a function evaluated at 1. That could be done as g[x_,a_]:= x*a[1] -- To reply via email subtract one hundred and four