Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Created February 14, 2012 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/1821918 to your computer and use it in GitHub Desktop.
Save kenwebb/1821918 to your computer and use it in GitHub Desktop.
Solving for Time
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Tue Feb 14 2012 19:39:33 GMT-0500 (EST)-->
<XholonWorkbook>
<Notes><![CDATA[
Khan Academy
------------
Title: Solving for Time
Description: Simple example of solving for time given distance and rate
Url: http://www.khanacademy.org/video/solving-for-time?playlist=Physics
InternalName: solving-for-time
YoutubeId: awzOvyMKeMA
Keywords: velocity, physics, mechanics
My Notes
--------
see the code
]]></Notes>
<script implName="lang:python:inline:"><![CDATA[
s = 720.0 # displacement (m)
v = 3.0 # velocity (m/s)
t = s / v # change in time (s)
print "changeInTime = " + str(t) + " seconds"
# http://ideone.com/kLHD0
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
var s = 720.0; // displacement (m)
var v = 3.0; // velocity (m/s)
var t = s / v; // change in time (s)
print("changeInTime = " + t + " seconds\n");
//javascript:(function(s,v){var t=s/v;alert("changeInTime = "+t+" seconds\n");})(720.0,3.0)
]]></script>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Person/>
<!-- quantities -->
<Displacement superClass="Length"/>
<ChangeInTime superClass="Duration"/>
</_-.XholonClass>
<xholonClassDetails>
<Person>
<port name="displacement" connector="#xpointer(Displacement)"/>
<port name="velocity" connector="#xpointer(Velocity)"/>
<port name="changeInTime" connector="#xpointer(ChangeInTime)"/>
</Person>
<ChangeInTime>
<Format>%.0f %s</Format>
</ChangeInTime>
</xholonClassDetails>
<PhysicalSystem>
<Person roleName="Ben">
<Displacement>720.0 m</Displacement>
<Attribute_String roleName="direction">east</Attribute_String>
<Velocity>3.0 m/s</Velocity>
<ChangeInTime>0.0 s</ChangeInTime> <!-- this is the unknown -->
</Person>
</PhysicalSystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
# This works if pasted in as a last child of Block.
#height.incVal(0.02)
#print("Python wants something to do. Height:" + str(height))
]]></Blockbehavior>
<Personbehavior implName="lang:javascript:inline:"><![CDATA[
// paste as the last child of Person
var s = displacement.val_Object;
var v = velocity.val_Object;
var t = s.divide(v);
changeInTime.setVal(t);
print(changeInTime + "\n");
]]></Personbehavior>
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//System.out.print("Java/Beanshell wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[
#require 'java'
# This works if pasted in as a last child of Block.
#$height.incVal(0.02)
#puts "Ruby wants something to do. Height: #{$height}"
]]></Blockbehavior>
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//System.out.print("Groovy wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment