Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7225

Re: NMinimize problem: fct minimized uses FindRoot

From Oliver Ruebenkoenig <ruebenko@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: NMinimize problem: fct minimized uses FindRoot
Date 2011-12-15 09:57 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jccgav$mgi$1@smc.vnet.net> (permalink)
References <201112141101.GAA10168@smc.vnet.net>

Show all headers | View raw



On Wed, 14 Dec 2011, Oleksandr Rasputinov wrote:

> On Tue, 13 Dec 2011 10:54:13 -0000, Oliver Ruebenkoenig
> <ruebenko@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.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: NMinimize problem: fct minimized uses FindRoot Oliver Ruebenkoenig <ruebenko@wolfram.com> - 2011-12-15 09:57 +0000

csiph-web