Interactive exercises: Evaluate answer with Sage

39 views
Skip to first unread message

Stephan Boltzmann

unread,
Apr 30, 2024, 7:30:12 AMApr 30
to PreTeXt support
Hello everybody out there using PreTeXt,

The examples in the gallery on the PreTeXt website look very nice and I'm considering using PreTeXt to generate resources for teaching math.
Is there a way to use Sage for evaluating answers entered into exercises to recognize for example the equivalence of expressions like 2x and 2*x?
Will I need own webspace to host books (and would it require Sage installed) or is it possible to directly use SageMathCloud for authoring and sharing (interactive) documents generated with PreTeXt?

Kind regards
Stephan

Rob Beezer

unread,
Apr 30, 2024, 12:27:34 PMApr 30
to pretext...@googlegroups.com
Dear Stephan,

A bit brief, perhaps others can fill in as needed?

We do very little to evaluate answers to exercises. You can embed/author
WeBWorK problems, which can discern 2*x vs. 2x. But nowhere near the range of Sage.

You can host our HTML on CoCalc. Whether or not our contact with CDNs is
allowed would be a CoCalc policy/decision. You only need a text editor to
author, but anything fancier relies just on Python, so should work well on CoCalc.

Hosting on Runestone opens more possibilites for mannipulating answers to
exercises, such as in the (large) pull request

https://github.com/PreTeXtBook/pretext/pull/1931

I can see a future where Runestone servers have Sage as a local install and
support the API to the SageCellServer.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/558eac1c-1d15-4bdd-87b4-21536ca81d77n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/558eac1c-1d15-4bdd-87b4-21536ca81d77n%40googlegroups.com?utm_medium=email&utm_source=footer>.

D. Brian Walton

unread,
Apr 30, 2024, 2:32:28 PMApr 30
to pretext...@googlegroups.com
Stephan,

Can you say more about what you mean by equivalence of expressions?

The WeBWorK model, for example, considers answers to be equivalent if they are numerically equivalent (evaluating the student answer and the known answer at some number of points in the domain and comparing them for numerical equivalence up to some tolerance). This model of checking does not attempt to use algebraic rules to check if expressions are a match.

SageMath is obviously a full computer algebra system, and so it has a separate ability to test if expressions are exactly algebraically equivalent (up to some computability complexity). 

The pull request for PreTeXt that Rob referenced is something I am trying to get finished, and it includes a Javascript library that does checking similar to the WeBWorK model but without calls to an external server. So an answer like 3x^2 would be considered a match to 3*x*x or x^2*3 or x^2+x^2+x^2. A demonstration page is here https://dbrianwalton.github.io/active-exercises/ch-live-exercises.html

Brian


--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/558eac1c-1d15-4bdd-87b4-21536ca81d77n%40googlegroups.com.

Stephan Boltzmann

unread,
May 3, 2024, 4:14:14 AMMay 3
to PreTeXt support
Thanks a lot for your answers.

Simple equivalences like 1/2 = 0.5 or 3*x = 3x as you write would be sufficient, because they cover 90% of my use cases.
Section 3.24 of the PreTeXt Book explains how to use WebWork exercises, which support this use case as far as I remember.
Does this get rendered to entry fields in HTML output like in WebWork?
Is there an example of a WebWork problem in the Gallery or somewhere else?

Rob Beezer

unread,
May 3, 2024, 10:23:54 AMMay 3
to pretext...@googlegroups.com
On 5/3/24 01:14, Stephan Boltzmann wrote:
> Is there an example of a WebWork problem in the Gallery or somewhere else?

Copious examples and variations at:

https://pretextbook.org/examples/webwork/sample-chapter/html/frontmatter.html

Other versions at the "Examples" tab of the website.

Stephan Boltzmann

unread,
May 4, 2024, 3:20:43 PMMay 4
to PreTeXt support
Thanks a lot!

Are interactive exercises intended for being hosted with Runestone Academy or are they also available in default web output?
I tried to author an interactive exercise with the GitHub CodeSpace template, but could not create functional output.

Rob Beezer

unread,
May 4, 2024, 4:31:46 PMMay 4
to pretext...@googlegroups.com
Dear Stephan,

First, see:

Chapter 5: Runestone Testing
https://pretextbook.org/examples/sample-book/noparts/html/rune.html#aBc


Then, read:

Section 32.1: About Runestone Academy
https://pretextbook.org/doc/guide/html/about-runestone.html

Rob
> https://pretextbook.org/examples/webwork/sample-chapter/html/frontmatter.html <https://pretextbook.org/examples/webwork/sample-chapter/html/frontmatter.html>
>
> Other versions at the "Examples" tab of the website.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/889c0679-f32c-4b89-97d5-fef2acfa3a7cn%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/889c0679-f32c-4b89-97d5-fef2acfa3a7cn%40googlegroups.com?utm_medium=email&utm_source=footer>.
Message has been deleted

Rob Beezer

unread,
May 9, 2024, 12:05:16 AMMay 9
to pretext...@googlegroups.com
On 5/6/24 05:42, Stephan Boltzmann wrote:
> I'm afraid I might have to ask further questions on this list in the future,

That's what we are here for!

> but also hope give back and contribute to PreTeXt in the future.

And then request a membership on the pretext-dev group.

Appendix A: Welcome to the PreTeXt Community
https://pretextbook.org/doc/guide/html/welcome.html

Rob
Reply all
Reply to author
Forward
0 new messages