Macro Library sagecell

Sagecell integration documentation, Version 1.0, Jan 2018

There is not need to actually load this macro library. This documentation describes how to set up your HTML to enable SageCell integration.

For a basic SageCell that students can use for calculations, but for which their work is NOT retained when they submit the question, you can put in your HTML a pre tag with class converttosagecell, and put your starting/default Sage code inside of it. Like this:

<pre class="converttosagecell">
  x = var('x')
  integral(sin(x), x)
</pre>

If you want to store the student's code so they can modify it and you can view it, then you'll need to add an essay part to your question. See the example below for an example of how you could set it up, including providing default Sage code

Question Type: Multipart. Question Code:

$anstypes = "essay,numfunc"
$answeights = "0,1"
$scoremethod = "singlescore"
$a = rand(2,8)

$answer[1]= "-$a cos(x)"

Question text:

<p>Modify the Sagecell below to find the integral of `$a sin(x)`</p>
<div class="converttosagecell">
  $answerbox[0]
  <pre class="hidden">
    x = var('x')
    integral(sin(x), x)
  </pre>
</div>
<p>Answer: $answerbox[1]</p>