Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have data showing truncated octahedron geometry changing with time. How can I read those data into a Manipulate expression? To be specific, I want to manipulate time and have other parameters change correspondingly as in my data. Those parameter value should show simultaneously.

Now I have geometry that I can change by varying the parameters. My Manipulate code is

Manipulate[
 Grid[{{RegionPlot3D[
     x + y + z < 0.866 A && x + y - z < 0.866 A && 
      x - y + z < 0.866 A && -x + y + z < 0.866 A && 
      x + y + z > -0.866 A && x + y - z > -0.866 A && 
      x - y + z > -0.866 A && -x + y + z > -0.866 A, {x, -0.5*r*A, 
      0.5*r*A}, {y, -0.5*r*A, 0.5*r*A}, {z, -0.5*r*A, 0.5*r*A}, 
     ImageSize -> 300, Mesh -> 1, PlotRange -> {-16, 16}], 
    SpanFromLeft, SpanFromLeft}, {"volume(nm^3)", 
    ScientificForm[
     NIntegrate[
      Boole[void = 
        x + y + z < 0.866 A && x + y - z < 0.866 A && 
         x - y + z < 0.866 A && -x + y + z < 0.866 A && 
         x + y + z > -0.866 A && x + y - z > -0.866 A && 
         x - y + z > -0.866 A && -x + y + z > -0.866 A], {x, -0.5*r*A,
        0.5*r*A}, {y, -0.5*r*A, 0.5*r*A}, {z, -0.5*r*A, 0.5*r*A}], 
     3] }, {"{002}Facets area(nm^2)", 
    ScientificForm[12*(0.866 A - 0.5*r*A)^2, 
     3]}, {"{111}Facets area(nm^2)", 
    ScientificForm[
     4*(3)^(0.5)*((0.866 A)^2 - 3*(0.866 A - 0.5*r*A)^2), 3]}}], 
  {{A, 20, "Distance between {111} facets (nm)"}, 1, 20, Slider, Appearance -> "Labeled"}, 
  {{r, 1.4, "Aspect ratio"}, 1.04, 1.4, Slider, Appearance -> "Labeled"}, 
  ControlPlacement -> Top]

And a small subset of my data is

Time  A      r 
200   16.09  1.084524549
210   15.74  1.062261753
220   15.02  1.053262317
225   14.59  1.067169294
235   14.21  1.073187896
share|improve this question
    
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! –  belisarius Jun 2 at 1:03

1 Answer 1

up vote 4 down vote accepted
DynamicModule[{o, g, r, q, l, A, lim, x, y, z},
 o = Cos[Pi/6]; g = 0.5; 
 l = {{200, 16.09, 1.084524549}, {210, 15.74, 1.062261753}, {220, 15.02, 1.053262317}, 
      {225, 14.59, 1.067169294}, {235, 14.21, 1.073187896}};
 q = x + y + z < o A && x + y - z < o A  && 
     x - y + z < o A && -x + y + z < o A && x + y + z > -o A && 
    x + y - z > -o A && x - y + z > -o A && -x + y + z > -o A;
 lim = {{x, -g r A, g r A}, {y, -g r A, g r A}, {z, -g r A, g r A}};
 Manipulate[(
  {A, r} = Select[l, #[[1]] == t &][[1, 2 ;; 3]];
   Grid[{{RegionPlot3D[q, Evaluate[Sequence @@ lim], Mesh -> 1, PlotRange -> 16 {-1, 1}]}, 
         {"volume(nm^3)", NIntegrate[Evaluate@Boole[q], Evaluate[Sequence @@ lim]]}, 
         {"{002}Facets area(nm^2)", 12 (o A - g r A)^2}, 
         {"{111}Facets area(nm^2)", 4 3^g ((o A)^2 - 3 (o A - g r A)^2)}}]), 
   {t, l[[All, 1]],  ControlType -> Slider}, SaveDefinitions -> True]]

Mathematica graphics

share|improve this answer
    
Wonderful, You excellent coding makes the structure much clearer! But is it possible to make the time as slide bar with dispersed value? As it makes people much easier to play the evolution with the changing time. –  Jack Zhang Jun 2 at 0:56
    
The slide bar that you can only slide to the value that is recorded in the data. For instance, 200, 210, 220... but not any value between. –  Jack Zhang Jun 2 at 1:02
    
Fantastic! Such amazing, I feel so much to learn in the mathematica! If possible, we would like to acknowledge your help once our research is published. Could you please leave any contact? You can always reach me by zezhong.zhang@monash.edu –  Jack Zhang Jun 2 at 1:24
    
And there is a small bug with Evaluate function, that the image and volume used the evaluate does not change with parameters or time. –  Jack Zhang Jun 2 at 2:10
1  
one small complaint: using l as variable is not good idea as it appears as 1 depending on font and screen mode which can be confusing. May be better to use another letter instead of l –  Nasser Jun 2 at 3:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.