{"id":1261,"date":"2018-07-05T15:31:58","date_gmt":"2018-07-05T22:31:58","guid":{"rendered":"https:\/\/harrydole.com\/wp\/?p=1261"},"modified":"2023-12-14T11:01:24","modified_gmt":"2023-12-14T19:01:24","slug":"catecon-factorial","status":"publish","type":"post","link":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/","title":{"rendered":"Catecon:  Factorial"},"content":{"rendered":"<p><span style=\"font-size: 8pt;\">Prior video <a href=\"https:\/\/harrydole.com\/wp\/2018\/06\/28\/catecon\/\">Catecon: Introduction<\/a>.<\/span><\/p>\n<div class=\"wonderplugin-video\" style=\"width:600px;height:340px;position:relative;background-color:#000;overflow:hidden;max-width:100%;margin:0 auto\" data-aspectratio=\"1.7647058823529\"><div class=\"wpve-videoplayer\" style=\"position:relative;width:100%;height:100%\" data-mp4=\"https:\/\/harrydole.com\/video\/catecon-factorial.mp4\" data-skinfolder=\"https:\/\/harrydole.com\/wp\/wp-content\/plugins\/wonderplugin-video-embed\/engine\/\" data-playbutton=\"https:\/\/harrydole.com\/wp\/wp-content\/plugins\/wonderplugin-video-embed\/engine\/playvideo-64-64-0.png\"><\/div><\/div>\n<p>My first machine to play on beyond some sticks to rub together (a slide rule) was an Olivetti Programma 101 with magnetic cards.<\/p>\n<p>My first program, well, one with loops, was to compute factorials.<\/p>\n<p>Let\u2019s do that here, with recursion.<\/p>\n<p>Given a natural number n, the factorial of n is n times the factorial of n minus one.<\/p>\n<p>To begin, create a new diagram.<\/p>\n<p>Given the name, say factorial, and for HTML entities let\u2019s use n-bang.<\/p>\n<p>For the description say it\u2019s the recursively defined factorial.<\/p>\n<p>To begin let\u2019s drag the natural numbers onto the diagram.<\/p>\n<p>Control-drag from it to begin a new identity morphism.<\/p>\n<p>Select the morphism and edit the data.<\/p>\n<p>We know zero factorial and one factorial, so let\u2019s add that data.<\/p>\n<p>Zero factorial is one, and one factorial is one.<\/p>\n<p>Change the automatically generated name to n-bang.<\/p>\n<p>Control-drag the morphism to create another copy.\u00a0 We need this for the recursion.<\/p>\n<p>Next let\u2019s see where we can go from a natural numbers object.<\/p>\n<p>Let\u2019s pick delta under the Transforms section so we can make two copies of our original object.<\/p>\n<p>We need the predecessor to setup the recursion.\u00a0 Drag it over.<\/p>\n<p>Fuse predecessor\u2019s codomain with n-bang\u2019s domain.<\/p>\n<p>Compose the two and control-drag to take a copy.<\/p>\n<p>Control drag from N to form an identity.<\/p>\n<p>Select it and detach it.<\/p>\n<p>Drag it over our composite until it turns blue.<\/p>\n<p>Drop it to form the product of the two morphisms.<\/p>\n<p>Fuse the product\u2019s domain with the delta\u2019s codomain.<\/p>\n<p>Select the product\u2019s codomain and see where we can go from there.<\/p>\n<p>Multiplication looks like a good choice.\u00a0 Do it.<\/p>\n<p>Now fuse that codomain onto the other.<\/p>\n<p>Select the three morphisms in order, then click the compose button.<\/p>\n<p>We see the composite morphism appear in the same hom-set as n-bang.<\/p>\n<p>Now that we have a composite representing the recursion for n-bang, select n-bang and then the composite.<\/p>\n<p>Click on the recursion button and we see that the recursor has been set.<\/p>\n<p>If we look at the recursively defined n-bang we see that the recursor is set.<\/p>\n<p>Basically, we can think of this as each time we recurse, we add another bit of diagram to the bottom.<\/p>\n<p>Talking our way through the composite, we take two copies of our original number, then decrement the first followed by recursively determining it, and then multiply the original value times that.<\/p>\n<p>Perhaps we should test this.<\/p>\n<p>Take a natural number object and control-drag an identity from it.<\/p>\n<p>Fuse the codomain to the n-bang\u2019s domain.<\/p>\n<p>Now edit the morphism and add a range.<\/p>\n<p>Start at index 0, with a range of 100, and start the codomain at zero.\u00a0 We should get to 99 factorial this way.<\/p>\n<p>Select that morphism followed by n-bang with a shift-click.<\/p>\n<p>Hit the compose button.<\/p>\n<p>Evaluate it.<\/p>\n<p>That creates a new data map.\u00a0 Select it and view the contents.<\/p>\n<p>That looks factorially, but I think the Programma 101 had more digits.\u00a0 No floating point though.<\/p>\n<p>Ecmascript implementations of numerics are nominally double precision floating point, so this expires around e308.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prior video Catecon: Introduction. My first machine to play on beyond some sticks to rub together (a slide rule) was an Olivetti Programma 101 with magnetic cards. My first program, well, one with loops, was to compute factorials. Let\u2019s do that here, with recursion. Given a natural number n, the factorial of n is n&hellip; <\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":1264,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32,5],"tags":[33,28,41],"class_list":["post-1261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-catecon","category-math","tag-catecon","tag-category-theory","tag-math","xfolkentry","clearfix"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Catecon: Factorial - Harry Dole<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Catecon: Factorial - Harry Dole\" \/>\n<meta property=\"og:description\" content=\"Prior video Catecon: Introduction. My first machine to play on beyond some sticks to rub together (a slide rule) was an Olivetti Programma 101 with magnetic cards. My first program, well, one with loops, was to compute factorials. Let\u2019s do that here, with recursion. Given a natural number n, the factorial of n is n&hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Harry Dole\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-05T22:31:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-14T19:01:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/harrydole.com\/wp\/wp-content\/uploads\/2018\/07\/factorial.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3440\" \/>\n\t<meta property=\"og:image:height\" content=\"1934\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Harry Dole\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Harry Dole\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/\"},\"author\":{\"name\":\"Harry Dole\",\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/#\\\/schema\\\/person\\\/da373a629b425372a0d15abd61d36610\"},\"headline\":\"Catecon: Factorial\",\"datePublished\":\"2018-07-05T22:31:58+00:00\",\"dateModified\":\"2023-12-14T19:01:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/\"},\"wordCount\":558,\"publisher\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/#\\\/schema\\\/person\\\/da373a629b425372a0d15abd61d36610\"},\"image\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/harrydole.com\\\/wp\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/factorial.png?fit=3440%2C1934&ssl=1\",\"keywords\":[\"Catecon\",\"Category Theory\",\"Math\"],\"articleSection\":[\"Catecon\",\"Math\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/\",\"url\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/\",\"name\":\"Catecon: Factorial - Harry Dole\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/harrydole.com\\\/wp\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/factorial.png?fit=3440%2C1934&ssl=1\",\"datePublished\":\"2018-07-05T22:31:58+00:00\",\"dateModified\":\"2023-12-14T19:01:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/harrydole.com\\\/wp\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/factorial.png?fit=3440%2C1934&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/harrydole.com\\\/wp\\\/wp-content\\\/uploads\\\/2018\\\/07\\\/factorial.png?fit=3440%2C1934&ssl=1\",\"width\":3440,\"height\":1934},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/2018\\\/07\\\/05\\\/catecon-factorial\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Catecon: Factorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/#website\",\"url\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/\",\"name\":\"Harry Dole\",\"description\":\"&quot;...And one day a great and mighty wind will encompass the surface of the earth and wipe clean the scourge of wooly thinking once and for all!&quot; -- Time Bandits\",\"publisher\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/#\\\/schema\\\/person\\\/da373a629b425372a0d15abd61d36610\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/#\\\/schema\\\/person\\\/da373a629b425372a0d15abd61d36610\",\"name\":\"Harry Dole\",\"logo\":{\"@id\":\"https:\\\/\\\/harrydole.com\\\/wp\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/harrydole.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Catecon: Factorial - Harry Dole","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/","og_locale":"en_US","og_type":"article","og_title":"Catecon: Factorial - Harry Dole","og_description":"Prior video Catecon: Introduction. My first machine to play on beyond some sticks to rub together (a slide rule) was an Olivetti Programma 101 with magnetic cards. My first program, well, one with loops, was to compute factorials. Let\u2019s do that here, with recursion. Given a natural number n, the factorial of n is n&hellip; Continue reading &rarr;","og_url":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/","og_site_name":"Harry Dole","article_published_time":"2018-07-05T22:31:58+00:00","article_modified_time":"2023-12-14T19:01:24+00:00","og_image":[{"width":3440,"height":1934,"url":"https:\/\/harrydole.com\/wp\/wp-content\/uploads\/2018\/07\/factorial.png","type":"image\/png"}],"author":"Harry Dole","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Harry Dole","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/#article","isPartOf":{"@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/"},"author":{"name":"Harry Dole","@id":"https:\/\/harrydole.com\/wp\/#\/schema\/person\/da373a629b425372a0d15abd61d36610"},"headline":"Catecon: Factorial","datePublished":"2018-07-05T22:31:58+00:00","dateModified":"2023-12-14T19:01:24+00:00","mainEntityOfPage":{"@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/"},"wordCount":558,"publisher":{"@id":"https:\/\/harrydole.com\/wp\/#\/schema\/person\/da373a629b425372a0d15abd61d36610"},"image":{"@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/harrydole.com\/wp\/wp-content\/uploads\/2018\/07\/factorial.png?fit=3440%2C1934&ssl=1","keywords":["Catecon","Category Theory","Math"],"articleSection":["Catecon","Math"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/","url":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/","name":"Catecon: Factorial - Harry Dole","isPartOf":{"@id":"https:\/\/harrydole.com\/wp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/#primaryimage"},"image":{"@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/harrydole.com\/wp\/wp-content\/uploads\/2018\/07\/factorial.png?fit=3440%2C1934&ssl=1","datePublished":"2018-07-05T22:31:58+00:00","dateModified":"2023-12-14T19:01:24+00:00","breadcrumb":{"@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/#primaryimage","url":"https:\/\/i0.wp.com\/harrydole.com\/wp\/wp-content\/uploads\/2018\/07\/factorial.png?fit=3440%2C1934&ssl=1","contentUrl":"https:\/\/i0.wp.com\/harrydole.com\/wp\/wp-content\/uploads\/2018\/07\/factorial.png?fit=3440%2C1934&ssl=1","width":3440,"height":1934},{"@type":"BreadcrumbList","@id":"https:\/\/harrydole.com\/wp\/2018\/07\/05\/catecon-factorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/harrydole.com\/wp\/"},{"@type":"ListItem","position":2,"name":"Catecon: Factorial"}]},{"@type":"WebSite","@id":"https:\/\/harrydole.com\/wp\/#website","url":"https:\/\/harrydole.com\/wp\/","name":"Harry Dole","description":"&quot;...And one day a great and mighty wind will encompass the surface of the earth and wipe clean the scourge of wooly thinking once and for all!&quot; -- Time Bandits","publisher":{"@id":"https:\/\/harrydole.com\/wp\/#\/schema\/person\/da373a629b425372a0d15abd61d36610"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/harrydole.com\/wp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/harrydole.com\/wp\/#\/schema\/person\/da373a629b425372a0d15abd61d36610","name":"Harry Dole","logo":{"@id":"https:\/\/harrydole.com\/wp\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/harrydole.com"]}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/harrydole.com\/wp\/wp-content\/uploads\/2018\/07\/factorial.png?fit=3440%2C1934&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/posts\/1261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/comments?post=1261"}],"version-history":[{"count":6,"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/posts\/1261\/revisions"}],"predecessor-version":[{"id":1269,"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/posts\/1261\/revisions\/1269"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/media\/1264"}],"wp:attachment":[{"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/media?parent=1261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/categories?post=1261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/harrydole.com\/wp\/wp-json\/wp\/v2\/tags?post=1261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}