Wednesday, November 27, 2013

Coding Rocket Science

Title: Coding Rocket Science


Just about everything (creating Microsoft, Facebook, Twitter etc) today requires some form of programming - explaining to the computer what we wanted it to do for us. Learning by coding is complex and intimidating but clearly it also is advantageous in our digital-age world.

We conducted a 3 day, 2-3 hourly workshops to 15 students to “code” a rocket model-simulation, which inspired many of the secondary three express students to love rocket science.

Feedback from the students and teachers suggests the pedagogy of learn by coding, a rocket science example adapted from Open Source Physics is an exemplar learning approach.

A: Challenge

Today’s technology giant creators like Bill Gates creator of Microsoft, Jack Dorsey creator of Twitter and Mark Zuckerberg creator of Facebook all started out by coding and they shared “What Most Schools Don't Teach”. The problem is in part that the Ordinary Level Physics syllabus does not explicitly recommend computational thinking (A Framework for K-12 Science Education: Practices, Crosscutting Concepts, and Core Ideas, 2012, p. 51) such as coding to model physics phenomena (Christian & Esquembre, 2007) that is increasingly becoming clear to be a necessary quality to be successful in the 21st century workforce (MOE, 2012).

In today’s computer age where computers are everywhere, it makes sense to equip students with some basic computer communication-language skills (coding) and modeling “equations in codes” to figure out the computer-digital world and in our lesson example, we got students to code to learn the basics of rocket science.

B: Existing practices:

B1: Scratch by Mitch Resnick

Some schools have Scratch by Mitch Resnick that allows students to learn the basics of computational thinking without coding and it is even in the MOE-CPDD formal design and technology curriculum recently. We did not adopt this because there is no rocket science template in Scratch made yet that we can build the lesson and adapt from.

B2: Lego Mindstorm by Lego

Some schools have Robotics program such as Lego Mindstorms to allow students to learn the basics of computational thinking with some coding. We did not adopt this because there no rocket science template in Lego made yet that we can build the lesson and adapt from. Moreover, it would be financially burdening for Hillgrove Secondary to purchase them just for this purpose.

B3: ToonTalk by Ken Kahn

Based on a initial literature search, ToonTalk appears to be a free but requires installation software (school computer lab with SSOE cannot allow student to install) that aims to make programming child’s play. It is a tool suited for animation of story and we are not familiar how to model the physics of rocket science in it. In additional, the need to install the software is heighten the barriers to explore it.

B4: Why choose Easy Java Simulation by Francisco Esquembre?

B4.1 Free and powerful tool

This Easy Java Simulation, EJS, (Esquembre, 2012) tool is free and powerful physics tool from Open Source Physics (Christian, 2012) developed by Francisco Esquembre and Wolfgang Christian, world renowned Mathematician and Physicist respectively. The cost of conducting these lessons is zero dollars, assuming schools already have computer labs for students to code using EJS.

B4.2 No installation required

EJS is very easy to set-up as students need only to just unzip the file and run (not installation required). This is critical as all government aided and funded school does not allow ordinary teachers and students to install unauthorised computer program.

B4.3 Award winning physics tool with rocket lesson template

EJS is actually designed for making computer models suited for physics education and has a library of 500+ templates to choose from of which the rocket science is already modeled in Larry Engelhardt’s Modeling a Rocket Launch with Gravity and Air Resistance . We are pleased to announce that their work won the Science Prize for Online Resources in Education (Christian, Esquembre, & Barbato, 2011) where we are contributed 10+ computer modeling packages. In additional, we wanted to use tools that real physicists use for greater relevance to students who wishes to pursue a career in field of computational Physics.

B4.4 Expertise

Thanks to Larry Engelhardt’s Modeling a Rocket Launch with Gravity and Air Resistance (Figure 1), we adapted it to suit the secondary 3 enrichment programme for Hillgrove Secondary niche area of flight and aerospace. This is quite easy for us since we have being contributing to Open Source Physics since 2006 in our own free time and more formally since 2011 in an MOE-NIE-NRF funded EduLab project NRF2011-EDU001-EL001 Java Simulation Design for Teaching and Learning.

