<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Fri Apr 06 2012 15:17:03 GMT-0400 (EDT)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Peak X (for many values of X)
Description:
Url: http://www.easterbrook.ca/steve/?p=2850
InternalName:
YoutubeId:
Keywords:
My Notes
--------
**April 5, 2012**
In his Serendipity blog for April 2, Steve Easterbrook lists the references he's found in Wikipedia and elsewhere to Peak X, where X can be oil, coal, copper, water, food, or even chocolate. He mentions that the key idea is |Hubbert’s Peak| that "applies to any resource extraction, where the resource is finite". I've never heard of Hubbert’s Peak before, so I've checked it out at Wikipedia::
http://en.wikipedia.org/wiki/Hubbert_peak_theory
permalink http://en.wikipedia.org/w/index.php?title=Hubbert_peak_theory&oldid=485291254
with additional details on the curve at::
http://en.wikipedia.org/wiki/Hubbert_curve
permalink http://en.wikipedia.org/w/index.php?title=Hubbert_curve&oldid=482542499
For this workbook I want to see if I can reproduce the Hubbert's Peak curve (a PNG image labeled "Plot of the Hubbert curve" in the Hubbert curve article) using just the information elsewhere in these two Wikipedia articles, especially the second shorter article. Because different people contribute to different parts of a typical Wikipedia article, I find there are usually gaps where you can't get from A to B. I want to see if that's true in this case.
**April 6, 2012**
I've written some JavaScript code, which you can find by scrolling down to the HubbertCurvebehavior editor on this page.
To run the code and generate some results::
Click the Run button above.
Click the Step button in the overlay. Do this 13 times to generate 13 values.
My results are::
t x
-- ---------------------
-6 0.0024665092913600485
-5 0.0066480566707901555
-4 0.017662706213291118
-3 0.045176659730912144
-2 0.10499358540350652
-1 0.19661193324148185
0 0.25
1 0.19661193324148185
2 0.10499358540350652
3 0.045176659730912144
4 0.017662706213291118
5 0.0066480566707901555
6 0.0024665092913600485
which look like the same numbers that are on the PNG image in Wikipedia. So in this case, the Wikipedia page has sufficient and consistent content.
The Wikipedia page for the PNG image itself::
http://commons.wikimedia.org/wiki/File:Hubbert-curve.png
states that it was created using gnuplot, but it doesn't provide the raw numbers that gnuplot was given. So all I can do is eyeball the image to compare it with my results.
Now I want to reproduce the curve itself, from the numbers that I've just generated. I'll use the Raphael graphics and charting library to draw a simple line chart. The result is very pointy, but it's good enough for now.
]]></Notes>
<script implName="lang:python:inline:"><![CDATA[
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
]]></script>
<_-.XholonClass>
<!-- types of domain objects -->
<PhysicalSystem/>
<HubbertPeakTheory/>
<!-- "The Hubbert curve ... is a symmetric logistic distribution curve" -->
<Curve>
<SymmetricLogisticDistributionCurve>
<HubbertCurve/>
</SymmetricLogisticDistributionCurve>
</Curve>
</_-.XholonClass>
<xholonClassDetails>
</xholonClassDetails>
<PhysicalSystem>
<!-- "The curve is the main component of Hubbert peak theory" -->
<HubbertPeakTheory>
<HubbertCurve/>
</HubbertPeakTheory>
</PhysicalSystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:javascript:inline:"><![CDATA[
]]></Blockbehavior>
<HubbertCurvebehavior implName="lang:webEditionjs:inline:"><![CDATA[
function postConfigure() {
// load Raphael graphics and charting libraries
this.xholoncreationservice('requireScript', 'raphael-min.js');
this.xholoncreationservice('requireScript', 'g.raphael-min.js');
this.xholoncreationservice('requireScript', 'g.line-min.js');
// initialize the data for the line chart
this.parent().data({"t":[], "x":[]});
// JavaScript does not contain a Math.cosh function
// try this: http://www.findmeat.org/tutorials/javascript/x910511.htm
// Add the cosh function to the Math object
function cosh(aValue)
{
var myTerm1 = Math.pow(Math.E, aValue);
var myTerm2 = Math.pow(Math.E, -aValue);
return (myTerm1 + myTerm2) / 2;
}
// Register the new function
Math.constructor.prototype.cosh = cosh;
// print headers
println("t x");
print("-- ---------------------");
}
function act() {
// x = {e^{-t}\over(1+e^{-t})^2}={1\over2+2\cosh t}
var t = this.application("getTimeStep") - 6;
var x = 1 / (2 + 2 * Math.cosh(t));
print("\n" + t + " " + x);
// save data for the line chart
this.parent().data("t").push(t);
this.parent().data("x").push(x);
// create a line chart when the value of t reaches 6
if (t == 6) {
var mySVGDiv = $("div#mySVGDiv");
mySVGDiv.empty();
var r = Raphael(mySVGDiv[0], 320, 240);
var linechart = r.linechart(10,10,300,220, this.parent().data("t"), this.parent().data("x"));
linechart.attr("stroke", "tan");
}
}
]]></HubbertCurvebehavior>
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[
]]></Blockbehavior>
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[
]]></Blockbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="320" height="240" xmlns="http://www.w3.org/2000/svg">
<g>
<title>A Hubbert Curve lurks somewhere inside this block</title>
<rect id="PhysicalSystem/HubbertPeakTheory/HubbertCurve" fill="tan" width="300" height="220" x="10" y="10"/>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>