Message Boards Message Boards

GROUPS:

[Solved] How to set up this minimization problem?

Posted 9 months ago
1227 Views
|
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];
Print[lmindata];

... lots of errors follow

Is NMinimize not the correct choice, or ?

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