Figure 1.    Modeling a Rocket Launch with Gravity and Air Resistance written by Larry Engelhardt, licensed GNU General Public License Version 3 license, free access.

C: Conceptualization:

The seed of opportunity was planted by Ho Peng, DGE who suggested to Kenneth Lee Principal of Hillgrove Secondary to call Loo Kang (Lawrence), Specialist in MOEHQ-ETD to explore gravity-physics-by-inquiry innergy award computer models to strengthen Hillgrove Secondary’s Niche Area in flight and aerospace and was reported in Channel News Asia website (Figure 2)

Figure 2.    02 Sep 2013 By Amanda Lee on Channel News Asia website reports on the “Upper secondary students will learn how to apply physics and mathematical concepts to construct simulations in rocket science” with Education Ministry's Educational Technological Division to further develop flight and aerospace lessons and resources.
After two meetings (Figure 3), it was decided that Loo Kang would conduct an additional special enrichment course to mentor fifteen Secondary three express students on a code to learn journey to allow these students to experience what real engineers and scientists in space program could be doing, modeling science and use the model to predict what if scenario.

Figure 3. Hand drawn concept (LEFT) by teacher in hillgrove and customization by lookang (RIGHT) of Modeling a Rocket Launch with Gravity and Air Resistance written by Larry Engelhardt, licensed GNU General Public License Version 3 license, free access.
The real test is not a multi-choice pre-post test but a more authentic performance task to create rocket computer with air resistance and varying gravity model that is scientifically accurate enough and creatively adapted by the students. Their computer work in progress computer models can be accessed from their respective pages here

D: Implementation:

D1 Design/Plan:

A pilot two hour lesson (Figure 4) was conducted with seven interested in coding teachers in Hillgrove Secondary. This allows the lesson to be co-designed with teachers' input. For example, the teachers’ feedback that the “Event Handler Method” is too complex for Secondary three students and we decided students only need to code in the “Fixed Relations”. We also added more comments lines to guide the students to key in what codes to which place of the authoring toolkit for the model to run. In terms of building teacher capacity, these seven teachers should be able open and customize simple models built on the Open Source Physics.

Figure 4. Screenshot of blogpost to support teachers in Modeling a Rocket Launch with Gravity and Air Resistance.

D2 Implementation:

D2.1 Hands-on Lesson 1:

We used two trainers instead of just one as we wanted to support and facilitate the students each with their own computer models building. This has allowed for more timely support to guide the students in their many questions.

We used a website (Figure 5) for students to access and with the instructions and screenshots to support differentiate instruction and pace of the students. The engagement phase we used a case where students role play as real scientist and engineers working on the International Space Station program.

Figure 5.    Screenshot of to support students in the engagement phase of role playing as real scientist and engineers working on the International Space Station program.
To give the readers a flavour of the lesson, we explain some key stages, similar to “productive failure” of what the students “code to learn” during the hands-on lesson such as to change start with a template where the evolution of the incomplete rocket model starts from a constant upward velocity motion model (Figure 6).

Figure 6. Screenshot (LEFT) EJSconsole Evolution dy/dt = vy =1 and the corresponding (RIGHT) simulation view of the rocket moving upwards at a constant velocity vy = 1 source code

Through progressively testing and failures of their own initial ideas-models they can incrementally getting closer to an appropriate rocket model.
Students could progress from a model on free falling equation of motion (Figure 7).
$\frac{dv_{y}}{dt}=  -g$ 

The students need to declare their variables such as g = 9.81 after looking the error message.

Figure 7. Screenshot (LEFT) EJSconsole Evolution dv/dt = -g = -9.81 and the corresponding (RIGHT) simulation view of the rocket moving downwards at a increasng rate as predicted by evolution equation.

Progressing through the Newton’s 2nd Law,

 $\frac{dv_{y}}{dt}=  a = \frac{F}{m}$ 

students can suggest the F/m, force per unit mass to be model for the case of the rocket exhaust gases creating a thrust. The students were brought through the derivation combining

$F = ma = \frac{dm}{dt}( \int a dt ) =BurnRate*v $  

where burnRate is the amount of fuel burnt per sec and v is the velocity of the exhaust gases ejecting downwards from the rocket’s bottom.

