{"id":18,"date":"2013-06-12T16:37:31","date_gmt":"2013-06-12T21:37:31","guid":{"rendered":"http:\/\/blogs.uml.edu\/cotangents\/2013\/06\/12\/_sage_cell_server_function\/"},"modified":"2019-12-14T12:12:58","modified_gmt":"2019-12-14T17:12:58","slug":"_sage_cell_server_function","status":"publish","type":"post","link":"https:\/\/blogs.uml.edu\/cotangents\/2013\/06\/12\/_sage_cell_server_function\/","title":{"rendered":"Embedded Sage Cells"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>sagecell.makeSagecell({&#8220;inputLocation&#8221;: &#8220;.sage&#8221;});<br \/>\n$(function () {<br \/>\n\/\/ Make the div with id &#8216;mycell&#8217; a Sage cell<br \/>\nsagecell.makeSagecell({inputLocation: &#8216;#mycell&#8217;,<br \/>\ntemplate: sagecell.templates.minimal,<br \/>\nevalButtonText: &#8216;Activate&#8217;});<br \/>\n\/\/ Make *any* div with class &#8216;compute&#8217; a Sage cell<br \/>\nsagecell.makeSagecell({inputLocation: &#8216;div.compute&#8217;,<br \/>\nevalButtonText: &#8216;Evaluate&#8217;});<br \/>\n});<\/p>\n<div class=\"sage\">\n  1+2<\/div>\n<p>One of the neat things about Sage, the open-source computer algebra system is that you can easily embed it into any web page. Here is an example of some code that can be evaluated to plot a function and it&#8217;s derivative. For more information about Sage: <a href=\"http:\/\/sagemath.org\"> http:\/\/sagemath.org<\/a>. To learn how to embed Sage into your web page: <a href=\"http:\/\/aleph.sagemath.org\/static\/about.html\">http:\/\/aleph.sagemath.org\/static\/about.html<\/a>.<\/p>\n<hr>\n<p>&nbsp;<\/p>\n<h1>Embedded Sage Cell<\/h1>\n<div>\n<p># You can put virtually any Sage code in this section, or simply edit the existing<br \/>\n# code any way you choose.<br \/>\ndef f(x):<br \/>\nreturn x * sin(pi*x)<br \/>\nfp=plot(f(x),x,-1,1)<br \/>\ndp=plot(diff(f(x),x),x,-1,1)<br \/>\nfp+dp<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; sagecell.makeSagecell({&#8220;inputLocation&#8221;: &#8220;.sage&#8221;}); $(function () { \/\/ Make the div with id &#8216;mycell&#8217; a Sage cell sagecell.makeSagecell({inputLocation: &#8216;#mycell&#8217;, template: sagecell.templates.minimal, evalButtonText: &#8216;Activate&#8217;}); \/\/ Make *any* div with class &#8216;compute&#8217; a Sage cell sagecell.makeSagecell({inputLocation: &#8216;div.compute&#8217;, evalButtonText: &#8216;Evaluate&#8217;}); }); 1+2 One of &hellip; <a href=\"https:\/\/blogs.uml.edu\/cotangents\/2013\/06\/12\/_sage_cell_server_function\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":331,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[21,20,19,18],"_links":{"self":[{"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/posts\/18"}],"collection":[{"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/users\/331"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/comments?post=18"}],"version-history":[{"count":6,"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/posts\/18\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/posts\/18\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/media?parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/categories?post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.uml.edu\/cotangents\/wp-json\/wp\/v2\/tags?post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}