Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active July 4, 2023 14:45
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/afcdb4a1bc72561db9389d640d77353b to your computer and use it in GitHub Desktop.
Save kenwebb/afcdb4a1bc72561db9389d640d77353b to your computer and use it in GitHub Desktop.
CtXh Fiber

Complete d3 circle pack visualization of my Pride and Prejudice app.

The cursor hovers over the IH XholonClass node, causing all CSH instances of Scene to be highlighted with a surrounding orangy circle.

Screenshot from 2023-06-24 10-07-51cropped

<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Tue Jul 04 2023 10:45:07 GMT-0400 (Eastern Daylight Saving Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: CtXh Fiber
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: afcdb4a1bc72561db9389d640d77353b
Keywords:
My Notes
--------
4 July 2023
##Math and Category Theory - Fiber
TODO: done
- example from my Pride and Prejudice workbook, with full d3 circle pack displayed
where I hover over the Scene IH Xolon class, and all scenes in the CSH get an orangy circle around them
TODO: done
- write my Xholon example using mathy notation
Let A be the set of all Scene nodes in the CSH subtree of the Xholon app Pride and Prejudice.
Let B be the set of all Scene nodes in the IH subtree. This is a singleton set, a set with exactly one element.
Let f : A -> B be a function. (f is the same as the xhc funtion in Xholon, where xhc stands for "XholonClass".)
The fiber of y under f is the set of all elements in A that map to y under the function f. It consists of all the pre-images of y in the domain A.
{x ∈ A : f(x) = y}
For all x in A, f(x) = y.
For all scene nodes in CSH, f(CSH_scene) = IH_Scene).
###Thoughts
- Fiber is about one-to-many and many-to-one relationships
- Xholon has many of these relationships
- some examples:
- CSH node to IH XholonClass node (the main example in this xholonWorkbook
- parent-child relationship
- any Xholon node may have one or more child nodes
- in a binary tree context, a node may have 0|1 left nodes and 0|1 right nodes
-
- any Xholon node may have 0|1|many Fiber relationships with other nodes/sutrees in the overall Xholon tree
- each such relationship is separate from the others
- for example, node x may be involved in both a parent-child relationship and a node-class relationship at the same time
- these are distinguised as separate roles or functions
- functions: xhc() first() next() parent() etc.
References
----------
(1) https://en.wikipedia.org/wiki/Fiber_(mathematics)
Fiber in naive set theory
Let f : X → Y f:X\to Y be a function between sets.
The fiber of an element y ∈ Y y\in Y (or fiber over y y) under the map f f is the set
f − 1 ( y ) = { x ∈ X : f ( x ) = y } ,
{\displaystyle f^{-1}(y)=\{x\in X:f(x)=y\},}
that is, the set of elements that get mapped to y y by the function. It is the preimage of the singleton { y } . \{y\}. (One usually takes y y in the image of f f to avoid f − 1 ( y ) f^{-1}(y) being the empty set.)
The collection of all fibers for the function f f forms a partition of the domain X . X. The fiber containing an element x ∈ X x\in X is the set f − 1 ( f ( x ) ) . {\displaystyle f^{-1}(f(x)).} For example, the fibers of the projection map R 2 → R {\displaystyle \mathbb {R} ^{2}\to \mathbb {R} } that sends ( x , y ) (x,y) to x x are the vertical lines, which form a partition of the plane.
If f f is a real-valued function of several real variables, the fibers of the function are the level sets of f f. If f f is also a continuous function and y ∈ R {\displaystyle y\in \mathbb {R} } is in the image of f , f, the level set f − 1 ( y ) f^{-1}(y) will typically be a curve in 2D, a surface in 3D, and, more generally, a hypersurface in the domain of f . f.
(2) https://chat.openai.com/?model=text-davinci-002-render-sha
Using math notation, define Fiber in naive set theory.
ChatGPT
In naive set theory, a fiber can be defined using math notation as follows:
Given a function f: A -> B, where A and B are sets, the fiber of an element y in B with respect to f is denoted as f^(-1)(y) or {x ∈ A : f(x) = y}.
In other words, the fiber of y under f is the set of all elements in A that map to y under the function f. It consists of all the pre-images of y in the domain A.
Note that this definition assumes that the function f is well-defined and assigns a unique value to each element in A.
(3) https://stackoverflow.com/questions/16425770/gist-how-are-images-uploaded-to-a-gist#16603413
Gist: How are images uploaded to a gist?
With a little creativity you can achieve this faster than cloning. To drag/drop:
Create the Gist
Drag an image into the comment field below. This will auto-upload your image file to https://user-images.githubusercontent.com and insert markdown code in the comment field to display the image.
Copy this markdown code to your gist
Note: It is not required that you submit the comment.
(4) Pride and Prejudice app
https://www.primordion.com/Xholon/gwt/Xholon.html?app=19b3b66f13fb1f75b9c9&src=gist&gui=d3cp
https://www.primordion.com/Xholon/gwt/Xholon.html?app=19b3b66f13fb1f75b9c9&src=gist&gui=none
https://www.primordion.com/Xholon/gwt/wb/editwb.html?app=19b3b66f13fb1f75b9c9&src=gist
https://gist.github.com/kenwebb/19b3b66f13fb1f75b9c9
]]></Notes>
<markdown><![CDATA[
###README.md
Complete d3 circle pack visualization of my Pride and Prejudice app.
The cursor hovers over the IH XholonClass node, causing all CSH instances of Scene to be highlighted with a surrounding orangy circle.
![Screenshot from 2023-06-24 10-07-51cropped](https://user-images.githubusercontent.com/1429476/250912618-fe3c7d80-202b-446b-b784-a98b89f714af.png)
]]></markdown>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Block/>
<Brick/>
<!-- quantities -->
<Height superClass="Quantity"/>
</_-.XholonClass>
<xholonClassDetails>
<Block>
<port name="height" connector="Height"/>
</Block>
</xholonClassDetails>
<PhysicalSystem>
<Block>
<Height>0.1 m</Height>
</Block>
<Brick multiplicity="2"/>
</PhysicalSystem>
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var a = 123;
var b = 456;
var c = a * b;
if (console) {
console.log(c);
}
//# sourceURL=Blockbehavior.js
]]></Blockbehavior>
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var myHeight, testing;
var beh = {
postConfigure: function() {
testing = Math.floor(Math.random() * 10);
myHeight = this.cnode.parent();
},
act: function() {
myHeight.println(this.toString());
},
toString: function() {
return "testing:" + testing;
}
}
//# sourceURL=Heightbehavior.js
]]></Heightbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Block</title>
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</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