Re: Null in Output Solved?
- To: mathgroup at smc.vnet.net
- Subject: [mg13804] Re: Null in Output Solved?
- From: "Clemens Frey" <Clemens.Frey at uni-bayreuth.de>
- Date: Fri, 28 Aug 1998 04:18:26 -0400
- Sender: owner-wri-mathgroup at wolfram.com
-----Urspr|ngliche Nachricht----- Von: Tom Goetze <TomG at UltimateTech.com> An: Tom Goetze <TomG at UltimateTech.com>; Clemens Frey <Clemens.Frey at uni-bayreuth.de> Datum: Montag, 24. August 1998 23:15 Betreff: Null in Output Solved? >I previously posted a question about Null in the output from a package. >Clemens Frey suggested a trap to make this happen of the form: > >f[x_] := Module[ >{}, >If[False, NeverExecuted] >Sum[i,{i,-1,2}] >] > >This outputs '2 Null' when loaded from a package and the call to f is made. >His reasoning is that since the output for 'False' in the 'If' statement is >not >defined it results in the 'Null', and the line break is interpreted as a >multiplication >(as Mathematica so nicely warns). > >At first I didn't think this was too useful, but indeed it probably was. >I'm not sure >of why my new version works, but here is the story. > snippe'd'snip Tom: I think the case you describe is of the following abstract form. First you define a function f[x_] := Module[{},Anything;] in your complexConstraint-function. The semicolon after 'Anything' makes that f doesnt return anything, namely Null. You can see this by evaluating FullForm[ f[Something] ] Then you let Mathematica compute something like Plus @@ (f[#]& /@ {1,2}) which indeed produces Null+Null being simplified to: 2 Null meaning in FullForm: Times[2,Null] Hope this helped Clemens