Re: [TS 35470]--Re:bouncing from error (bug?) to error (bug?)
- To: mathgroup at smc.vnet.net
- Subject: [mg72545] Re: [TS 35470]--Re:bouncing from error (bug?) to error (bug?)
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Sat, 6 Jan 2007 03:42:31 -0500 (EST)
- References: <200701051500.l05F09NT004482@localhost.localdomain>
On Fri, 5 Jan 2007 15:00:09 UT, Tom Zeller wrote: > Chris, > > You have probably looked at the documentation for the ssle message. It > is a general message: General::ssle which is generated when the indicated > function argument does not have the form indicated in the message. The > example from the documentation is Context[{Integrate}] where the error > occurs in this example because the argument in Context is a list rather > than a symbol. > > Since Attributes works on the Head and the Head of your function is blah[{1}] it is seeing the list as a problem even though it is not, in this > case, an argument. I'll send your code in to Quality Control. > > I did try Trace on the NMinimize example you gave to see where Attributes > was called. The result was quite a few more messages and 42 MB give or take of output,amongst which was quite a few things like this (in part): > for a variety of Optimization`NMinimizeDump`*: > ------ > Optimization`NMinimizeDump`dbPrint[ > 3, {" Ok Elements"}]; > If[FreeQ[ > Optimization`NMinimizeDump`tmp, > > Integers] && > \((MemberQ[Attributes[ > > Evaluate[Head[\(blah[{1}]\)[a]]]], > NumericFunction] > > --------------- > One that had the ssle message associated with it was (in part): > > Optimization`NMinimizeDump`vars]\), > HoldForm], ",", > RowBox[{"{", > RowBox[{ > RowBox[{"{", > RowBox[{ > RowBox[{"{", > RowBox[{ > TagBox[\(Head[\(blah[{1}]\)[a]]\), > HoldForm], ",", > TagBox[\(blah[{1}]\), > HoldForm]}], "}"}], ",", > TagBox[\(Attributes[blah[{1}]]\), > HoldForm], ",", > RowBox[{"{", > RowBox[{ > TagBox[ > RowBox[{"Message", "[", > RowBox[{\(Attributes::"ssle"\), ",", > TagBox[\(Attributes[blah[{1}]]\), > HoldForm], ",", > TagBox["1", > HoldForm]}], "]"}], > HoldForm], ",", > RowBox[{"{", > RowBox[{ > TagBox[ > RowBox[{"MakeBoxes", "[", > RowBox[{ > > RowBox[{\(Attributes::"ssle"\), \(\(:\ > \)\(\ \)\), "\<\"Symbol, string, or HoldPattern[symbol] expected at position \ > \\!\\(1\\) in \\!\\(Attributes[\\(\\(blah[\\(\\({1}\\)\\)]\\)\\)]\\). \ > \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\ > \\\", ButtonFrame->None, ButtonData:>\\\"General::ssle\\\"]\\)\"\>"}], ",", > "StandardForm"}], "]"}], > HoldForm], ",", > > TagBox[\(RowBox[{RowBox[{"Attributes",\ > "::", "\"ssle\""}], ": ", > "\"Symbol, string, or \ > HoldPattern[symbol] expected at position \\!\\(1\\) in \ > \\!\\(Attributes[\\(\\(blah[\\(\\({1}\\)\\)]\\)\\)]\\). \\!\\(\\*ButtonBox[\\\ > \"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", \ > ButtonFrame->None, ButtonData:>\\\"General::ssle\\\"]\\)\""}]\), > > --------------- > > Two changes to the function definition can avoid the error. Drop the > NumberQ which from your preamble does not seem optimum or drop > the "indexing" of the function, e.g. go with blah[a_?NumberQ] := a^2 or > blah1, blah2, etc, which may or may not fit the design of your code. > > You can also just turn off the message as it seems the the NMinimize does > evaluate once it gets numeric values. > > Tom Zeller > Wolfram Research Technical Support The indexing was only important because I needed to filter (hide) certain Parts of a complicated argument (a function and some constraints) to NMinimize. I decided to make the index of the "screening symbol" match the Part of the original expression it screened. One workaround is to simply generate a unique symbol for each part instead of indexing one symbol (which is the same as your "drop the indexing" workaround). Thanks for sending the code to QC. -- http://chris.chiasson.name/