Message Boards Message Boards


[Solved] How to set up this minimization problem?

Posted 1 year ago
1 Reply
3 Total Likes

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];

... 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
or Discard

Group Abstract Group Abstract