Symbolic Differentiation

76 views
Skip to first unread message

arndl...@gmx.de

unread,
Aug 3, 2018, 10:59:30 AM8/3/18
to Numbas Users
Hi

As a new user of Numbas I may very likely overlook something obvious, but has Numbas CAS abilities in regard to symbolic differentiation?
All examples I did find assume a certain function type and vary just the coefficients, exponents...

I created a solution with GeoGebra that lets you input a "random" function (random as far as GeoGebra can handle it) and checks if your first derivative is correct:

but maybe there are ways to do it in Numbas only?


Thanks

Arnd

Christian Lawson-Perfect

unread,
Aug 6, 2018, 7:49:07 AM8/6/18
to numbas...@googlegroups.com
Numbas doesn't have any in-built symbolic differentiation. It's been on my to-do list since 2011 - https://github.com/numbas/Numbas/issues/45 - maybe I should get round to it!

It hasn't been a priority because of the way "mathematical expression" parts are marked: they check that the student's expression gives the same values as the expected expression, over randomly picked values of the variables present in both expressions. That actually works for differentiation - a function's derivative is unique, so you can give the expected answer when you write the question, without asking Numbas to do it for you.

However, there are certainly lots of things that would be made easier or even possible by having symbolic differentiation built in. I do want to put it in at some point, but I'm wary of having to write out derivatives for every function Numbas supports. What would be a good minimal set of functions to start with? I made a start just over 3 years ago in this question - https://numbas.mathcentre.ac.uk/question/3732/custom-marking-differentiate-student-s-answer/ - with terms of the form x^n, sin and cos, but didn't go anywhere from that.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

arndl...@gmx.de

unread,
Aug 7, 2018, 10:14:21 AM8/7/18
to Numbas Users
Thanks for the quick answer.
What about using existing javascript cas libraries like http://algebrite.org/?

Christian Lawson-Perfect

unread,
Aug 7, 2018, 10:49:02 AM8/7/18
to numbas...@googlegroups.com
It would be more work to copy Algebrite's differentiation code into Numbas than it would be to just start from scratch.

zalog...@gmail.com

unread,
Aug 12, 2018, 12:34:16 AM8/12/18
to Numbas Users
Out of curiosity (and this may well show my ignorance), what's the issue with just using algebrite's functionality directly? Or simply wrapping it up a bit so that the Numbas equivalent simply calls an algebrite function? It's a fairly lightweight package, so I can't imagine it would add much to the compute time, and it seems like far less work to wrap up a JS CAS that's already functioning rather than writing one from scratch...am I missing something here?

Cheers,
Artem

Christian Lawson-Perfect

unread,
Aug 20, 2018, 8:49:25 AM8/20/18
to numbas...@googlegroups.com
Algebrite isn't that light: the script bundled up for the browser (https://github.com/davidedc/Algebrite/blob/master/dist/algebrite.bundle-for-browser.js) is 597KB. The entire Numbas runtime is 688KB.
To call out to Algebrite would require flawless translation between the two systems as expressions go in and come out. I can see that causing headaches.
Anyone wanting to extend the differentiation behaviour would have to understand both JME and Algebrite, and work with whatever build system Algebrite uses.

Symbolic differentiation really isn't hard, it will definitely be quicker to just write new code for JME than to work out how to translate to Algebrite and back.

zalog...@gmail.com

unread,
Aug 24, 2018, 7:05:08 PM8/24/18
to Numbas Users
Hmm, when you put it in that perspective, 'light' isn't at all the correct word to use.

I guess my bigger interest with this would be to have a working CAS within Numbas. Are there any plans or desires for that?

Specifically, testing for algebraic equivalence (a bit stronger than substitution equivalence) and checking forms of expressions easily (the regex stuff that you guys have looks neat, but this may be simpler for authors) would be nice things to have.

Christian Lawson-Perfect

unread,
Aug 25, 2018, 1:25:09 PM8/25/18
to numbas...@googlegroups.com
I definitely want to add more CAS features, but my time is limited! 

zalog...@gmail.com

unread,
Aug 25, 2018, 7:41:00 PM8/25/18
to Numbas Users
Anything another set of hands can help with or will there be too many cooks in the kitchen/too steep a learning curve to make it worthwhile?

Christian Lawson-Perfect

unread,
Aug 26, 2018, 3:44:17 AM8/26/18
to numbas...@googlegroups.com
I'd be very grateful of help!
Reply all
Reply to author
Forward
0 new messages