So the students code in
 $a = \frac{dv_{y}}{dt} = -g +  \frac{(burnRate*v)}{(m+mFuel)}$

Here, the students also need to declare the variables introduced such as exhaust gases velocity v = 7000 m/s, Mass of rocket M =10000 kg etc.

Typically, in normal classroom teaching, students would have difficulties appreciating Burnrate because it is a concept that ordinary classroom does not allow for testing through mathematical modeling, whereas in this lesson, students can propose incorrect models can see the outcomes of their incorrect model until they are satisfied with their results simulated by the computer.
The other teaching moment could be the need to divide by mass of rocket and mass of rocket fuel (m+mFuel) which students usually memorize without opportunities for simulated feedback from a computer on their models-equations.
The students were also not able to distinguish 2 similar variables such as velocity of rocket vy and velocity of fuel v, but because these 2 variables are testable through the model, the students were more appreciative of these distinct variables despite its common SI units of metre per second.

Figure 8. Screenshot (LEFT) EJSconsole Evolution dv/dt = -g +(burnRate*v)/(m+mFuel) and the corresponding (RIGHT) simulation view of the rocket moving upwards at an increasing rate as predicted by evolution equation.

To model air resistance, the students need to add a DragForce model such as

DragForce = 0.5*densityair*area*Cd*vy*vy

