Skip to main content
Commonmark migration
Source Link

###Update

Update

###Update

Update

deleted 1 character in body
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259
test = List[RepeatedNull[_Real?(Between[#, {-1., 1.}] &)]];
badParamMsg = 
  "one of the inputs, w-upper, w-lower or dz, is invalid";
okMsg = Invisible[
   "one of the inputs, w-upper, w-lower or dz, is invalid"];

Manipulate[
  If[MatchQ[wlo, test] && MatchQ[wup, test] && MatchQ[dz, _Real],
    pts = cst[wlo, wup, dz]; msg = okMsg,
    pts = {}; msg = badParamMsg];
  Column[
    {ListPlot[pts, Frame -> True, ImageSize -> {500, Automatic}],
     Style[Row[{"Message  ", Framed[msg]}], "SR", 11]},
    Center],
  {{wup, {.19, .21, .29, .27, .3, .2, .1}, "w-upper"},
    InputField, ImageSize -> {500, Automatic}}, 
  {{wlo, {-.12, -.13, -.14, -.16, -.15, -.2, -.1}, "w-lower"}, 
    InputField, ImageSize -> {500, Automatic}},
  {{dz, .0002, "dz"}, InputField, ImageSize -> {50, Automatic}},
  {{pts, {}}, None},
  {{msg, noWMsgokMsg}, None},
  TrackedSymbols :> {wlo, wup, dz}],
  SaveDefinitions -> True]
test = List[RepeatedNull[_Real?(Between[#, {-1., 1.}] &)]];
badParamMsg = 
  "one of the inputs, w-upper, w-lower or dz, is invalid";
okMsg = Invisible[
   "one of the inputs, w-upper, w-lower or dz, is invalid"];

Manipulate[
  If[MatchQ[wlo, test] && MatchQ[wup, test] && MatchQ[dz, _Real],
    pts = cst[wlo, wup, dz]; msg = okMsg,
    pts = {}; msg = badParamMsg];
  Column[
    {ListPlot[pts, Frame -> True, ImageSize -> {500, Automatic}],
     Style[Row[{"Message  ", Framed[msg]}], "SR", 11]},
    Center],
  {{wup, {.19, .21, .29, .27, .3, .2, .1}, "w-upper"},
    InputField, ImageSize -> {500, Automatic}}, 
  {{wlo, {-.12, -.13, -.14, -.16, -.15, -.2, -.1}, "w-lower"}, 
    InputField, ImageSize -> {500, Automatic}},
  {{dz, .0002, "dz"}, InputField, ImageSize -> {50, Automatic}},
  {{pts, {}}, None},
  {{msg, noWMsg}, None},
  TrackedSymbols :> {wlo, wup, dz}]
test = List[RepeatedNull[_Real?(Between[#, {-1., 1.}] &)]];
badParamMsg = 
  "one of the inputs, w-upper, w-lower or dz, is invalid";
okMsg = Invisible[
   "one of the inputs, w-upper, w-lower or dz, is invalid"];

Manipulate[
  If[MatchQ[wlo, test] && MatchQ[wup, test] && MatchQ[dz, _Real],
    pts = cst[wlo, wup, dz]; msg = okMsg,
    pts = {}; msg = badParamMsg];
  Column[
    {ListPlot[pts, Frame -> True, ImageSize -> {500, Automatic}],
     Style[Row[{"Message  ", Framed[msg]}], "SR", 11]},
    Center],
  {{wup, {.19, .21, .29, .27, .3, .2, .1}, "w-upper"},
    InputField, ImageSize -> {500, Automatic}}, 
  {{wlo, {-.12, -.13, -.14, -.16, -.15, -.2, -.1}, "w-lower"}, 
    InputField, ImageSize -> {500, Automatic}},
  {{dz, .0002, "dz"}, InputField, ImageSize -> {50, Automatic}},
  {{pts, {}}, None},
  {{msg, okMsg}, None},
  TrackedSymbols :> {wlo, wup, dz},
  SaveDefinitions -> True]
Fixed error test in interactive code
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259
badWMsgtest = "w-upper andList[RepeatedNull[_Real?(Between[#, w{-lower1., do1.}] not&)]];
badParamMsg have= the 
 same number"one of elements";
noWMsgthe =inputs, Invisible["ww-upper and, w-lower door notdz, haveis theinvalid";
okMsg same= numberInvisible[
   "one of elements"];the inputs, w-upper, w-lower or dz, is invalid"];

Manipulate[
  If[Length[wlo]If[MatchQ[wlo, ==test] Length[wup]&& MatchQ[wup, test] && MatchQ[dz, _Real],
    pts = cst[wlo, wup, dz]; msg = noWMsgokMsg,
    pts = cst[wlo, wup, dz];{}; msg = badWMsg];badParamMsg];
  Column[
    {ListPlot[pts, Frame -> True, ImageSize -> {500, Automatic}],
     Style[Row[{"Message  ", Framed[msg]}], "SR", 11]},
    Center],
  {{wup, {.19, .21, .29, .27, .3, .2, .1}, "w-upper"},
    InputField, ImageSize -> {500, Automatic}}, 
  {{wlo, {-.12, -.13, -.14, -.16, -.15, -.2, -.1}, "w-lower"}, 
    InputField, ImageSize -> {500, Automatic}},
  {{dz, .0002, "dz"}, InputField, ImageSize -> {50, Automatic}},
  {{pts, {}}, None},
  {{msg, noWMsg}, None},
  TrackedSymbols :> {wlo, wup, dz}]

interactiveinteractive

badWMsg = "w-upper and w-lower do not have the same number of elements";
noWMsg = Invisible["w-upper and w-lower do not have the same number of elements"];

Manipulate[
  If[Length[wlo] == Length[wup],
    pts = cst[wlo, wup, dz]; msg = noWMsg,
    pts = cst[wlo, wup, dz]; msg = badWMsg];
  Column[
    {ListPlot[pts, Frame -> True, ImageSize -> {500, Automatic}],
     Style[Row[{"Message  ", Framed[msg]}], "SR", 11]},
    Center],
  {{wup, {.19, .21, .29, .27, .3, .2, .1}, "w-upper"},
    InputField, ImageSize -> {500, Automatic}}, 
  {{wlo, {-.12, -.13, -.14, -.16, -.15, -.2, -.1}, "w-lower"}, 
    InputField, ImageSize -> {500, Automatic}},
  {{dz, .0002, "dz"}, InputField, ImageSize -> {50, Automatic}},
  {{pts, {}}, None},
  {{msg, noWMsg}, None},
  TrackedSymbols :> {wlo, wup, dz}]

interactive

test = List[RepeatedNull[_Real?(Between[#, {-1., 1.}] &)]];
badParamMsg =  
  "one of the inputs, w-upper, w-lower or dz, is invalid";
okMsg = Invisible[
   "one of the inputs, w-upper, w-lower or dz, is invalid"];

Manipulate[
  If[MatchQ[wlo, test] && MatchQ[wup, test] && MatchQ[dz, _Real],
    pts = cst[wlo, wup, dz]; msg = okMsg,
    pts = {}; msg = badParamMsg];
  Column[
    {ListPlot[pts, Frame -> True, ImageSize -> {500, Automatic}],
     Style[Row[{"Message  ", Framed[msg]}], "SR", 11]},
    Center],
  {{wup, {.19, .21, .29, .27, .3, .2, .1}, "w-upper"},
    InputField, ImageSize -> {500, Automatic}}, 
  {{wlo, {-.12, -.13, -.14, -.16, -.15, -.2, -.1}, "w-lower"}, 
    InputField, ImageSize -> {500, Automatic}},
  {{dz, .0002, "dz"}, InputField, ImageSize -> {50, Automatic}},
  {{pts, {}}, None},
  {{msg, noWMsg}, None},
  TrackedSymbols :> {wlo, wup, dz}]

interactive

Loading
Added an interactive version of the code
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259
Loading
deleted 4 characters in body
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259
Loading
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259
Loading