{
  "information": {
    "Title": "Newton Cradle 2D Realistic Collision",
    "Author": [
      "Fu-Kwun Hwang and lookang (weelookang@gmail.com)",
      "lookang",
      "Francisco Esquembre"
    ],
    "AuthorLogo": [
      "./NewtonCradle/01authorfu-kwun.hwang.png",
      "./01authorlooakng50x50.png",
      "./01authorPacoEsquembre2011.png"
    ],
    "Password": "",
    "Keywords": "Collisions, Events, conservation of kinetic energy momentum",
    "Abstract": "This is a simulation of the classical executive's toy. Multiple collisions among the balls are simulated using a single event with arrays.\nhttp://weelookang.blogspot.sg/2015/06/ejss-newtons-cradle-model.html\n\nhttp://weelookang.blogspot.com/2011/05/ejs-open-source-newtons-cradle-java.html Designed by Fu-Kwun Hwang http://www.phy.ntnu.edu.tw/ntnujava/ remixed by lookang http://weelookang.blogspot.com/ http://weelookang.blogspot.sg/2015/06/ejss-newtons-cradle-model.html\n\n  \n  Newton Cradle Model in 2D (left) and 3D (centre) view with scientific representation (right).  \nNewton's Cradle Model\nreference: http://en.wikipedia.org/wiki/Newton%27s_cradle Newton's cradle, named after Sir Isaac Newton, is a device that demonstrates conservation of momentum and energy via a series of swinging spheres.  Construction in 3D A typical Newton's cradle consists of a series of identically sized metal balls suspended in a metal frame so that they are just NOT touching each other at rest. Each ball is attached to the frame by two wires of equal length angled away from each other. This restricts the pendulums' movements to the same plane. \nMathematical Model:\nthe simplified equations of motion is ODE for a single mass(pendulum) are: d (cta)/dt = omega d(omega)/dt = -g*sin(cta)/L  when extended to n array of masses, for for(int i=0;i<n;i++){ d (cta[i])/dt = omega[i] d(omega[i])/dt = -g*sin(cta[i])/L\u00a0 // simplified add here from air drag } the zero condition type as \"State event\" with the following code  // start of code for zero condition double min = TOLERANCE; for(int i=0;i<n-1;i++){ \u00a0if(cta[i]>cta[i+1]+TOLERANCE){//<TOLERANCE){// collision between i and i+1; \u00a0 cid=i; \u00a0 return cta[i+1]-cta[i]; \u00a0} } return TOLERANCE;// no collision //end of code for zero condition  The action is to assumes the collision are modeled by perfectly elastic collision in one dimension with angular momentum conserved the code is as below. // start of code for action m1=m[cid]; m2=m[cid+1]; v1=L*omega[cid]; v2=L*omega[cid+1]; va=((m1-m2)*v1+2*m2*v2)/(m1+m2);// velocity after collision vb=(2*m1*v1+(m2-m1)*v2)/(m1+m2); omega[cid]=va/L;// back to omega omega[cid+1]=vb/L; //end of code for action  \nDesign features:\ncurrently, the simulation allows of exploration of n max = 7 masses with each mass m[i] that can be vary from the slider control from 1 to 5 kg. additional variables are: gravitational constant downward g = 9.81 m/s^2 Length of pendulums, L k coefficicent of air resistance model by equation F = k*omega  The usabilty control: To move the balls, move the cursor over to the mass, click and hold the left mouse and drag the mouse to lift the masses. note that all masses are selectable and movable to a new height along the each path of the pendulums swing.  \nDesign Views:\nthere are 2 types views available selectable by the check-boxes 2D and 3D, 2D world view 3D world view hint: \u00a0\u00a0\u00a0 may be useful to observe the transfer of linear momentum from ball to ball by pressing the step button to aid understanding of momentum transfer during collisions \u00a0\u00a0\u00a0 may be useful to observe the scientific representations of kinetic energies KE[i], gravitational potential energies PE[i] and total mechanical energies TE[i] graph of scientific representations of kinetic energies KE total, gravitational potential energies PE total and total mechanical energies TE total \nExercises:\nselect n =2 for a simple 2 ball system for the experiment.  Pull and release one ball. Note the results and explain mathematically in terms of conservation of engergy and momentum. m1 u1 + m1 u1 = m1 v1+ m2 v2 1/2 m1 u1^2 + 1/2 m2 u2^2 = 1/2 m1 v1^2 + 1/2 m2 v2^2 record your observations and discuss if the two equations above can account for the observations  select n = 3 , 4, 5, 6, 7 and repeat the experiment above. Do the results meet your expectations? hint: can you conclude that the just before and just after collisions momentum in = momentum out kinetic energies in = kinetic energies out. the clue lies in the conservation of momentum and kinetic energies just before and after collisions.  \u00a0 Discuss what are the differences between this computer model and real life apparatus. hint: the newton's cradle motion will continue in this back and fro motion until all energies are lost to damping due to air resistance, friction, sound and vibrations.  In this simulation the default is all balls have the same mass. What would occur if this was not the case?   Advanced Learner: Please submit your remix model that model features that are not available in the existing virtual lab and share your model with the world through NTNUJAVA Virtual Physics Laboratory http://www.phy.ntnu.edu.tw/ntnujava/index.php?board=28.0. Impacting the world with your model now. \nCredits:\nThe Newton's Cradle Model was created by Fu-Kwun Hwang, customized by Loo Kang WEE, using the Easy Java Simulations (EJS) version 4.3.3.2 authoring and modeling tool.\u00a0 An applet version of this model is available on the NTNU website < \nhttp://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2195.0 >.\nYou can examine and modify this compiled EJS model if you run the model (double click on the model's jar file), right-click within a plot, and select \"Open EJS Model\" from the pop-up menu.\u00a0 You must, of course, have EJS installed on your computer.\u00a0 Information about EJS is available at: <http://www.um.es/fem/Ejs/> and in the OSP comPADRE collection <http://www.compadre.org/OSP/>.",
    "Copyright": "",
    "Level": "Medium",
    "Language": "English",
    "Logo": [
      "./NewtonCradle/Screen Shot 2017-04-17 at 11.48.58 AM.png"
    ],
    "RunAlways": "true",
    "ModelTab": "",
    "ModelTabTitle": "",
    "ModelName": "",
    "FixedNavigationBar": "false",
    "CSSFile": "",
    "DetectedFiles": [
      "./01authorPacoEsquembre2011.png",
      "./01authorlooakng50x50.png",
      "./NewtonCradle/01authorfu-kwun.hwang.png",
      "./NewtonCradle/Screen Shot 2017-04-17 at 11.48.58 AM.png"
    ],
    "AuxiliaryFiles": [
      "./NewtonCradle/"
    ],
    "HTMLHead": "<script async=\"true\" src=\"https://www.googletagmanager.com/gtag/js?id=UA-3326007-19\"></script>\n<script>\n  window.dataLayer = window.dataLayer || [];\n  function gtag(){dataLayer.push(arguments);}\n  gtag('js', new Date());\n  gtag('config', 'UA-3326007-19');\n</script>\n<script data-ad-client=\"ca-pub-0121577198857509\" async=\"true\" src=\"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>\n\n<script type=\"text/javascript\" async=\"true\"\n src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML\">\n</script>",
    "SaveInXMLFormat": "false",
    "IncludeSource": "true",
    "IncludeLibrary": "true",
    "UglifyJS": "false",
    "PreviewFullModel": "false",
    "UseInterpreter": "true",
    "UseDeltaForODE": "false"
  },
  "description": {
    "pages": [
      {
        "Name": "Intro Page",
        "Active": "true",
        "Internal": "false",
        "Type": "DESCRIPTION_EDITOR",
        "Locale": "_default_",
        "Title": "Intro Page",
        "External": "false",
        "Code": "<html>\n<head></head>\n<body>\n<p> </p><p style=\"margin-top: 0\">      &lt;h2&gt;Newton's cradle&lt;/h2&gt;    </p><p> </p><p style=\"margin-top: 0\">      <a target=\"_blank\" href=\"https://www.youtube.com/watch?v=hhY8O0uwD6I\" alt=\"https://www.youtube.com/watch?v=hhY8O0uwD6I\">https://www.youtube.com/watch?v=hhY8O0uwD6I</a>\u200b</p><p style=\"margin-top: 0\">&lt;p&gt;Newton's cradle is a device that demonstrates conservation of       momentum and energy using a series of swinging spheres. When one sphere       at the end is lifted and released, it strikes the stationary spheres,       transmitting a force through the stationary spheres that pushes the last       sphere upward. The last sphere swings back and strikes the still nearly       stationary spheres, repeating the effect in the opposite direction. The       device is named after 17th-century English scientist Sir Isaac Newton.       It is also known as Newton's pendulum, Newton's balls, Newton's rocker       or executive ball clicker (since the device makes a click each time the       balls collide, which they do repeatedly in a steady rhythm).&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;A typical Newton's cradle consists of a series of identically sized       metal balls suspended in a metal frame so that they are just touching       each other at rest. Each ball is attached to the frame by two wires of       equal length angled away from each other. This restricts the pendulums'       movements to the same plane.&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;h2&gt;Controls&lt;/h2&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;The first comboBox allows eay selection of number of balls in the       Newton's cradle&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 1 ball to the left&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 2 balls to the left&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 3 balls to the left&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 4 balls to the left&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 5 balls to the left&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 6 balls to the left&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 7 balls to the left&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 1 ball 1 raises 1 ball to the left and 1 ball to the right&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 2 ball 1 raises 2 ball to the left and 1 ball to the right&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 2 ball 2 raises 2 balls to the left and 2 balls to the right&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; 3 ball 3 raises 3 balls to the left and 3 balls to the right&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;n is the number of balls allowed&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;i is the index of the ball to change&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;for which m[i] is the mass of the index ball&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;play button starts the simulation&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;reset button starts the simulation at afresh&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;h2&gt;Physics explanation&lt;/h2&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;Newton's cradle can be modeled fairly accurately with simple       mathematical equations with the assumption that the balls always collide       in pairs.&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; The motion of the balls are modelled using $ \\frac{d\\theta[i]}{dt} =       \\omega[i]$ &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;where $\\theta$ is the angle of the ball&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; $ \\omega $ is the angular velocity &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; i represents each element of the ball&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; t is time &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; the second order differential equation is       $\\frac{d(\\omega[i])}{dt}=-\\frac{g*sin(\\theta[i])}{L}-k*L*\\omega[i] $ &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; where g is gravitational constant 9.81 $m/s^2$ &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; L is the length of the inextensible string connecting the ball to       the support for rotational motion &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; k is a resistant coefficient to rotational motion $ \\omega $ &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;h2&gt;Events of the ordinary differential equations&lt;/h2&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;In a state event, a TOLERANCE =1.0e-6 is defined, a loop to check       through each ball i, where a check of the $\\theta[i]$ is greater than       $\\theta[i+1]$ plus the TOLERANCE, if true, return the balls to their       closed up angular position $\\theta[i+1]-\\theta[i]$. If false, do       nothing. &lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;The following actions are carried out at the end of the event&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$m_{1}=m[cid]$ where $m_{1}$ is a dummy variable to contain mass of       collision with index = cid&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$m_{2}=m[cid+1]$;where $m_{2}$ is a dummy variable to contain mass of       collision with index = cid+1&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$v_{1}=L*\\omega[cid]$;&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$v_{2}=L*\\omega[cid+1]$;&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$v_{a}=\\frac{((m_{1}-m_{2})*v_{1}+2*m_{2}*v_{2})}{(m_{1}+m_{2})}$;//       velocity after collision&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$v_{b}=\\frac{(2*m_{1}*v_{1}+(m_{2}-m_{1})*v_{2})}{(m_{1}+m_{2})}$;&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$\\omega[cid]=\\frac{v_{a}}{L}$;// back to omega&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;$\\omega[cid+1]=\\frac{v_{b}}{L}$;&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;h2&gt;Fixed Relationship Calculations&lt;/h2&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt;There is a for loop over i=0 to i less than number of balls to       calculate the following to constraint the masses to move in       pendulum-part of a circular path&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; $ dx[i]=L*(sin \\theta[i]) $ where dx[i] is the change is x[i]       position&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; $ dy[i]=-L*cos(\\theta[i]) $ where dy[i] is the change in y[i]       position&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; x[i]=xc[i]+dx[i] where xc[i] is each balls centre or equilibrium x       position&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; y[i]=ymax+dy[i] where ymax is the support y position&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; $ vx[i]=L*\\omega[i]*cos(\\theta[i]) $ where vx[i] is the x direction       linear velocities of each ball&lt;/p&gt;    </p><p> </p><p style=\"margin-top: 0\">      &lt;p&gt; $ vy[i]=L*\\omega[i]*sin(\\theta[i]) $ where vy[i] is the y direction       linear velocities of each ball&lt;/p&gt;    </p><p> </p>\n</body>\n</html>"
      }
    ]
  },
  "model": {
    "variables": {
      "pages": [
        {
          "Name": "coordinate",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "range",
              "Value": "1.2",
              "Type": "double",
              "Dimension": "",
              "Comment": "range",
              "Domain": "protected"
            },
            {
              "Name": "xmin",
              "Value": "-range/2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "xmax",
              "Value": "range/2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "ymin",
              "Value": "-range/2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "ymax",
              "Value": "range/2",
              "Type": "double",
              "Dimension": "",
              "Comment": "yTop",
              "Domain": "protected"
            },
            {
              "Name": "t",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "dt",
              "Value": "0.01",
              "Type": "double",
              "Dimension": "",
              "Comment": "time step",
              "Domain": "protected"
            },
            {
              "Name": "size",
              "Value": "range/10",
              "Type": "double",
              "Dimension": "",
              "Comment": "particle size",
              "Domain": "protected"
            },
            {
              "Name": "size2",
              "Value": "size/2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "stroke",
              "Value": "2.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "pi",
              "Value": "Math.PI",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "L",
              "Value": "1",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "g",
              "Value": "9.8",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "TOLERANCE",
              "Value": "0.001",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "vscale",
              "Value": "0.3",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "sound",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            }
          ]
        },
        {
          "Name": "basic",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "n",
              "Value": "7",
              "Type": "int",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "n1",
              "Value": "n-1",
              "Type": "int",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "cid",
              "Value": "0",
              "Type": "int",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "m",
              "Value": "1.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "cta",
              "Value": "",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "omega",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "x",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "y",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "z",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "xc",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "xtop ",
              "Domain": "protected"
            },
            {
              "Name": "dx",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "dy",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "vx",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "vy",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "l_m",
              "Value": "\"\"",
              "Type": "String",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "v1",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "v2",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "va",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "vb",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "m1",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "m2",
              "Value": "0.0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            }
          ]
        },
        {
          "Name": "language",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "l_play",
              "Value": "\"play\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "l_pause",
              "Value": "\"pause\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "l_reset",
              "Value": "\"reset\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "l_init",
              "Value": "\"initialize\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "label",
              "Value": "\"play\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "l_step",
              "Value": "\"step\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "l_id",
              "Value": "\"select ball ID=0\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "l_mass",
              "Value": "\"change mass to=0.0\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            }
          ]
        },
        {
          "Name": "control",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "id",
              "Value": "0",
              "Type": "int",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "mi",
              "Value": "1",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            }
          ]
        },
        {
          "Name": "lookang",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "ballMass",
              "Value": "0",
              "Type": "int",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "ballMoved",
              "Value": "0",
              "Type": "int",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "maxAngle",
              "Value": "pi/2",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "k",
              "Value": "0",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "mom",
              "Value": "",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "KE",
              "Value": "",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "PE",
              "Value": "",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "TE",
              "Value": "",
              "Type": "double",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "tetotal",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "petotal",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "ketotal",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "momtotal",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "text1",
              "Value": "\"\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "text",
              "Value": "\"Drag the balls to create different motions and click play\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "selected",
              "Value": "\"1 ball\"",
              "Type": "String",
              "Dimension": "[1]",
              "Comment": "",
              "Domain": "protected"
            }
          ]
        },
        {
          "Name": "boolean",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "",
              "Value": "",
              "Type": "double",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "graph",
              "Value": "false",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "hint",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "threeD",
              "Value": "false",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "twoD",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "mode",
              "Value": "",
              "Type": "int",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "tetotalb",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "petotalb",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "ketotalb",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "show",
              "Value": "true",
              "Type": "boolean",
              "Dimension": "[n]",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            }
          ]
        },
        {
          "Name": "layout",
          "Active": "true",
          "Internal": "false",
          "Type": "VARIABLE_EDITOR",
          "PageComment": "",
          "Variables": [
            {
              "Name": "font",
              "Value": "\"normal normal 2vw \"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "iOS",
              "Value": "/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "http://stackoverflow.com/questions/9038625/detect-if-device-is-ios",
              "Domain": "protected"
            },
            {
              "Name": "iPad",
              "Value": "/iPad/.test(navigator.userAgent) && !window.MSStream",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "http://stackoverflow.com/questions/9038625/detect-if-device-is-ios",
              "Domain": "protected"
            },
            {
              "Name": "iPhone",
              "Value": "/iPhone|iPod/.test(navigator.userAgent) && !window.MSStream",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "http://stackoverflow.com/questions/9038625/detect-if-device-is-ios",
              "Domain": "protected"
            },
            {
              "Name": "Android",
              "Value": "/Android|android/i.test(navigator.userAgent)",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "Width",
              "Value": "(_isEPub)?\"400\":\"100%\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "display width",
              "Domain": "protected"
            },
            {
              "Name": "Height",
              "Value": "(_isEPub)?\"500\":\"100%\"",
              "Type": "String",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "Width1",
              "Value": "",
              "Type": "String",
              "Dimension": "",
              "Comment": "display width",
              "Domain": "protected"
            },
            {
              "Name": "Width2",
              "Value": "",
              "Type": "String",
              "Dimension": "",
              "Comment": "display width",
              "Domain": "protected"
            },
            {
              "Name": "xvst",
              "Value": "false",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "vvst",
              "Value": "false",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "avst",
              "Value": "false",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "kevst",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "pevst",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "tevst",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "world",
              "Value": "true",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "disabledworld",
              "Value": "false",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "disabled",
              "Value": "false",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            },
            {
              "Name": "autoscaley",
              "Value": "",
              "Type": "boolean",
              "Dimension": "",
              "Comment": "",
              "Domain": "protected"
            }
          ]
        }
      ]
    },
    "initialization": {
      "pages": [
        {
          "Name": "undefined",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "if (Width1==undefined){ \n  Width1=\"100%\";\n  }\n  if (Width2==undefined){ \n  Width2=\"0%\";\n  }\n    if (kevst==undefined){ \n kevst=true;\n  }\n  if (pevst==undefined){ \n pevst=false;\n  }\n  if (tevst==undefined){ \n tevst=false;\n  }\n  \n"
        },
        {
          "Name": "Init Page",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "for(var i=0;i<n;i++){\n xc[i]=-(n/2)*size+i*size; // change to + by lookang for left to right lineup\n cta[i]=0.;\n omega[i]=0.;\n l_m[i]=m[i]+\"\";\n}\nt=0.;\nxmin = -n*size; // optimize view\nxmax = +n*size;\n//cta[0]=-pi/10;"
        },
        {
          "Name": "Axes",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "_view.plottingPanel2.getAxisX().setPosition([0,0.025]);\n_view.plottingPanel2.getTitleX().setPosition([0.95,0.045]);\n\n_view.plottingPanel2.getAxisY().setPosition([0.025,0]);\n_view.plottingPanel2.getTitleY().setPosition([0.05,0]);\n"
        },
        {
          "Name": "Init Page 2",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "\n\n\n //if ( _view.comboBox.getProperty(\"SelectedOptions\")==\"1 ball\"){\n  cta[0]= -pi/4;\n  \n // }\n  \n "
        },
        {
          "Name": "svgradial",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "var container = document.createElement('div');\nvar svggradient = '<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"><defs>'+\n  '  <radialGradient id=\"mygrandient\" cx=\"50%\" cy=\"50%\" r=\"50%\" fx=\"50%\" fy=\"50%\">'+\n  '    <stop offset=\"0%\" style=\"stop-color:rgb(0,0,0); stop-opacity:1\" />'+\n  '    <stop offset=\"100%\" style=\"stop-color:rgb(255,255,255);stop-opacity:1\" />'+\n  '  </radialGradient>'+\n  '</defs></svg>';\ncontainer.innerHTML = svggradient;\ndocument.body.appendChild(container);\n\nvar container = document.createElement('div');\nvar svggradient = '<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"><defs>'+\n  '  <radialGradient id=\"mygrandient1\" cx=\"50%\" cy=\"50%\" r=\"80%\" fx=\"30%\" fy=\"30%\">'+\n  '    <stop offset=\"0%\" style=\"stop-color:rgb(0,0,0); stop-opacity:1\" />'+\n  '    <stop offset=\"100%\" style=\"stop-color:rgb(255,255,255);stop-opacity:1\" />'+\n  '  </radialGradient>'+\n  '</defs></svg>';\ncontainer.innerHTML = svggradient;\ndocument.body.appendChild(container);\n//\"url(#mygrandient1)\"\n\nvar container = document.createElement('div');\nvar svggradient = '<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"><defs>'+\n  '  <radialGradient id=\"mygrandient2\" cx=\"50%\" cy=\"50%\" r=\"70%\" fx=\"90%\" fy=\"50%\">'+\n  '    <stop offset=\"0%\" style=\"stop-color:rgb(0,255,0); stop-opacity:1\" />'+\n  '    <stop offset=\"100%\" style=\"stop-color:rgb(255,255,255);stop-opacity:1\" />'+\n  '  </radialGradient>'+\n  '</defs></svg>';\ncontainer.innerHTML = svggradient;\ndocument.body.appendChild(container);\n//\"url(#mygrandient2)\""
        },
        {
          "Name": "Init Page 3",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "if (_isMobile){\n  //do nothing\n  }\n  \n  else{\n    // copy this into the initialization\n// make the font bigger\n\n_view.plottingPanel.getMessageDecoration(\"TL\").getFont().setFontSize(\"1vw\");\n_view.plottingPanel.getMessageDecoration(\"TR\").getFont().setFontSize(\"1vw\");\n_view.plottingPanel.getMessageDecoration(\"BL\").getFont().setFontSize(\"1vw\");\n_view.plottingPanel.getMessageDecoration(\"BR\").getFont().setFontSize(\"1vw\");\n    }"
        },
        {
          "Name": "Init Page 4",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "//copy to initialization page\nMathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);\n//https://docs.mathjax.org/en/v1.0/options/tex2jax.html#configure-tex2jax\nMathJax.Hub.Config({\n  tex2jax: {\n    inlineMath: [ ['$','$'], ['\\\\(','\\\\)'] ]\n  }\n});"
        }
      ]
    },
    "evolution": {
      "information": {
        "FPS": "20",
        "SPD": "5",
        "RealTimeVariable": "",
        "Autoplay": "false"
      },
      "pages": [
        {
          "Name": "ODE",
          "Active": "true",
          "Internal": "false",
          "Type": "ODE_EDITOR",
          "Comment": "",
          "IndependentVariable": "t",
          "Increment": "dt",
          "Equations": [
            {
              "state": "cta[i]",
              "rate": "omega[i]"
            },
            {
              "state": "omega[i]",
              "rate": "-g*Math.sin(cta[i])/L-k*L*omega[i]"
            }
          ],
          "Method": "RungeKutta",
          "AbsoluteTolerance": "TOLERANCE",
          "PreliminaryCode": {
            "Code": "",
            "Comment": "Code to be executed before rate equations are evaluated"
          },
          "EventMaximumStep": "",
          "Events": {
            "pages": [
              {
                "Type": "EVENT_EDITOR",
                "Name": "\u00a8\u00c6\u00a5\u00f3",
                "Active": "true",
                "Internal": "false",
                "EventType": "STATE_EVENT",
                "Method": "BISECTION",
                "Iterations": "100",
                "Tolerance": "TOLERANCE",
                "StopAtEvent": "true",
                "ZeroCondition": "var TOLERANCE =0.0001;\nfor(var i=0;i<n-1;i++){\n if(cta[i]>cta[i+1]+TOLERANCE){//<TOLERANCE){// collision between i and i+1;\n  cid=i;\n  text= \" computing collisions \";\n  return cta[i+1]-cta[i];\n  \n }\n}\nreturn TOLERANCE;// no collision \ntext= \" Playing \";\n",
                "Action": "\nm1=m[cid];\nm2=m[cid+1];\nv1=L*omega[cid];\nv2=L*omega[cid+1];\nva=((m1-m2)*v1+2*m2*v2)/(m1+m2);// velocity after collision\nvb=(2*m1*v1+(m2-m1)*v2)/(m1+m2);\nomega[cid]=va/L;// back to omega\nomega[cid+1]=vb/L;\nvar speedforsound = 0.5;\n// sound effect added despite the energy conservation\nif (sound===true&&(Math.abs(v1)>speedforsound||Math.abs(v2)>speedforsound)){ // arbitrary set as 1\n//Toolkit.getDefaultToolkit().beep(); // taken from http://www.compadre.org/OSP/items/detail.cfm?ID=8385&Attached=1\n//Ceiling Bounce Model written by Wolfgang Christian\n_view.audio.play();\n}\n\n",
                "Comment": "check for collision"
              }
            ]
          },
          "ZenoEffect": {
            "Code": "",
            "Comment": "",
            "StopAfterEffect": "true"
          },
          "AccelerationIndependentOfVelocity": "false",
          "ForceSynchronization": "false",
          "UseBestInterpolation": "false",
          "EstimateFirstStep": "false",
          "MemoryLength": "",
          "InternalStep": "",
          "MaximumStep": "",
          "MaximumNumberOfSteps": "10000",
          "RelativeTolerance": "",
          "DelayList": "",
          "DelayMaximum": "",
          "DelayAddDiscont": "",
          "DelayInitialCondition": {
            "Code": "",
            "Comment": ""
          },
          "DirectIncidenceMatrix": "",
          "Discontinuities": {
            "pages": []
          },
          "ErrorHandling": {
            "pages": []
          }
        }
      ]
    },
    "fixed_relations": {
      "pages": [
        {
          "Name": "\u00c3\u00f6\u00abY\u00a6\u00a1",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "//graph\nketotal = 0 ; // reset to zero before it sums else without this line, it is a cummulative sum wrong is wrong\npetotal = 0 ;\ntetotal = 0 ;\nmomtotal = 0; \n\nfor(var i=0;i<n;i++){\n dx[i]=L*Math.sin(cta[i]);\n dy[i]=-L*Math.cos(cta[i]);\n x[i]=xc[i]+dx[i];\n y[i]=ymax+dy[i];\n vx[i]=L*omega[i]*Math.cos(cta[i]);\n vy[i]=L*omega[i]*Math.sin(cta[i]);\n //graph\n   KE[i] = 0.5*m[i]*L*L*omega[i]*omega[i];\n  PE[i] = m[i]*g*(-L*Math.cos(cta[i])+L);\n  TE[i] = KE[i] + PE[i];\n   // total energy \nketotal = ketotal+KE[i]; // summing all KE[i=0 to n]\npetotal = petotal+PE[i]; // code similar to ketotal+=KE;\ntetotal = tetotal+TE[i];\n// momentum\n  mom[i] = m[i]*omega[i]*L;\nmomtotal += mom[i]; \n}"
        },
        {
          "Name": "axes",
          "Active": "false",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "if (_model.isPlaying()===true) { //NEED this for conflict with initialize page values\n//_view.plottingPanel.getGrid().setFixedTickY()=(M*y+m*y2)/(M+m);\n//_view.plottingPanel.setFixedTickY()=2;\n_view.plottingPanel2.getAxisX().setAbsoluteY(_view.plottingPanel2.getGrid().getFixedTickY());\n_view.plottingPanel2.getAxisY().setAbsoluteX(_view.plottingPanel2.getGrid().getFixedTickX());\n\n\n//var getRealWorldYMin = _view.plottingPanel.getRealWorldYMin();\n//var getRealWorldYMax = _view.plottingPanel.getRealWorldYMax();\n//_view.plottingPanel.getAxisX().setPosition([0,_view.plottingPanel.getRealWorldYMin()/(_view.plottingPanel.getRealWorldYMax()-_view.plottingPanel.getRealWorldYMin())]);\n//_view.plottingPanel.getTitleX().setPosition([0.95,-_view.plottingPanel.getRealWorldYMin()/(_view.plottingPanel.getRealWorldYMax()-_view.plottingPanel.getRealWorldYMin())]);\n\n\n}"
        },
        {
          "Name": "FixRel Page",
          "Active": "true",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "text1 =  \" KE = \" + _view._format(ketotal,\"0.00\") + \" J , \"+\" \\nPE = \" + _view._format(petotal,\"0.00\") + \" J , \"+\" \\nTE = \" + _view._format(tetotal,\"0.00\") + \" J , \"+ \" \\nt = \" + _view._format(t,\"0.00\") + \" s \";"
        },
        {
          "Name": "world",
          "Active": "false",
          "Internal": "false",
          "Type": "CODE_EDITOR",
          "Comment": "",
          "Code": "if ((kevst===false)&&(pevst===false)&&(tevst===false)){\n graph=false; \n Width1=\"100%\";\n Width2=\"0%\";\n disabledworld=true;\n  }\n else if (((kevst)||(pevst)||(tevst))&&(world)){\n   graph=true;\n    Width1=\"50%\";\n Width2=\"50%\";\n  disabledworld=false;\n   }\n"
        }
      ]
    },
    "custom": {
      "pages": [
        {
          "Name": "drag",
          "Active": "true",
          "Internal": "false",
          "Type": "LIBRARY_EDITOR",
          "Comment": "",
          "Code": "function drag () {\n// Compute new angle and freeze the ball\ncta[ballMoved] = Math.atan2(x[ballMoved]-xc[ballMoved],ymax-y[ballMoved]);\nomega[ballMoved] = 0;\nz[ballMoved]=0; // for 3D\n// Limit the motion\nvar maxAngle = Math.PI/2; // change maxAngle for new limit of swing\nif (cta[ballMoved]> maxAngle) cta[ballMoved] =  maxAngle;\nif (cta[ballMoved]<-maxAngle) cta[ballMoved] = -maxAngle;\n\n// Check for one ball moving the others\nfor (var i=ballMoved+1; i<n; i++) {\n  if (cta[ballMoved]>cta[i]) { cta[i] = cta[ballMoved]; omega[i] = 0; }\n}\nfor ( i=0; i<ballMoved; i++) {\n  if (cta[ballMoved]<cta[i]) { cta[i] = cta[ballMoved]; omega[i] = 0; }\n}\n\n/*\n// Force constant rod length\nfor (int i=0; i<n; i++) {\n  x[i] = xTop[i] + l*Math.sin(alpha[i]);\n  y[i] = yTop - l*Math.cos(alpha[i]);\n}\n*/\n\n\n\n\n}\n"
        },
        {
          "Name": "Lib Page",
          "Active": "true",
          "Internal": "false",
          "Type": "LIBRARY_EDITOR",
          "Comment": "",
          "Code": "//https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode\n// does not work for iOS \n/*jslint browser:true */\nfunction toggleFullScreen() {\n  if (!document.fullscreenElement &&    // alternative standard method\n      !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) {  // current working methods\n    if (document.documentElement.requestFullscreen) {\n      document.documentElement.requestFullscreen();\n    } else if (document.documentElement.msRequestFullscreen) {\n      document.documentElement.msRequestFullscreen();\n    } else if (document.documentElement.mozRequestFullScreen) {\n      document.documentElement.mozRequestFullScreen();\n    } else if (document.documentElement.webkitRequestFullscreen) {\n      document.documentElement.webkitRequestFullscreen();\n    }\n  } else {\n    if (document.exitFullscreen) {\n      document.exitFullscreen();\n    } else if (document.msExitFullscreen) {\n      document.msExitFullscreen();\n    } else if (document.mozCancelFullScreen) {\n      document.mozCancelFullScreen();\n    } else if (document.webkitExitFullscreen) {\n      document.webkitExitFullscreen();\n    }\n  }\n}\n\n"
        },
        {
          "Name": "changeOrientation",
          "Active": "false",
          "Internal": "false",
          "Type": "LIBRARY_EDITOR",
          "Comment": "",
          "Code": "function changeOrientation() {\n        switch (window.orientation) {\n            case 0:\n                this.screenOrientation = 'portrait';\n                if (iPad){\n                return Math.max(window.screen.width,window.screen.height)*0.8;\n                }\n                else if (iPhone){\n                return Math.max(window.screen.width,window.screen.height)*0.7;\n                }\n                else if (Android&&parent.cordova){\n                  return Math.max(window.innerWidth,window.innerHeight)*0.8;\n                  }\n                else {\n                  return Math.max(window.innerWidth,window.innerHeight)*0.85;\n                  }\n                break;\n            case 90:\n                this.screenOrientation = 'landscape';\n                if (iPad){\n                  return Math.min(window.screen.width,window.screen.height)*0.8;\n                }\n                else if (iPhone){\n                  return Math.min(window.screen.width,window.screen.height)*0.7;\n                  }\n                else if (Android&&parent.cordova){\n                  return Math.min(window.innerWidth,window.innerHeight)*0.8;\n                  }\n                  else {\n                  return Math.min(window.innerWidth,window.innerHeight)*0.85;\n                  }\n                \n                break;\n            case 180:\n                this.screenOrientation = 'portrait';\n                if (iPad){\n                  return Math.max(window.screen.width,window.screen.height)*0.8;\n               }\n               else if (iPhone){\n                 return Math.max(window.screen.width,window.screen.height)*0.7;\n                 }\n                 else if (Android&&parent.cordova){\n                   return Math.max(window.innerWidth,window.innerHeight)*0.8;\n                   }\n               else{\n                 return Math.max(window.innerWidth,window.innerHeight)*0.9;\n                 }\n               break;\n            case -90:\n                this.screenOrientation = 'landscape';\n                if (iPad){\n                  return Math.min(window.screen.width,window.screen.height)*0.8;\n                }\n                else if (iPhone){\n                  return Math.min(window.screen.width,window.screen.height)*0.7;\n                  }\n                  else if (Android&&parent.cordova){\n                        return Math.min(window.innerWidth,window.innerHeight)*0.8;\n                    }\n                else {\n                  return Math.min(window.innerWidth,window.innerHeight)*0.85;\n                  }\n                break;\n            default:\n                this.screenOrientation = 'unknown';\n         //       return (iPad)?\"\"+(window.screen.width+window.screen.height)*0.4:((iPhone)?\"\"+window.screen.width:_view._format(window.innerHeight*0.9,\"0\"));\n       return window.innerHeight*0.85;\n       }\n    }"
        },
        {
          "Name": "changeO",
          "Active": "true",
          "Internal": "false",
          "Type": "LIBRARY_EDITOR",
          "Comment": "",
          "Code": "// code to be copied to EJSS source code under Custom and used in drawingPanel3D and plottingPanel2D\n// address the problem is height difference is iOS app , epub, and Firefox\n// user need to change only k and kepub\n// copy %changeOrientation()% into the Height Field of drawingPanel3D and plottingPanel2D\n\n// _view.plottingPanel.getGraphics().setHeight(changeOrientation(0.85));\n\nfunction changeOrientation(kheight) {\n \nvar k =0.90 ; // k control height 1 is for full screen, 0.9 shorten etc\nvar kapple =kheight // control apple app height\nvar kepub =0.90 ;\n// check platform for Apps\ntry { // allow code to run in Student Learning Space \n  var iOSapp =  (typeof parent.device != 'undefined' && parent.device.platform == \"iOS\");\n  var Androidapp = (typeof parent.device != 'undefined' && parent.device.platform == \"Android\");\n} catch(e) {\n  var iOSapp = false;\n  var Androidapp = false;\n}\n// check platform for web browsers\nvar iOS =/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\nvar iPad =/iPad/.test(navigator.userAgent) && !window.MSStream;\nvar iPhone = /iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\nvar Android= /Android|android/i.test(navigator.userAgent);\n\n//navigator\nvar Firefox = navigator.userAgent.indexOf(\"Firefox\") != -1;\n \nswitch (window.orientation) { // using window.orientation as deciding factor\n  case 0:\n  case 180:\n    this.screenOrientation = 'portrait';\n    if (iOSapp){ // does not seems to work\n      \n      return window.screen.height*kapple;  //0.1 for app and 0.1 for nonfullscreenapp  \n    \n    }\n    else if (_isEPub){ // does not seems to work\n      //   return Math.max(window.screen.width,window.screen.height)*0.9;\n      return window.innerHeight*kepub;  //0.1 for app and 0.1 for nonfullscreenapp  \n      // return window.screen.height;\n      //  return window.innerHeight;\n      // return document.documentElement.clientHeight;\n    }\n   \n    else {\n     return window.innerHeight*kheight;\n      //return 100*k+\"vh\";\n    }\n    break;\n  case 90:\n  case -90:\n    this.screenOrientation = 'landscape';\n \n    if (iOSapp){ // App\n      return window.screen.width*kapple;  \n      // return window.screen.height;\n      //  return window.innerHeight;\n      //  return document.documentElement.clientHeight;\n    }\n    else if (_isEPub){ // does not seems to work\n      //   return Math.max(window.screen.width,window.screen.height)*0.9;\n      return window.innerHeight*kepub;  //0.1 for app and 0.1 for nonfullscreenapp  \n      // return window.screen.height;\n      //  return window.innerHeight;\n      // return document.documentElement.clientHeight;\n    }\n   \n    else {\n      return window.innerHeight*kheight;\n      //return 100*k+\"vh\"; // safari produce error\n      }\n    break;\n  default:\n    this.screenOrientation = 'unknown';\n    //       return (iPad)?\"\"+(window.screen.width+window.screen.height)*0.4:((iPhone)?\"\"+window.screen.width:_view._format(window.innerHeight*0.9,\"0\"));\n     if (Firefox){\n      return window.innerHeight*k;// number as of 20180831 Firefox does not support vh yet so need a separate line to handle\n      }\n   //   else if (iOS&&(window.orientation==0)||(window.orientation==180)){\n   //   return  window.screen.height*k;// number as of 20180831 Firefox does not support vh yet so need a separate line to handle\n   //   }\n    //  else if (iOS&&(window.orientation==90)||(window.orientation==-90)){\n   //   return  window.screen.width*k;// number as of 20180831 Firefox does not support vh yet so need a separate line to handle\n   //   }\n      else {\n      //alert();\n      // return 100*k+\"%\"; // work on fullscreen works in EJSS6.0beta\n        //  works in EjsS_5.3_180131\n      //return  window.innerHeight*kheight; // work on panel \n      // take note the panel that contains the plottingPanel needs to be 100% in Height to maximize the view\n      return 100*k+\"vh\";\n       // 100% does not work on iOS after clicking reset it lengthens\n}\n\n}\n \n}"
        }
      ]
    },
    "elements": {
      "list": []
    }
  },
  "view": {
    "Tree": [
      {
        "Name": "displayPanel",
        "Type": "Panel",
        "Expanded": "true",
        "Properties": [
          {
            "name": "Height",
            "value": "Height"
          },
          {
            "name": "Width",
            "value": "Width"
          }
        ],
        "Children": [
          {
            "Name": "controlPanel",
            "Type": "Panel",
            "Expanded": "true",
            "Properties": [
              {
                "name": "Font",
                "value": "font"
              },
              {
                "name": "Display",
                "value": "\"inline-block\""
              }
            ],
            "Children": [
              {
                "Name": "audio",
                "Type": "Audio",
                "Properties": [
                  {
                    "name": "AudioUrl",
                    "value": "\"./NewtonCradle/lookang-SoundSilk-Newtons-Cradle.mp3\""
                  }
                ]
              },
              {
                "Name": "sound",
                "Type": "CheckBox",
                "Properties": [
                  {
                    "name": "Checked",
                    "value": "sound"
                  },
                  {
                    "name": "Text",
                    "value": "\"Sound \ud83d\udd0a\""
                  },
                  {
                    "name": "Font",
                    "value": "font"
                  }
                ]
              },
              {
                "Name": "comboBox",
                "Type": "ComboBox",
                "Properties": [
                  {
                    "name": "Options",
                    "value": "[\"1 ball\",\"2 ball\",\"3 ball\",\"4 ball\",\"5 ball\",\"6 ball\",\"7 ball\",\"1 ball 1\",\"2 ball 1\",\"2 ball 2\",\"3 ball 3\",\"Buy from Shopee\",\"Need a 2D version?\",\"Need a 3D version?\"]"
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"select user_defined and drag the mass\""
                  },
                  {
                    "name": "OnChange",
                    "value": "var opts = _view.comboBox.getProperty(\"SelectedOptions\");  // array of options\n    var option = (opts.length > 0)? opts[0]:\"\"; // selected option \n\n\nif ( option==\"user_defined\"){\n  \n  }\n\nelse if ( option==\"1 ball\"){\n  cta[0]= -pi/4;\n  \n  }\n  \n  else if ( option==\"2 ball\"){\n  cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  }\n  else if ( option==\"3 ball\"){\n  cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[2]= -pi/4;\n  }\n  else if ( option==\"4 ball\"){\n   cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[2]= -pi/4;\n cta[3]= -pi/4;\n  \n  }\n  else if ( option==\"5 ball\"){\n   cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[2]= -pi/4;\n cta[3]= -pi/4;\n  cta[4]= -pi/4;\n \n  }\n  else if ( option==\"6 ball\"){\n   cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[2]= -pi/4;\n cta[3]= -pi/4;\n  cta[4]= -pi/4;\n  cta[5]= -pi/4;\n  }\n  else if ( option==\"7 ball\"){\n  cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[2]= -pi/4;\n cta[3]= -pi/4;\n  cta[4]= -pi/4;\n  cta[5]= -pi/4;\n  cta[6]= -pi/4;\n }\nelse if ( option==\"1 ball 1\"){\n  cta[0]= -pi/4;\n  \n  cta[6]= pi/4;\n }\n else if ( option==\"2 ball 1\"){\n  cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[6]= pi/4;\n }\n else if ( option==\"2 ball 2\"){\n  cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[5]= pi/4;\n  cta[6]= pi/4;\n }\n else if ( option==\"3 ball 3\"){\n  cta[0]= -pi/4;\n  cta[1]= -pi/4;\n  cta[2]= -pi/4;\n   cta[4]= pi/4;\n  cta[5]= pi/4;\n  cta[6]= pi/4;\n }\n//[\"1 ball\",\"2 ball\",\"3 ball\",\"4 ball\",\"5 ball\",\"6 ball\",\"7 ball\",\"1 ball 1\",\"2 ball 1\",\"2 ball 2\",\"3 ball 3\",\"Buy from Shopee?\",\"Need a 3D model?\"]\n  else if (option==\"Buy from Shopee\")\n{\n  window.open(\"https://shope.ee/3AhkYwOP03?share_channel_code=1\");\n  }\n //[\"1 ball\",\"2 ball\",\"3 ball\",\"4 ball\",\"5 ball\",\"6 ball\",\"7 ball\",\"1 ball 1\",\"2 ball 1\",\"2 ball 2\",\"3 ball 3\",\"Buy from Shopee\",\"Need a 2D model?\",\"Need a 3D model?\"]\n else if (option==\"Need a 2D version?\")\n{\n  window.open(\"https://iwant2study.org/ospsg/index.php/interactive-resources/physics/02-newtonian-mechanics/02-dynamics/47-newton-cradle\");\n  }\n else if (option==\"Need a 3D version?\")\n{\n  window.open(\"https://iwant2study.org/ospsg/index.php/interactive-resources/physics/02-newtonian-mechanics/02-dynamics/48-newton-cradle-3d\");\n  }\n"
                  },
                  {
                    "name": "Font",
                    "value": "font"
                  }
                ]
              },
              {
                "Name": "playPauseButton",
                "Type": "TwoStateButton",
                "Properties": [
                  {
                    "name": "OffClick",
                    "value": "_pause();\ntext = \" Paused\";\n"
                  },
                  {
                    "name": "TextOn",
                    "value": "\"Play \u25ba\""
                  },
                  {
                    "name": "State",
                    "value": "_isPaused"
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"Play/Pause\""
                  },
                  {
                    "name": "TextOff",
                    "value": "\"Pause ||\""
                  },
                  {
                    "name": "OnClick",
                    "value": "_play();\ntext = \" Playing\";\n"
                  },
                  {
                    "name": "Width",
                    "value": "\"30vw\""
                  }
                ]
              },
              {
                "Name": "resetButton",
                "Type": "Button",
                "Properties": [
                  {
                    "name": "Text",
                    "value": "\"Reset \u21bb\""
                  },
                  {
                    "name": "OnClick",
                    "value": "%_reset%"
                  },
                  {
                    "name": "Width",
                    "value": "\"30vw\""
                  }
                ]
              }
            ]
          },
          {
            "Name": "controlPanel2",
            "Type": "Panel",
            "Expanded": "true",
            "Properties": [
              {
                "name": "Font",
                "value": "font"
              },
              {
                "name": "Display",
                "value": "\"none\""
              }
            ],
            "Children": [
              {
                "Name": "worldgraph",
                "Type": "ComboBox",
                "Properties": [
                  {
                    "name": "Options",
                    "value": "[\"world\",\"graph\",\"world and E vs t\",\"\",\"KE vs t\",\"KE vs t off\",\"PE vs t\",\"PE vs t off\",\"TE vs t\",\"TE vs t off\"]"
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"select user_defined and drag the mass\""
                  },
                  {
                    "name": "OnChange",
                    "value": "//var option = _view.worldgraph.getProperty(\"SelectedOptions\");\n//alert(option);\nvar opts = _view.worldgraph.getProperty(\"SelectedOptions\");  // array of options\n    var option = (opts.length > 0)? opts[0]:\"\"; // selected option \n\n//[\"world\",\"x vs t\",\" v vs t\",\"a vs t\",\"world and x vs t\",\"world and v vs t\",\"world and a vs t\"]\nif ( option==\"world\"){\n  world=true;\ngraph=false;\nWidth1 = \"100%\";\nWidth2 = \"0%\";\n\n  }\n\n \nelse if ( option==\"world and E vs t\"){\n  world=true;\ngraph=true;\n\nWidth1 = \"50%\";\nWidth2 = \"50%\";\n\n  } \n  \n  else if ( option==\"graph\"){\n  world=false;\ngraph=true;\n\nWidth1 = \"0%\";\nWidth2 = \"100%\";\n\n  } \n  //kevst\n  else if ( option==\"KE vs t\"){\nkevst=true;\n\n  } \n   else if ( option==\"KE vs t off\"){\nkevst=false;\n\n  } \n  \n  //pevst\n  else if ( option==\"PE vs t\"){\npevst=true;\n\n  } \n   else if ( option==\"PE vs t off\"){\npevst=false;\n\n  } \n\n  //tevst\n  else if ( option==\"TE vs t\"){\ntevst=true;\n\n  } \n   else if ( option==\"TE vs t off\"){\ntevst=false;\n\n  } \n"
                  },
                  {
                    "name": "Visibility",
                    "value": "false"
                  },
                  {
                    "name": "Width",
                    "value": "(_isMobile)?\"50\":\"\""
                  },
                  {
                    "name": "Display",
                    "value": "\"none\""
                  }
                ]
              },
              {
                "Name": "g",
                "Type": "Panel",
                "Expanded": "false",
                "Properties": [
                  {
                    "name": "Display",
                    "value": "\"none\""
                  }
                ],
                "Children": [
                  {
                    "Name": "label32",
                    "Type": "Label",
                    "Properties": [
                      {
                        "name": "Background",
                        "value": "\"Red\""
                      },
                      {
                        "name": "Tooltip",
                        "value": "\"gravitational acceleration\""
                      },
                      {
                        "name": "Text",
                        "value": "\" g = \""
                      }
                    ]
                  },
                  {
                    "Name": "slider22",
                    "Type": "Slider",
                    "Properties": [
                      {
                        "name": "Maximum",
                        "value": "19.62"
                      },
                      {
                        "name": "Minimum",
                        "value": "0"
                      },
                      {
                        "name": "Background",
                        "value": "\"Red\""
                      },
                      {
                        "name": "Tooltip",
                        "value": "\"gravitational acceleration\""
                      },
                      {
                        "name": "Value",
                        "value": "g"
                      },
                      {
                        "name": "OnChange",
                        "value": "%_initialize%"
                      },
                      {
                        "name": "Width",
                        "value": "(_isEPub)?\"0\":\"\""
                      }
                    ]
                  },
                  {
                    "Name": "field22",
                    "Type": "ParsedField",
                    "Properties": [
                      {
                        "name": "Format",
                        "value": "\"0.00\""
                      },
                      {
                        "name": "Value",
                        "value": "g"
                      },
                      {
                        "name": "OnChange",
                        "value": "%_initialize%"
                      },
                      {
                        "name": "Width",
                        "value": "30"
                      }
                    ]
                  },
                  {
                    "Name": "label222",
                    "Type": "Label",
                    "Properties": [
                      {
                        "name": "Background",
                        "value": "\"Red\""
                      },
                      {
                        "name": "Tooltip",
                        "value": "\"metre per second square\""
                      },
                      {
                        "name": "Text",
                        "value": "\" m/s^2 \""
                      },
                      {
                        "name": "Width",
                        "value": "(_isEPub)?\"0\":\"\""
                      }
                    ]
                  }
                ]
              },
              {
                "Name": "n4",
                "Type": "Label",
                "Properties": [
                  {
                    "name": "Background",
                    "value": "\"Gray\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"number of balls \""
                  },
                  {
                    "name": "Foreground",
                    "value": "\"White\""
                  },
                  {
                    "name": "Text",
                    "value": "\" n = \""
                  }
                ]
              },
              {
                "Name": "n22",
                "Type": "Slider",
                "Properties": [
                  {
                    "name": "Maximum",
                    "value": "7"
                  },
                  {
                    "name": "Minimum",
                    "value": "1"
                  },
                  {
                    "name": "Background",
                    "value": "\"Gray\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"number of balls \""
                  },
                  {
                    "name": "Value",
                    "value": "n"
                  },
                  {
                    "name": "OnChange",
                    "value": "%_initialize%"
                  },
                  {
                    "name": "Width",
                    "value": "(_isEPub)?\"0\":\"\""
                  }
                ]
              },
              {
                "Name": "n32",
                "Type": "ParsedField",
                "Properties": [
                  {
                    "name": "Format",
                    "value": "\"0\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"number of balls \""
                  },
                  {
                    "name": "Value",
                    "value": "n"
                  },
                  {
                    "name": "OnChange",
                    "value": "%_initialize%"
                  },
                  {
                    "name": "Width",
                    "value": "\"5vw\""
                  }
                ]
              },
              {
                "Name": "ballmoved4",
                "Type": "Label",
                "Properties": [
                  {
                    "name": "Background",
                    "value": "\"Gray\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"ball number to move from left to right\""
                  },
                  {
                    "name": "Foreground",
                    "value": "\"White\""
                  },
                  {
                    "name": "Text",
                    "value": "\" i = \""
                  }
                ]
              },
              {
                "Name": "ballmoved23",
                "Type": "Slider",
                "Properties": [
                  {
                    "name": "Maximum",
                    "value": "6"
                  },
                  {
                    "name": "Minimum",
                    "value": "0"
                  },
                  {
                    "name": "Background",
                    "value": "\"Gray\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"ball number to move from left to right\""
                  },
                  {
                    "name": "Value",
                    "value": "ballMoved"
                  },
                  {
                    "name": "OnChange",
                    "value": "%_initialize%"
                  },
                  {
                    "name": "Step",
                    "value": "1"
                  },
                  {
                    "name": "Width",
                    "value": "(_isEPub)?\"0\":\"\""
                  }
                ]
              },
              {
                "Name": "ballmoved33",
                "Type": "ParsedField",
                "Properties": [
                  {
                    "name": "Format",
                    "value": "\"0\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"ball number to move from left to right\""
                  },
                  {
                    "name": "Value",
                    "value": "ballMoved"
                  },
                  {
                    "name": "OnChange",
                    "value": "%_initialize%"
                  },
                  {
                    "name": "Width",
                    "value": "\"5vw\""
                  }
                ]
              },
              {
                "Name": "mi2",
                "Type": "Label",
                "Properties": [
                  {
                    "name": "Background",
                    "value": "\"Yellow\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"mass of ballMoved\""
                  },
                  {
                    "name": "Text",
                    "value": "\" m[i] = \""
                  },
                  {
                    "name": "Disabled",
                    "value": "_isPlaying"
                  }
                ]
              },
              {
                "Name": "ballmoved222",
                "Type": "Slider",
                "Properties": [
                  {
                    "name": "Maximum",
                    "value": "5"
                  },
                  {
                    "name": "Minimum",
                    "value": "1"
                  },
                  {
                    "name": "Background",
                    "value": "\"Yellow\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"ball number to move from left to right\""
                  },
                  {
                    "name": "Value",
                    "value": "mi"
                  },
                  {
                    "name": "OnChange",
                    "value": "m[ballMoved]=mi;\nl_m[ballMoved]=\"\"+_view._format(m[ballMoved],\"0\");\n"
                  },
                  {
                    "name": "Step",
                    "value": "1"
                  },
                  {
                    "name": "Disabled",
                    "value": "_isPlaying"
                  },
                  {
                    "name": "Width",
                    "value": "(_isEPub)?\"0\":\"\""
                  }
                ]
              },
              {
                "Name": "ballmoved322",
                "Type": "ParsedField",
                "Properties": [
                  {
                    "name": "Format",
                    "value": "\"0\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"ball number to move from left to right\""
                  },
                  {
                    "name": "Value",
                    "value": "mi"
                  },
                  {
                    "name": "OnChange",
                    "value": "m[ballMoved]=mi;\n l_m[ballMoved]=_view.format(m[ballMoved],\"0.0\")+\"\";\n"
                  },
                  {
                    "name": "Width",
                    "value": "\"5vw\""
                  }
                ]
              },
              {
                "Name": "ballmoved422",
                "Type": "Label",
                "Properties": [
                  {
                    "name": "Background",
                    "value": "\"Yellow\""
                  },
                  {
                    "name": "Tooltip",
                    "value": "\"kilogram\""
                  },
                  {
                    "name": "Text",
                    "value": "\" kg \""
                  }
                ]
              }
            ]
          },
          {
            "Name": "topPanel",
            "Type": "Panel",
            "Expanded": "false",
            "Properties": [
              {
                "name": "Width",
                "value": "\"100%\""
              }
            ],
            "Children": [
              {
                "Name": "plottingPanel",
                "Type": "PlottingPanel",
                "Expanded": "true",
                "Properties": [
                  {
                    "name": "Gutters",
                    "value": "[0,0,0,0]"
                  },
                  {
                    "name": "Background",
                    "value": "\"url(#mygrandient2)\""
                  },
                  {
                    "name": "Enabled",
                    "value": "true"
                  },
                  {
                    "name": "OnDoubleClick",
                    "value": "toggleFullScreen()"
                  },
                  {
                    "name": "SquareAspect",
                    "value": "true"
                  },
                  {
                    "name": "MaximumY",
                    "value": "ymax"
                  },
                  {
                    "name": "MaximumX",
                    "value": "xmax"
                  },
                  {
                    "name": "TRMessage",
                    "value": "_isMobile?\"\":\"Newton Cradle Model\""
                  },
                  {
                    "name": "GridYShow",
                    "value": "false"
                  },
                  {
                    "name": "MinimumX",
                    "value": "xmin"
                  },
                  {
                    "name": "MinimumY",
                    "value": "ymin"
                  },
                  {
                    "name": "AutoScaleY",
                    "value": "false"
                  },
                  {
                    "name": "AutoScaleX",
                    "value": "false"
                  },
                  {
                    "name": "Visibility",
                    "value": "world"
                  },
                  {
                    "name": "Height",
                    "value": "%changeOrientation(0.8)%"
                  },
                  {
                    "name": "GridXShow",
                    "value": "false"
                  },
                  {
                    "name": "Width",
                    "value": "Width1"
                  },
                  {
                    "name": "TLMessage",
                    "value": "%text%"
                  },
                  {
                    "name": "BRMessage",
                    "value": "%text1%"
                  }
                ],
                "Children": [
                  {
                    "Name": "controln",
                    "Type": "Group2D",
                    "Expanded": "true",
                    "Properties": [
                      {
                        "name": "Y",
                        "value": "-1"
                      }
                    ],
                    "Children": [
                      {
                        "Name": "plus",
                        "Type": "Text2D",
                        "Properties": [
                          {
                            "name": "RelativePosition",
                            "value": "\"WEST\""
                          },
                          {
                            "name": "Measured",
                            "value": "true"
                          },
                          {
                            "name": "X",
                            "value": "0.5"
                          },
                          {
                            "name": "Y",
                            "value": "0.5"
                          },
                          {
                            "name": "Text",
                            "value": "\"+\""
                          },
                          {
                            "name": "OnPress",
                            "value": "n=n+1;\nif (n >7) \n{\n  n=7; //limit\nalert(\"limit reached, maximum is seven balls\");\n}\nfor(var i=0;i<n;i++){\n xc[i]=-(n/2)*size+i*size; // change to + by lookang for left to right lineup\n cta[i]=0.;\n omega[i]=0.;\n l_m[i]=m[i]+\"\";\n}\nt=0.;\nxmin = -n*size; // optimize view\nxmax = +n*size;\n//cta[0]=-pi/10;"
                          },
                          {
                            "name": "EnabledPosition",
                            "value": "\"ENABLED_NO_MOVE\""
                          },
                          {
                            "name": "Font",
                            "value": "font"
                          }
                        ]
                      },
                      {
                        "Name": "minus",
                        "Type": "Text2D",
                        "Properties": [
                          {
                            "name": "RelativePosition",
                            "value": "\"EAST\""
                          },
                          {
                            "name": "Measured",
                            "value": "true"
                          },
                          {
                            "name": "X",
                            "value": "-0.5"
                          },
                          {
                            "name": "Y",
                            "value": "0.5"
                          },
                          {
                            "name": "Text",
                            "value": "\"-\""
                          },
                          {
                            "name": "OnPress",
                            "value": "n=n-1;\nif (n <1) {\n  n=1; //limit\nalert(\"limit reached, minimum is one ball\");\n}\nfor(var i=0;i<n;i++){\n xc[i]=-(n/2)*size+i*size; // change to + by lookang for left to right lineup\n cta[i]=0.;\n omega[i]=0.;\n l_m[i]=m[i]+\"\";\n}\nt=0.;\nxmin = -n*size; // optimize view\nxmax = +n*size;\n//cta[0]=-pi/10;"
                          },
                          {
                            "name": "EnabledPosition",
                            "value": "\"ENABLED_NO_MOVE\""
                          },
                          {
                            "name": "Font",
                            "value": "font"
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "Name": "segmentSet",
                    "Type": "SegmentSet2D",
                    "Properties": [
                      {
                        "name": "NumberOfElements",
                        "value": "n"
                      },
                      {
                        "name": "SizeX",
                        "value": "dx"
                      },
                      {
                        "name": "X",
                        "value": "xc"
                      },
                      {
                        "name": "LineColor",
                        "value": "\"Blue\""
                      },
                      {
                        "name": "Y",
                        "value": "ymax"
                      },
                      {
                        "name": "SizeY",
                        "value": "dy"
                      },
                      {
                        "name": "LineWidth",
                        "value": "2"
                      }
                    ]
                  },
                  {
                    "Name": "shapeSet2",
                    "Type": "ShapeSet2D",
                    "Properties": [
                      {
                        "name": "FillColor",
                        "value": "\"Gray\""
                      },
                      {
                        "name": "Transformation",
                        "value": "cta"
                      },
                      {
                        "name": "ShapeType",
                        "value": "\"WHEEL\""
                      },
                      {
                        "name": "OnDrag",
                        "value": "drag ()"
                      },
                      {
                        "name": "ElementInteracted",
                        "value": "ballMoved"
                      },
                      {
                        "name": "NumberOfElements",
                        "value": "n"
                      },
                      {
                        "name": "SizeX",
                        "value": "size"
                      },
                      {
                        "name": "X",
                        "value": "x"
                      },
                      {
                        "name": "LineColor",
                        "value": "\"Black\""
                      },
                      {
                        "name": "Y",
                        "value": "y"
                      },
                      {
                        "name": "SizeY",
                        "value": "size"
                      },
                      {
                        "name": "LineWidth",
                        "value": "2"
                      },
                      {
                        "name": "EnabledPosition",
                        "value": "\"ENABLED_ANY\""
                      }
                    ]
                  },
                  {
                    "Name": "shapeSet",
                    "Type": "ShapeSet2D",
                    "Properties": [
                      {
                        "name": "FillColor",
                        "value": "\"url(#mygrandient1)\""
                      },
                      {
                        "name": "Transformation",
                        "value": "cta"
                      },
                      {
                        "name": "ShapeType",
                        "value": "\"WHEEL\""
                      },
                      {
                        "name": "OnDrag",
                        "value": "drag ()"
                      },
                      {
                        "name": "ElementInteracted",
                        "value": "ballMoved"
                      },
                      {
                        "name": "NumberOfElements",
                        "value": "n"
                      },
                      {
                        "name": "Sensitivity",
                        "value": "30"
                      },
                      {
                        "name": "SizeX",
                        "value": "size"
                      },
                      {
                        "name": "X",
                        "value": "x"
                      },
                      {
                        "name": "LineColor",
                        "value": "\"Black\""
                      },
                      {
                        "name": "Y",
                        "value": "y"
                      },
                      {
                        "name": "SizeY",
                        "value": "size"
                      },
                      {
                        "name": "LineWidth",
                        "value": "2"
                      },
                      {
                        "name": "EnabledPosition",
                        "value": "\"ENABLED_ANY\""
                      }
                    ]
                  },
                  {
                    "Name": "textSet",
                    "Type": "TextSet2D",
                    "Properties": [
                      {
                        "name": "FillColor",
                        "value": "\"Yellow\""
                      },
                      {
                        "name": "Measured",
                        "value": "true"
                      },
                      {
                        "name": "Text",
                        "value": "%l_m%"
                      },
                      {
                        "name": "OnDrag",
                        "value": "mi= m[ballMoved]=+1;\n//m[ballMoved]=mi;\nl_m[ballMoved]=\"\"+_view._format(m[ballMoved],\"0\");\n"
                      },
                      {
                        "name": "ElementInteracted",
                        "value": "ballMoved"
                      },
                      {
                        "name": "NumberOfElements",
                        "value": "n"
                      },
                      {
                        "name": "Sensitivity",
                        "value": "50"
                      },
                      {
                        "name": "SizeX",
                        "value": "size"
                      },
                      {
                        "name": "X",
                        "value": "x"
                      },
                      {
                        "name": "Y",
                        "value": "y"
                      },
                      {
                        "name": "OnPress",
                        "value": "mi= m[ballMoved]=+1;\n//m[ballMoved]=mi;\nl_m[ballMoved]=\"\"+_view._format(m[ballMoved],\"0\");\n"
                      },
                      {
                        "name": "SizeY",
                        "value": "size"
                      },
                      {
                        "name": "PixelSize",
                        "value": "true"
                      },
                      {
                        "name": "LineWidth",
                        "value": "2"
                      }
                    ]
                  },
                  {
                    "Name": "group",
                    "Type": "Group2D",
                    "Expanded": "true",
                    "Properties": [],
                    "Children": [
                      {
                        "Name": "controlmass",
                        "Type": "Group2D",
                        "Expanded": "true",
                        "Properties": [
                          {
                            "name": "Visibility",
                            "value": "n>0.5"
                          }
                        ],
                        "Children": [
                          {
                            "Name": "decreasem",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[0]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[0]+size/2*Math.sin(cta[0])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Orange\""
                              },
                              {
                                "name": "Y",
                                "value": "y[0]-size/2*Math.cos(cta[0])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[0]=m[0]-1;\nif (m[0]<1 ){\n  m[0]=1; // set lower limit\nalert(\"limit to minimum mass of 1\");\n}\nl_m[0]=\"\"+_view._format(m[0],\"0\");\n\nballMoved=0; //sync with sliders\nmi=m[0];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "-10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          },
                          {
                            "Name": "increasem",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[0]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[0]-size/2*Math.sin(cta[0])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Magenta\""
                              },
                              {
                                "name": "Y",
                                "value": "y[0]+size/2*Math.cos(cta[0])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[0]=m[0]+1;\nl_m[0]=\"\"+_view._format(m[0],\"0\");\n\nballMoved=0; //sync with sliders\nmi=m[0];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "Name": "controlmass2",
                        "Type": "Group2D",
                        "Expanded": "true",
                        "Properties": [
                          {
                            "name": "Visibility",
                            "value": "n>1.5"
                          }
                        ],
                        "Children": [
                          {
                            "Name": "decreasem2",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[1]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[1]+size/2*Math.sin(cta[1])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Orange\""
                              },
                              {
                                "name": "Y",
                                "value": "y[1]-size/2*Math.cos(cta[1])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[1]=m[1]-1;\nif (m[1]<1 ){\n  m[1]=1; // set lower limit\nalert(\"limit to minimum mass of 1\");\n}\nl_m[1]=\"\"+_view._format(m[1],\"0\");\n\nballMoved=1; //sync with sliders\nmi=m[1];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "-10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          },
                          {
                            "Name": "increasem2",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[1]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[1]-size/2*Math.sin(cta[1])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Magenta\""
                              },
                              {
                                "name": "Y",
                                "value": "y[1]+size/2*Math.cos(cta[1])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[1]=m[1]+1;\nl_m[1]=\"\"+_view._format(m[1],\"0\");\n\nballMoved=1; //sync with sliders\nmi=m[1];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "Name": "controlmass22",
                        "Type": "Group2D",
                        "Expanded": "true",
                        "Properties": [
                          {
                            "name": "Visibility",
                            "value": "n>2.5"
                          }
                        ],
                        "Children": [
                          {
                            "Name": "decreasem22",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[2]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[2]+size/2*Math.sin(cta[2])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Orange\""
                              },
                              {
                                "name": "Y",
                                "value": "y[2]-size/2*Math.cos(cta[2])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[2]=m[2]-1;\nif (m[2]<1 ){\n  \n  m[2]=1; // set lower limit\nalert(\"limit to minimum mass of 1\");\n}\n\nl_m[2]=\"\"+_view._format(m[2],\"0\");\n\nballMoved=2; //sync with sliders\nmi=m[2];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "-10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          },
                          {
                            "Name": "increasem22",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[2]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[2]-size/2*Math.sin(cta[2])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Magenta\""
                              },
                              {
                                "name": "Y",
                                "value": "y[2]+size/2*Math.cos(cta[2])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[2]=m[2]+1;\nl_m[2]=\"\"+_view._format(m[2],\"0\");\n\nballMoved=2; //sync with sliders\nmi=m[2];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "Name": "controlmass23",
                        "Type": "Group2D",
                        "Expanded": "true",
                        "Properties": [
                          {
                            "name": "Visibility",
                            "value": "n>3.5"
                          }
                        ],
                        "Children": [
                          {
                            "Name": "decreasem23",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[3]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[3]+size/2*Math.sin(cta[3])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Orange\""
                              },
                              {
                                "name": "Y",
                                "value": "y[3]-size/2*Math.cos(cta[3])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[3]=m[3]-1;\nif (m[3]<1 ){\n  m[3]=1; // set lower limit\nalert(\"limit to minimum mass of 1\");\n}\n\nl_m[3]=\"\"+_view._format(m[3],\"0\");\n\nballMoved=3; //sync with sliders\nmi=m[3];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "-10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          },
                          {
                            "Name": "increasem23",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[3]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[3]-size/2*Math.sin(cta[3])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Magenta\""
                              },
                              {
                                "name": "Y",
                                "value": "y[3]+size/2*Math.cos(cta[3])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[3]=m[3]+1;\nl_m[3]=\"\"+_view._format(m[3],\"0\");\n\nballMoved=3; //sync with sliders\nmi=m[3];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "Name": "controlmass24",
                        "Type": "Group2D",
                        "Expanded": "true",
                        "Properties": [
                          {
                            "name": "Visibility",
                            "value": "n>4.5"
                          }
                        ],
                        "Children": [
                          {
                            "Name": "decreasem24",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[4]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[4]+size/2*Math.sin(cta[4])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Orange\""
                              },
                              {
                                "name": "Y",
                                "value": "y[4]-size/2*Math.cos(cta[4])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[4]=m[4]-1;\nif (m[4]<1 ){\n  m[4]=1; // set lower limit\nalert(\"limit to minimum mass of 1\");\n}\n\nl_m[4]=\"\"+_view._format(m[4],\"0\");\n\nballMoved=4; //sync with sliders\nmi=m[4];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "-10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          },
                          {
                            "Name": "increasem24",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[4]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[4]-size/2*Math.sin(cta[4])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Magenta\""
                              },
                              {
                                "name": "Y",
                                "value": "y[4]+size/2*Math.cos(cta[4])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[4]=m[4]+1;\nl_m[4]=\"\"+_view._format(m[4],\"0\");\n\nballMoved=4; //sync with sliders\nmi=m[4];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "Name": "controlmass25",
                        "Type": "Group2D",
                        "Expanded": "true",
                        "Properties": [
                          {
                            "name": "Visibility",
                            "value": "n>5.5"
                          }
                        ],
                        "Children": [
                          {
                            "Name": "decreasem25",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[5]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[5]+size/2*Math.sin(cta[5])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Orange\""
                              },
                              {
                                "name": "Y",
                                "value": "y[5]-size/2*Math.cos(cta[5])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[5]=m[5]-1;\nif (m[5]<1 ) {\n  m[5]=1; // set lower limit\nalert(\"limit to minimum mass of 1\");\n}\nl_m[5]=\"\"+_view._format(m[5],\"0\");\n\nballMoved=5; //sync with sliders\nmi=m[5];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "-10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          },
                          {
                            "Name": "increasem25",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[5]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[5]-size/2*Math.sin(cta[5])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Magenta\""
                              },
                              {
                                "name": "Y",
                                "value": "y[5]+size/2*Math.cos(cta[5])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[5]=m[5]+1;\nl_m[5]=\"\"+_view._format(m[5],\"0\");\n\nballMoved=5; //sync with sliders\nmi=m[5];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          }
                        ]
                      },
                      {
                        "Name": "controlmass26",
                        "Type": "Group2D",
                        "Expanded": "true",
                        "Properties": [
                          {
                            "name": "Visibility",
                            "value": "n>6.5"
                          }
                        ],
                        "Children": [
                          {
                            "Name": "decreasem26",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[6]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[6]+size/2*Math.sin(cta[6])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Orange\""
                              },
                              {
                                "name": "Y",
                                "value": "y[6]-size/2*Math.cos(cta[6])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[6]=m[6]-1;\nif (m[6]<1 ){\n  m[6]=1; // set lower limit\nalert(\"limit to minimum mass of 1\");\n}\nl_m[6]=\"\"+_view._format(m[6],\"0\");\n\nballMoved=6; //sync with sliders\nmi=m[6];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "-10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          },
                          {
                            "Name": "increasem26",
                            "Type": "Arrow2D",
                            "Properties": [
                              {
                                "name": "MarkEnd",
                                "value": "\"TRIANGLE\""
                              },
                              {
                                "name": "Transformation",
                                "value": "cta[6]"
                              },
                              {
                                "name": "Measured",
                                "value": "true"
                              },
                              {
                                "name": "X",
                                "value": "x[6]-size/2*Math.sin(cta[6])"
                              },
                              {
                                "name": "LineColor",
                                "value": "\"Magenta\""
                              },
                              {
                                "name": "Y",
                                "value": "y[6]+size/2*Math.cos(cta[6])"
                              },
                              {
                                "name": "OnPress",
                                "value": "m[6]=m[6]+1;\nl_m[6]=\"\"+_view._format(m[6],\"0\");\n\nballMoved=6; //sync with sliders\nmi=m[6];//sync with sliders\n"
                              },
                              {
                                "name": "SizeY",
                                "value": "10"
                              },
                              {
                                "name": "PixelSize",
                                "value": "true"
                              },
                              {
                                "name": "LineWidth",
                                "value": "2"
                              },
                              {
                                "name": "EnabledPosition",
                                "value": "\"ENABLED_NO_MOVE\""
                              },
                              {
                                "name": "Offset",
                                "value": "\"SOUTH_WEST\""
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "Name": "plottingPanel2",
                "Type": "PlottingPanel",
                "Expanded": "false",
                "Properties": [
                  {
                    "name": "Gutters",
                    "value": "[0,0,0,0]"
                  },
                  {
                    "name": "YScalePrecision",
                    "value": "0"
                  },
                  {
                    "name": "Title",
                    "value": "\"energy\""
                  },
                  {
                    "name": "TRMessage",
                    "value": "\"KE1=\"+_view._format(KE[0],\"0.00\")+\", KE2=\"+_view._format(KE[1],\"0.00\")+\", KE3=\"+_view._format(KE[2],\"0.00\")+\", KE4=\"+_view._format(KE[3],\"0.00\")+\", KE5=\"+_view._format(KE[4],\"0.00\")+\", KE6=\"+_view._format(KE[5],\"0.00\")+\", KE7=\"+_view._format(KE[6],\"0.00\")"
                  },
                  {
                    "name": "YAutoTicks",
                    "value": "false"
                  },
                  {
                    "name": "XTickStep",
                    "value": "1"
                  },
                  {
                    "name": "YTickStep",
                    "value": "1"
                  },
                  {
                    "name": "AutoScaleY",
                    "value": "true"
                  },
                  {
                    "name": "TitleX",
                    "value": "\"t\""
                  },
                  {
                    "name": "AutoScaleX",
                    "value": "true"
                  },
                  {
                    "name": "MarginX",
                    "value": "5"
                  },
                  {
                    "name": "MarginY",
                    "value": "5"
                  },
                  {
                    "name": "XAutoTicks",
                    "value": "false"
                  },
                  {
                    "name": "Height",
                    "value": "%changeOrientation()%"
                  },
                  {
                    "name": "XScalePrecision",
                    "value": "0"
                  },
                  {
                    "name": "Width",
                    "value": "Width2"
                  },
                  {
                    "name": "BRMessage",
                    "value": "%text1%"
                  }
                ],
                "Children": [
                  {
                    "Name": "group2",
                    "Type": "Group2D",
                    "Expanded": "false",
                    "Properties": [
                      {
                        "name": "Visibility",
                        "value": "false"
                      }
                    ],
                    "Children": [
                      {
                        "Name": "trail",
                        "Type": "Trail2D",
                        "Properties": [
                          {
                            "name": "Maximum",
                            "value": "400"
                          },
                          {
                            "name": "Connected",
                            "value": "t>0"
                          },
                          {
                            "name": "LineColor",
                            "value": "\"Magenta\""
                          },
                          {
                            "name": "InputX",
                            "value": "t"
                          },
                          {
                            "name": "Visibility",
                            "value": "kevst"
                          },
                          {
                            "name": "InputY",
                            "value": "ketotal"
                          },
                          {
                            "name": "NoRepeat",
                            "value": "true"
                          },
                          {
                            "name": "LineWidth",
                            "value": "2"
                          }
                        ]
                      },
                      {
                        "Name": "trail2",
                        "Type": "Trail2D",
                        "Properties": [
                          {
                            "name": "Maximum",
                            "value": "400"
                          },
                          {
                            "name": "Connected",
                            "value": "t>0"
                          },
                          {
                            "name": "LineColor",
                            "value": "\"Blue\""
                          },
                          {
                            "name": "InputX",
                            "value": "t"
                          },
                          {
                            "name": "Visibility",
                            "value": "pevst"
                          },
                          {
                            "name": "InputY",
                            "value": "petotal"
                          },
                          {
                            "name": "NoRepeat",
                            "value": "true"
                          },
                          {
                            "name": "LineWidth",
                            "value": "2"
                          }
                        ]
                      },
                      {
                        "Name": "trail22",
                        "Type": "Trail2D",
                        "Properties": [
                          {
                            "name": "Maximum",
                            "value": "400"
                          },
                          {
                            "name": "Connected",
                            "value": "t>0"
                          },
                          {
                            "name": "LineColor",
                            "value": "\"Black\""
                          },
                          {
                            "name": "InputX",
                            "value": "t"
                          },
                          {
                            "name": "Visibility",
                            "value": "tevst"
                          },
                          {
                            "name": "InputY",
                            "value": "tetotal"
                          },
                          {
                            "name": "NoRepeat",
                            "value": "true"
                          },
                          {
                            "name": "LineWidth",
                            "value": "2"
                          }
                        ]
                      },
                      {
                        "Name": "trailSet",
                        "Type": "TrailSet2D",
                        "Properties": [
                          {
                            "name": "NumberOfElements",
                            "value": "n"
                          },
                          {
                            "name": "Maximum",
                            "value": "400"
                          },
                          {
                            "name": "Connected",
                            "value": "t>0"
                          },
                          {
                            "name": "LineColor",
                            "value": "\"Magenta\""
                          },
                          {
                            "name": "InputX",
                            "value": "t"
                          },
                          {
                            "name": "Visibility",
                            "value": "false"
                          },
                          {
                            "name": "InputY",
                            "value": "KE"
                          },
                          {
                            "name": "NoRepeat",
                            "value": "true"
                          },
                          {
                            "name": "LineWidth",
                            "value": "2"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "Name": "html",
            "Type": "Panel",
            "Properties": [
              {
                "name": "Html",
                "value": "<h2>Newton's cradle</h2> \n<a href=\"https://www.youtube.com/watch?v=hhY8O0uwD6I\" target=\"_blank\">\n  https://www.youtube.com/watch?v=hhY8O0uwD6I \n</a>\n<iframe width=\"560\" height=\"315\" \n        src=\"https://www.youtube.com/embed/hhY8O0uwD6I\" \n        title=\"Newton's cradle video\" \n        frameborder=\"0\" \n        allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" \n        allowfullscreen>\n</iframe>\n<p>Newton's cradle is a device that demonstrates conservation of momentum and energy using a series of swinging spheres. When one sphere at the end is lifted and released, it strikes the stationary spheres, transmitting a force through the stationary spheres that pushes the last sphere upward. The last sphere swings back and strikes the still nearly stationary spheres, repeating the effect in the opposite direction. The device is named after 17th-century English scientist Sir Isaac Newton. It is also known as Newton's pendulum, Newton's balls, Newton's rocker or executive ball clicker (since the device makes a click each time the balls collide, which they do repeatedly in a steady rhythm).</p>\n<p>A typical Newton's cradle consists of a series of identically sized metal balls suspended in a metal frame so that they are just touching each other at rest. Each ball is attached to the frame by two wires of equal length angled away from each other. This restricts the pendulums' movements to the same plane.</p>\n<h2>Controls</h2>\n<p>The first comboBox allows eay selection of number of balls in the Newton's cradle</p>\n<p> 1 ball to the left</p>\n<p> 2 balls to the left</p>\n<p> 3 balls to the left</p>\n<p> 4 balls to the left</p>\n<p> 5 balls to the left</p>\n<p> 6 balls to the left</p>\n<p> 7 balls to the left</p>\n<p> 1 ball 1 raises 1 ball to the left and 1 ball to the right</p>\n<p> 2 ball 1 raises 2 ball to the left and 1 ball to the right</p>\n<p> 2 ball 2 raises 2 balls to the left and 2 balls to the right</p>\n<p> 3 ball 3 raises 3 balls to the left and 3 balls to the right</p>\n<p>n is the number of balls allowed</p>\n<p>i is the index of the ball to change</p>\n<p>for which m[i] is the mass of the index ball</p>\n<p>play button starts the simulation</p>\n<p>reset button starts the simulation at afresh</p>\n<h2>Physics explanation</h2>\n<p>Newton's cradle can be modeled fairly accurately with simple mathematical equations with the assumption that the balls always collide in pairs.</p>\n<p> The motion of the balls are modelled using $ \\frac{d\\theta[i]}{dt} = \\omega[i]$ </p>\n<p>where $\\theta$ is the angle of the ball</p>\n<p> $ \\omega $ is the angular velocity </p>\n<p> i represents each element of the ball</p>\n<p> t is time </p>\n<p> the second order differential equation is $\\frac{d(\\omega[i])}{dt}=-\\frac{g*sin(\\theta[i])}{L}-k*L*\\omega[i] $ </p>\n<p> where g is gravitational constant 9.81 $m/s^2$ </p>\n<p> L is the length of the inextensible string connecting the ball to the support for rotational motion </p>\n<p> k is a resistant coefficient to rotational motion $ \\omega $ </p>\n<h2>Events of the ordinary differential equations</h2>\n<p>In a state event, a TOLERANCE =1.0e-6 is defined, a loop to check through each ball i, where a check of the $\\theta[i]$ is greater than $\\theta[i+1]$ plus the TOLERANCE, if true, return the balls to their closed up angular position $\\theta[i+1]-\\theta[i]$. If false, do nothing. </p>\n<p>The following actions are carried out at the end of the event</p>\n<p>$m_{1}=m[cid]$ where $m_{1}$ is a dummy variable to contain mass of collision with index = cid</p>\n<p>$m_{2}=m[cid+1]$;where $m_{2}$ is a dummy variable to contain mass of collision with index = cid+1</p>\n<p>$v_{1}=L*\\omega[cid]$;</p>\n<p>$v_{2}=L*\\omega[cid+1]$;</p>\n<p>$v_{a}=\\frac{((m_{1}-m_{2})*v_{1}+2*m_{2}*v_{2})}{(m_{1}+m_{2})}$;// velocity after collision</p>\n<p>$v_{b}=\\frac{(2*m_{1}*v_{1}+(m_{2}-m_{1})*v_{2})}{(m_{1}+m_{2})}$;</p>\n<p>$\\omega[cid]=\\frac{v_{a}}{L}$;// back to omega</p>\n<p>$\\omega[cid+1]=\\frac{v_{b}}{L}$;</p>\n<h2>Fixed Relationship Calculations</h2>\n<p>There is a for loop over i=0 to i less than number of balls to calculate the following to constraint the masses to move in pendulum-part of a circular path</p>\n<p> $ dx[i]=L*(sin \\theta[i]) $ where dx[i] is the change is x[i] position</p>\n<p> $ dy[i]=-L*cos(\\theta[i])  $ where dy[i] is the change in y[i] position</p>\n<p> x[i]=xc[i]+dx[i] where xc[i] is each balls centre or equilibrium x position</p>\n<p> y[i]=ymax+dy[i] where ymax is the support y position</p>\n<p>  $ vx[i]=L*\\omega[i]*cos(\\theta[i]) $ where vx[i] is the x direction linear velocities of each ball</p>\n<p> $ vy[i]=L*\\omega[i]*sin(\\theta[i]) $ where vy[i] is the y direction linear velocities of each ball</p>\n\n\n<h2>Others</h2>\n<ul>\n  <li><a href=\"https://shope.ee/3AhkYwOP03?share_channel_code=1\" target=\"_blank\">Buy from Shopee</a></li>\n  <li><a href=\"https://iwant2study.org/ospsg/index.php/interactive-resources/physics/02-newtonian-mechanics/02-dynamics/47-newton-cradle\" target=\"_blank\">Need a 2D version?</a></li>\n  <li><a href=\"https://iwant2study.org/ospsg/index.php/interactive-resources/physics/02-newtonian-mechanics/02-dynamics/48-newton-cradle-3d\" target=\"_blank\">Need a 3D version?</a></li>\n</ul>"
              }
            ]
          }
        ]
      }
    ],
    "RootProperties": []
  },
  "metadata": {
    "APP": "WebEJS",
    "CreatedWith": "WebEJS : The web version of Easy JavaScript Simulations",
    "MoreInfo": "WebEJS 1.2",
    "version": "https://www.um.es/fem/wikis/webejs/"
  }
}