Autograding Math Exercises using Octave and GitHub Classroom

pkg load symbolic;function sol = exercise1()
syms x; # declare symbolic variable x
dh = 2*x+1; # solution is: h'(x) = 2x+1
sol = function_handle (dh); # converts symbolic to function
endfunction
octave --eval "source('student.m'); exercise1()"
Symbolic pkg v2.8.0: Python communication link active, SymPy v1.5.1.
ans =
@(x) 2 * x + 1
octave --eval "source('student.m'); assert(char(sym(exercise1())), '2*x + 1')"
octave --eval "source('student.m'); assert(exercise1()(10), 21); assert(exercise1()(50), 101)"
Autograding of type Run Command
sudo apt update && sudo apt install octave octave-symbolic
octave --eval "source('student.m'); assert(exercise1()(10), 21); assert(exercise1()(50), 101)"
Creating test case for exercise 1
Creating test case for exercise 2
After adding tests, just click “create assignment”
Invitation link for the activity
Accepting invitation link
Wait a few seconds to generate the student activity and refresh the page
Activity is successfully generated for student
The yellow dot indicates that autograding process is being executed
The red cross indicates that some activities/test cases have failed
Clicking the red cross indicates that we already have 50/100 points (exercise1 is correct, but exercise2 is not)
Student may click on student.m file and hit the pencil to edit it online (no need to install GNU Octave on local computer)
When correct answer is given on student.m, a green mark appears

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store