WorkspacePublishingGraphingExample
ThoughtStorms Wiki
Previously : CardiganBayWorkspacePublishing
Here's a longer example of a workspace published within an exported Cardigan Bay page. You should be seeing this on ThoughtStorms wiki.
You are looking at a static HTML page exported using Cardigan Bay. But the workspace, containing a simple toy graphing calculator, will run on the public site. Thanks to the Scittle interpreter included within this page.
Note a couple of features. Although there's some infrastructure to make the graphing work, it has been hidden from you.
All you see in the textarea below is a function f which we will graph, a definition of a vector of points pts made with f. And a call to graphit which actually graphs the points.
You can edit these, to change the function or the range of numbers it gets applied to, and re-run the code.
Although we don't have a Clojure maths library included, you can get at standard Javascript libs using Scittle. So try some alternative functions like :
(defn f [x] (js/Math.sin x))(def pts (make-pts -10 10 0.01 f))
or
(defn f [x] (* (mod x 11) (mod x 7)))(def pts (make-pts 0 100 1 f))
Workspace
See GraphingExampleFullSource if you want to see the entire source code of this app.
Backlinks (3 items)