where densityair = 1.25 kg/m3, cross sectional area of rocket pushing through air = 10 m2 (given), coefficient of drag Cd = 0.5 (given) and vy is the velocity of the rocket in the y direction.
Figure 9. Screenshot (LEFT) EJSconsole Evolution dv/dt = -g +(burnRate*v)/(m+mFuel) –DragForce/((m+mFuel); and the corresponding (RIGHT) simulation view of the rocket moving upwards with air resistance with a sudden drop in velocity at t =10 s after the mFuel and BurnRate = 0 with Dragforce and gravity acting downwards to oppose the rocket’s continual upward motion.

Figure 10. Screenshot (LEFT) EJSconsole Fixed relation where DragForce = 0.5*densityair*area*Cd*vy*vy is modeled and the corresponding (RIGHT) variables page view with the respectively variables declared.

In summary, we introduce the basics of coding in the context of EJS (Easy Java Simulation) by eliciting what the students already know in terms of equations of motion involving acceleration in the y-direction dvy/dt (Figure 6). We bring the students through a process of model improvement or ‘productive failure’ ( adding gravity –g (Figure 7), adding rocket propulsion +BurnRate/(m+mFuel) (Figure 8), and including air drag -DragForce/(m+mFuel) (Figure 9)). We speculate this failure of each model allows for deepening of understanding that playing with simulations or reading traditional books alone cannot provide.

Lastly, to ensure learning occurs on track, we included a working teacher model RocketTemplatewee.ejs (Figure 11) for students to check for coding differences and guiding students who progress at their own paces.

Figure 11. Screenshot of to support students in the exploring-building phase of role playing as real scientist and engineers working on the International Space Station program. Notice students only need to key in on the Fixed Relations with scaffolding comments lines made by the trainers. A incomplete RocketTemplatemodified.ejs and a teacher model RocketTemplatewee.ejs are provided to guide the students in this hands-on lesson.
We are pleased to report that for 2.5 hours, the students were engaged in the hands-on and no one was seen playing some unrelated computer games.

Figure 12. Photo by lawrence of students in the exploring-building phase working on implementing their ideas and make sense of the lesson for 2.5 hours of concentrated doing and thinking.

D2.2 Adaptive Lesson 2:

The next lesson was more personal-mentoring where we wanted to solve the students’ problems in coding so there were less direct instructions and more personal discussions. We also planned out some of the essential activities and tasks for students to do on the website An example of this could be relating how a real rocket should behave when it reaches the ground again. The code required is

if (y  < 0 ) { _pause () ; }
as shown. The students could now see the effects of this new code as previously, the rocket would move below the ground whereas now the simulation pause after hitting the ground surface when y = 0.
Figure 13.  EJSconsole view of the codes students need to key in or copy and paste from google site or teacher model. 
if (y  < 0 ) { _pause () ; }

While in the lesson, there were opportunities where we link the real world context to the computer model so we got students to associate that what they are doing is modeling the real world physics.

For example, we know that this equation predicts the gravitational field strength

$g = G\frac{M_{earth}}{r_{earth}^{2}}$ 

where G is the universal gravitational constant =6.67384 × 10^-11 m3 kg-1 s^-2and r = 6.37× 10^6 m is the radius of the Earth to that point.

After struggling with some simple ratio

$\frac{g}{g_{surface}} = \frac{G\frac{M_{earth}}{(r_{earth}+y)^{2}}}{G\frac{M_{earth}}{(r_{earth})^{2}}}$ 

where y is the height of the rocket above the surface at ground level. We arrived at the expression to be used in the model as
$g = \frac{r_{earth}^{2}}{(r_{earth}+y)^{2}}g_{surface}$ 

So the student need to implement this mathematical equation in the fixed relations (Figure 14) and see what happens for themselves that when y = 5 × 10^6 m, the gravitational field strength is g = 8.43 ms-2 (Figure 15).

Figure 14. EJSconsole view of what the students need to do in the key in g = gs*Rearth*Rearth/( (y+Rearth)*(y+Rearth) ); into the fixed relations.

Figure 15. Simulation view of the rocket at the height above ground y = 5 × 106 m , the gravitational field strength is g = 8.43 ms-2 so that they know how the number is changing according to the mathematical model for gravity they constructed by keying g = gs*Rearth*Rearth/( (y+Rearth)*(y+Rearth) ); into the fixed relations.

D2.3 End in mind Lesson 3:

The last lesson we got the students to use the teacher model where the physics is correctly modeled and we explain the various physics concepts in the context of a rocket. The students were asked to predict what will happen, observe the teacher model and collectively we illicit explanations from them based on the evidences from the model.

So the trainers are not always correct but rather we all rely on the computer model to situate our discussions and collective agreement.

The students also answered some of the questions asked on the Day 1 with their screen capture their computer screens and share their answers, for example
For example, it would be difficult for students to solve word problems on rocket but now through coding, the students were able to answer questions like

“Can this rocket reach the international space station (ISS) at height y = 355 000 m?” 

Being able to check the codes and the eventual running of the rocket model (Figure 16) really is key to making sense and deepening learning.

Figure 16. Simulation view of a student’s model rocket at the height reaching the international space station at the height of 355 km at the time of about 325 seconds where the minimum fuel required is about 8500 kg.

The other question two is

“Using the rocket’s full fuel capacity, what is the maximum payload in kilogram that could reach the ISS?” 

After some playing and changing the mass of the rocket to 12500 kg, most students understand payload as additional mass which is 2500 kg (Figure 17) after subtracting the mass of rocket of 10000 kg.

Figure 17. Simulation view of student’s model of the rocket at the launch hirht y = 0 where student key in M = 12500 kg to test whether the rocket can still reach the international space station at the height of 355 km with the typical fuel of 10000 kg.    

E1: Quantitative Feedback

Questions \ Likert Scale
Strongly Disagree
Strongly Agree
The lesson meet schools’, teachers’ and pupils’ needs
I enjoyed learning about physics through this lesson
this lesson prepare you for life instead of just for examinations
SDL1. this lesson allow for 1. Ownership of Learning - self-directed learning?
SDL2. This lesson allow for 2. Management and Monitoring of Own Learning - self-directed learning?
SDL3. This lesson allow for 3. Extension of Own Learning - self-directed learning?
CoL1. This lesson allow for 1. Effective Group Processes - collaborative learning?
CoL2. This lesson allow for 2. Individual and Group Accountability of Learning - collaborative learning?

E2: Qualitative Feedback

Themes emerged for the feedback are as follows:

Strengths: Love for learning, Feel like scientists etc

  1. This course makes me learn more about physics, learning things outside the classroom. It was interesting and would recommend the others to try out. 
  2. Questions from students are answered at a fast response. Able to explain terms that we dont understand. 
  3. Students are exposed to new things at a young age. This also allows students to learn things that are not found easily outside 
  4. I have learnt more things about physics and this has helped me develop my understanding of physics. 
  5. I have learnt something outside the classroom which is much more interesting than just learning what's in the textbook. It has made me more interested in physics too. 
  6. Questions. Make me ask questions. 
  7. It taught me rocket science :D 
  8. In these lessons, I learnt about rocket simulation. 
  9. In these lessons I've attended, it had made me feel like being a scientist, making studies on rocket simulations. 

Area of improvement: Difficult pedagogy

  1. Maybe a longer duration would be better. 
  2. It is too complicated and difficult to understand. 
  3. Some equations are a little too complicated. ( the codes ) 
  4. Some parts of the lesson is hard to understand. 
  5. Students sitting at the back could not see the screen so sometimes do not what to do. 
  6. Students sitting at the back couldn't really see anything as the computers are blocking. 

Comments: Thank you teachers, effective lesson etc

  1. I have enjoyed the course and I would like to thank the trainers and the teachers for teaching and organizing the course. 
  2. This is effective as it helps us to understand space better by teaching us the concepts of rockets. However, it is more difficult for us as most of us do not understand coding 
  3. The teachers have been really helpful in clearing doubts that the students had.
The teacher in charge was very grateful to the trainers for having gone the extra mile in mentoring his students to “learn by coding” as this is an advance pedagogical approach practice by computational physics professors in overseas universities.

F: Effective:

The quantitative feedback table( N=9) above suggests the lessons have largely being able to meet the schools’, teachers’ and pupils’ needs, (88%) 2) they enjoyed learning about physics through this lesson (100%) 3) they agree these lessons prepare them for life instead of just for examinations (100%).

