MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NMinimize problem: fct minimized uses FindRoot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123668] Re: NMinimize problem: fct minimized uses FindRoot
  • From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
  • Date: Thu, 15 Dec 2011 04:53:15 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201112141101.GAA10168@smc.vnet.net>


On Wed, 14 Dec 2011, Oleksandr Rasputinov wrote:

> On Tue, 13 Dec 2011 10:54:13 -0000, Oliver Ruebenkoenig
> <ruebenko at wolfram.com> wrote:
>
>>
>> On Mon, 12 Dec 2011, Oleksandr Rasputinov wrote:
>>
>>> For example, the erroneous usage:
>>>
>>> Block[{a = 1, b = 2}, Return[a]; Return[b]]
>>
>> You can "fix" this by using
>>
>> Block[{a = 1, b = 2}, Return[a, Block]; Return[b]]
>>
>> but Throw/Catch is probably a better bet.
>>
>> Oliver
>>
>
> Interesting; this two-argument form of Return seems like it could be quite
> useful. However, as far as I can see, this possibility has never been
> listed on the main page for Return, nor on those for Break or Continue
> (with which a second argument can also be used), even though it has been
> allowed since version 4 at the latest. The only documentation that I could
> find suggesting that it exists at all is for the message (Return::nofunc)
> that one sees after using it incorrectly. Is this likely to change in
> future, or has it been left deliberately undocumented to discourage its
> use?
>
>

I am not exactly sure, but I think Return has been left as it is since a 
change might break too much legacy code. As for why the two argument 
Return is not a full-fledged citizen I don't know.

As has been suggested on this thread throw/catch is a better and some say 
more modern approach to this.




  • Prev by Date: Re: Overlaid parametric plots are too faint
  • Next by Date: Re: "Need tutor" scam on newsgroup?
  • Previous by thread: Re: NMinimize problem: fct minimized uses FindRoot
  • Next by thread: Re: NMinimize problem: fct minimized uses FindRoot