Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: FindMinimum var specification

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8875] Re: [mg8828] FindMinimum var specification
  • From: seanross at worldnet.att.net
  • Date: Tue, 30 Sep 1997 20:16:40 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Bernd Gehrmann wrote:
> 
> Hello,
> 
> why does the following not work (and how can
> I make it work)?
> 
> vars := Sequence[{x[1],0.1},{x[2],0.1}];
> 
> ...
> 
> FindMinimum[x[1]^2 + x[2]^2, vars];
> 
> Bernd.

The error message about HoldForm gives you the clue.  := is a delayed
assignment.  Putting a delayed assignment into a function argument gives
it the attribute HoldForm, so it never gets assigned. The way around
this is to use delayed assignment and then use Evaluate to make sure
that the delayed equals gets evaluated before being passed on to the
function.

vars := Apply[Sequence,{{x,0.1},{y,0.1}}];  OR
vars := Sequence[{x,0.1},{y,0.1}]; OR
vars = Sequence[{x,0.1},{y,0.1}]; 

FindMinimum[x^2 + y^2, Evaluate[vars]]  works just fine.

my question is why an immediate assignment
vars=Sequence[{x,0.1},{y,0.1}]; still needs to have an Evaluate wrapped
around it.


  • Prev by Date: Re: Unsolved integral
  • Next by Date: Piecewise functions
  • Previous by thread: FindMinimum var specification
  • Next by thread: Re: FindMinimum var specification