Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Created February 26, 2012 22: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/1919402 to your computer and use it in GitHub Desktop.
Save kenwebb/1919402 to your computer and use it in GitHub Desktop.
Introduction to Vectors and Scalars
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Sun Feb 26 2012 17:36:16 GMT-0500 (EST)-->
<XholonWorkbook>
<Notes><![CDATA[
Khan Academy
------------
Title: Introduction to Vectors and Scalars
Description: Distance, displacement, speed and velocity. Difference between vectors and scalars
Url: http://www.khanacademy.org/video/introduction-to-vectors-and-scalars?playlist=Physics
InternalName: introduction-to-vectors-and-scalars
YoutubeId: ihNZlp7iUHE
Keywords: physics, motion, kinematics
My Notes
--------
domain objects
Ground, Brick, I (the agent of movement)
scalar: length (in meters), distance
vector: displacement
scalar: speed (in m/s)
vector: velocity
Xholon webEdition is a HTML and JavaScript implementation of Xholon, that contains no Java. It runs in any web browser. This workbook can be run with Xholon webEdition::
http://www.primordion.com/Xholon/wb/khan/physics/vecsca/webEdition/
]]></Notes>
<script implName="lang:python:inline:"><![CDATA[
print "TODO"
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
print("TODO\n");
]]></script>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Ground/>
<Brick/>
<!-- quantities -->
<Displacement superClass="Length"/>
<Distance superClass="Length"/>
<Speed superClass="Velocity"/>
</_-.XholonClass>
<xholonClassDetails>
<Brick>
<port name="velocity" connector="#xpointer(Velocity)"/>
<port name="displacement" connector="#xpointer(Displacement)"/>
</Brick>
<Displacement xhType="XhtypePurePassiveObject"/>
</xholonClassDetails>
<PhysicalSystem>
<Brick>
<!-- vector/scalar with the same magnitude (m) -->
<Displacement>0.0 m</Displacement> <!-- vector with direction -->
<Distance>0.0 m</Distance> <!-- scalar -->
<!-- vector/scalar with the same magnitude m/s -->
<Velocity>10.0 m/s</Velocity> <!-- vector with direction -->
<Speed>0.0 m/s</Speed> <!-- scalar -->
</Brick>
</PhysicalSystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
# This works if pasted in as a last child of Brick.
# TODO
]]></Blockbehavior>
<Brickbehavior implName="lang:javascript:inline:"><![CDATA[
// This works if pasted in as a last child of Brick.
displacement.incVal(velocity.val);
print("Brick velocity=" + velocity.val + " displacement=" + displacement.val + "\n");
]]></Brickbehavior>
<Brickbehavior implName="lang:webEditionjs:inline:"><![CDATA[
this.bindPorts(this.parent());
this.displacement.incVal(this.velocity.attr('val') - 0);
print('\nBrick velocity=' + this.velocity.attr('val') + ' ' + this.velocity.attr('unit')
+ ' displacement=' + this.displacement.attr('val') + ' ' + this.displacement.attr('unit'));
]]></Brickbehavior>
<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,
<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Brick</title>
<rect y="35" x="2" width="100" height="50" fill="#B22222" id="PhysicalSystem/Brick"/>
<g id="svg_6">
<text xml:space="preserve" text-anchor="middle" font-family="Cursive" font-size="10" id="svg_3" y="56.5" x="51.5" stroke-width="0" stroke="#000000" fill="#000000">I'm a brick</text>
<text xml:space="preserve" text-anchor="middle" font-family="Cursive" font-size="10" id="svg_4" y="72.5" x="52" stroke-width="0" stroke="#000000" fill="#000000">and proud of it!</text>
</g>
</g>
</svg>
]]></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