Message Boards Message Boards

0
|
3872 Views
|
1 Reply
|
3 Total Likes
View groups...
Share
Share this post:

[Solved] How to set up this minimization problem?

Posted 3 years ago

labspace[l, a, b, i, cs_] := Block[{}, (List @@ ColorConvert[ColorConvert[LABColor[{l, a, b}], cs], "LAB"])[[i]]];

lmindata = 
  NMinimize[{labspace[l, a, b, 1, 
     "HSB"], (-1 <= l <= 2) \[And] (-3 <= a <= 9) \[And] (-6 <= b <= 
       2)}, {l, a, b}, AccuracyGoal -> 3, PrecisionGoal -> 3];
Print[lmindata];

... lots of errors follow

Is NMinimize not the correct choice, or ?

POSTED BY: Richard Frost

Richard, I guess you basically have to define your function labspace in a way to prohibit evaluation of non-numeric arguments. Try:

labspace[l_?NumericQ, a_?NumericQ, b_?NumericQ, i_, cs_] := 
 ColorConvert[ColorConvert[LABColor[l, a, b], cs], "LAB"][[i]]
POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract