maths / moodle-qtype_stack

Stack question type for Moodle
GNU General Public License v3.0
138 stars 147 forks source link

Timeout issue using Int PRT #1073

Closed mrseanman closed 7 months ago

mrseanman commented 7 months ago

Using the Int PRT test, there is a timeout issue when trying to detect incorrect answers for quite simple expressions. It has something to do with large-ish exponents within trig functions.

Here are some examples where this timeout occurs

And some where the timeout does not occur (wrong answer correctly detected).

Lower (than 11) values of exponents are also well behaved. For all of the above the test option is set to x.

Correct answers are detected OK, answers without a constant are detected OK. Only these incorrect answers with a constant cause this issue.

sangwinc commented 7 months ago

Interesting edge case! This is caused because, internally, the system was calling trigexpand of sin(2^12/%pi). This obviously causes a timeout! For a non-timeout example, try trigexpand(sin(2^3/%pi)); in Maxima to see why this leads to expression explosion. Thanks for reporting it.