Elements of self directing learning (100%) and collaborative learning (96%) were also evident during the lessons as we guided students to code their rocket model and allow their work collaboratively after class on the same model.

The qualitative feedback suggests the students appreciated the rationale for having such specialized pedagogy aims to better prepare them for the future despite the difficulties in learning by coding both in software and physics content knowledge mastery.

The teacher-in-charge tried to learn how to conduct lesson on coding but also expressed reservations in doing this same lesson next year as he still need more guidance and experience in conducting such specialized pedagogy – learn by coding.

G1: Global Scaling up

The lesson is published publicly on and anyone is free to scale up in their own schools, licensed creative commons attribution. For example, a teacher in Greece has gotten many ideas on how to conduct his own lessons by looking at the way we conducted our lessons.

Figure 18.    Fellow teacher Νικόλαος Κυπριωτάκης in Greece thanking us for giving him many ideas on learn by coding.

G2: Local scaling up

The vice principal of river valley high has expressed interest in these line of lessons –learn by coding rocket science example. In fact, this school has also conducted similar lessons before on the example of frictional sliding block example over 1 academic year for secondary three as a student research project.

The lesson is also published in OPAL ICT connection lesson example for login users and we will be sharing this in various platforms such as Physics Chapter Brown Bag Series, eduLab@AST workshop etc.

H: Suitability to public

H1: Use the learning by coding pedagogy

The lesson is suitable for parents and public with (TPACK) Technological Pedagogical Content Knowledge (Mishra & Koehler, 2006) and the willingness to learn by coding together with their children.

H2: Use model-simulation to explain

Parents and public could also use this lesson’s model-simulation to explain a recently launched Singapore’s Nanyang Technological Universityfirst student-built satellite, VELOX-PII, soaring some 600km above Earth. The 1.33kg pico-satellite was designed and built entirely by engineering students from NTU’s Undergraduate Satellite Programme.

H3: Use the mobile app version to explain or/and learning by coding

We have also created a mobile operating system version of the rocket model (Figure 19) view able on most mobile phone browsers here and the editable source code is available here for learning by coding pedagogy.

