Message Boards Message Boards

0
|
5450 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?]Plot table of orbital parameters and dynamically change some properties?

Posted 4 years ago

I am computing a table of orbital parameters where I can change some orbital properties. The first time I run the script after a global clear (ClearAll["Global`*"]), the script fails with an error message but if I run it again, it works correctly. I am unable to understand what is happening. An example calculation that I think mirrors the control flow of the calculation is

Column[{Labeled[Manipulate[Module[{},
     y = ConstantArray[14, {10, 4}];
     x = y[[1 ;; n]];
     headings = 
      Map[Style[#, Bold] &, {"col 1", "col 2", "col 3", "col 4"}];
     PrependTo[x, headings];
     Grid[x, Alignment -> Center, Frame -> All, 
      Background -> {None, {LightGray, None}}]], {{n, 1, 
      Style["Nums", 12, Bold]}, Range[10], ControlType -> PopupMenu}],
    Style["Circular Orbits", 16, Bold], Top], 
  Labeled[Manipulate[Module[{},
     y = ConstantArray[k, {10, 4}];
     x = y[[1 ;; m]];
     headings = 
      Map[Style[#, Bold] &, {"col 1", "col 2", "col 3", "col 4"}];
     PrependTo[x, headings];
     Grid[x, Alignment -> Center, Frame -> All, 
      Background -> {None, {LightGray, None}}]], {{m, 1, 
      Style["Nums", 12, Bold]}, Range[10], 
     ControlType -> PopupMenu}, {{k, 1, Style["Const", 12, Bold]}, 
     Range[10], ControlType -> PopupMenu}], 
   Style["Circular Orbits", 16, Bold], Top]}]

This script runs correctly after the global clear. The file that fails is attached. Perhaps someone more skilled at Mathematica can understand what is going on.

Thanks, Mike

Attachments:
POSTED BY: Mike Luntz
2 Replies
Posted 4 years ago

The choice alternatives for the PopupMenu's was not known when starting from scratch. Therefore the errors. In the attached I have defined them as local variables with initial values.

Also the evaluation of the Manipulate's was continuously being triggered. So I added the TrackedSymbols option.

First Manipulate:

    {{maxht, 200, Style["Maximum Altitude", Medium]}, heightList, ControlType -> PopupMenu},
    (* Constant *)
    {{heightList, {200, 400, 600, 1000, 1500, 2000, 4000, 6000, 10000,15000, 20000,22236}},ControlType -> None},
    (* Option *)
    TrackedSymbols :> {maxht}
    (* End Manipulate *)
],

Second Manipulate:

     {{perUheight, 200, Style["Perigee Height", Medium]}, perHtList, ControlType -> PopupMenu},
     (* Constants *)
     {{eccentricityList, Range[.0, .95, .05]}, ControlType -> None},
     {{perHtList, {100, 200, 400, 600, 1000, 1500, 2000}}, ControlType -> None},
     (* Option *)
     TrackedSymbols :> {maxEcc, perUheight}
     (* End Manipulate *)
],
Attachments:
POSTED BY: Hans Milton
Posted 4 years ago

Many thanks, Hans. With my limited understanding of Mathematica I would have never figured that out. Mike

POSTED BY: Mike Luntz
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