Figure 19. Basic Rocket JS Model re made into a JavaScript (JS) Model for running on most mobile device browser. Basic Rocket JS Model author: Larry Engelhardt and lookang (this JS model)online: offline: source code:


  1. Christian, Wolfgang. (2012). Building a National Digital Library for Computational Physics Education Podcast. from
  2. Christian, Wolfgang, & Esquembre, Francisco. (2007). Modeling Physics with Easy Java Simulations. Physics Teacher, 45(8), 475-480. 
  3. Christian, Wolfgang, Esquembre, Francisco, & Barbato, Lyle. (2011). Open Source Physics. Science, 334(6059), 1077-1078. doi: 10.1126/science.1196984
  4. Esquembre, Francisco. (2012). Easy Java Simulations. Retrieved 13 September, 2012, from 
  5. A Framework for K-12 Science Education: Practices, Crosscutting Concepts, and Core Ideas. (2012). Washington, DC: The National Academies Press.
  6. Mishra, Punya, & Koehler, Matthew J. (2006). Technological Pedagogical Content Knowledge: A Framework for Teacher Knowledge. Teachers College Record, 108(6), 1017-1054. 
  7. MOE. (2012). Opening Address by Mr Hawazi Daipi, Senior Parliamentary Secretary Ministry of Education and Ministry of Manpower, at the International Conference on Teaching and Learning with Technology (iCTLT) at the Suntec International Convention and Exhibition Centre, on Thursday, 29 March 2012. Retrieved 29 March, 2012, from
  8. Wee, Loo Kang, & Mak, Wai Keong. (2009, 02 June). Leveraging on Easy Java Simulation tool and open source computer simulation library to create interactive digital media for mass customization of high school physics curriculum. Paper presented at the 3rd Redesigning Pedagogy International Conference, Singapore.

Friday, November 22, 2013

How to Sign Jar Files for Web Deployment of Java Applets, an Easy Java Simulation applet example.

How to Sign Jar Files for Web Deployment of Java Applets, an Easy Java Simulation applet example.
this tutorial serves to allow you to sign your own EJS applets.

  1. install latest JDK from For example, Windows x86 for Windows  XP operating system
  2. after installation, there should be C:\Program Files\Java\jdk1.7.0_45\bin where the keytool.exe is located. 
  3. in order to run the cmd line keytool, add the PATH to include C:\Program Files\Java\jdk1.7.0_45\bin by going to Start , Settings, Control Panel 
  4. Navigate to System, Environment Variables, Path Edit and add ;C:\Program Files\Java\jdk1.7.0_45\bin to the Variable value, so that the cmd line keytool avoid the error 'keytool' is not recognized as an internal or external command, operable program or batch file.
  5. Now, you are ready to go and type some lines by Naviagting to Start, Run 
  6. type in cmd and press enter in the keyboard 
  7. this will bring up a C:\WINDOWS\system32\cmd.exe console
  8. in order to save yourself some heavy typing, use the windows explorer to navigate to the folder where you saved all your jar files that you want signed. For example copy F:\Dropbox\Public\lookangEJSworkspace\export
  9.  go to  C:\WINDOWS\system32\cmd.exe console and do a right click and paste after you type cd  F:\Dropbox\Public\lookangEJSworkspace\export 
  10. to get cd  F:\Dropbox\Public\lookangEJSworkspace\export and you need to type f: if you are using a different drive like me 
    cd F:\Dropbox\Public\lookangEJSworkspace\export
  11. type keytool -genkey -keystore myKeystore -alias myAlias -validity 1800 , for my example my Alias is lookang, i recommend to keep myKeystore as it is and adding -validity 1800 for a 1800 days of certification instead of the default 6 months. i used keytool -genkey -keystore myKeystore -alias lookang -validity 1800 
    keytool -genkey -keystore myKeystore -alias lookang -validity 1800
  12. enter your own password, don't tell anyone this password and follow the instruction the best you see fit  
  13. notice that a new file called myKeystore is generated in the folder F:\Dropbox\Public\lookangEJSworkspace\export 
  14. u are now ready to sign all jar applets using that just created myKeystore. type or copy this jarsigner -keystore myKeystore myJar.jar myAlias but for my case i will type jarsigner -keystore myKeystore ejs_model_RocketTemplatewee.jar lookang . you need to replace myJar.jar with the name of the own *.jar files and the myAlias also need to replace to the myAlias you used, for my case lookang. When ask for the Passphrase, just key in your password you used in step 12.
    jarsigner -keystore myKeystore ejs_model_RocketTemplatewee.jar lookang
  15. now, how do i create a *.bat to run all this command for my 100+ applets? leave a Google+ comment at the bottom of this post and tell how :) Enjoy!