Blacklisted Maxima functions in STACK

Blacklisted Maxima functions in STACK

by Gustav W Delius -
Number of replies: 6

We just noticed that STACK blacklists a large number of Maxima functions, so that the teacher trying to use them in a STACK question will get the error message "Unsupported keyword". This includes harmless functions like "mean()" (it sounds like a mean function, but really just takes the average smile ). Is there a reason for blacklisting all these functions?  The blacklist $teachernotallow is defined in casstring.class.php

Average of ratings: -
In reply to Gustav W Delius

Re: Blacklisted Maxima functions in STACK

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Gustav,

I took the list of maxima functions, and by default I disallowed any of those which I haven't had time to check.  There is no deeper reason than this.

I'm concerned at anything which sets global variables, which may have side effects.  I'm much more concerned with anything to do with input/output behaviours (e.g. see the commands display2d) and all file read/write commands.  Supporting graphics is a lot of work.  These need to be tied down.  Many of the others will be fine, but I just haven't checked them all.  

The command "mean" requires a package load, which outputs compile information to the console.  This is awkward, and is interpreted by STACK as an error from mean. (Maxima's lack of proper API here...).  The solution is to load this package in advance, before STACK sends commands to Maxima.  We do this already for a few functions.  But I don't want to load them all, for obvious reasons!

So, I'm very open to adding new functionality.  I haven't included "descriptive" package because it includes a lot of graphing commands which we'd probably need to support.  And, because I've never been asked to include it!  How important is support for this package?

Chris

 

 

 

 

 

In reply to Christopher Sangwin

Re: Blacklisted Maxima functions in STACK

by Gustav W Delius -

Thank you Chris. With this reassurance that there is no deeper reason for disabling these functions, we will now go ahead and pre-load the "descriptive" package and take some functions off the blacklist in our local installation. This will be useful for us because we use STACK in a Statistics course, where the writing of questions will be somewhat simplified by having that way. After the end of term I will report back on how things went, and if this was a success we could add a page to the documentation to make it easy for others to enable additional functionality in the same way.

In reply to Christopher Sangwin

Re: Blacklisted Maxima functions in STACK

by gilad arrad -

Christopher ,

Is it possible for me to add the functions on my moodle?

That is, can I remove a specific function from the blacklist localy?

 

cheers,

gilad

In reply to gilad arrad

Re: Blacklisted Maxima functions in STACK

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The lists are in the stack_cas_casstring class in question/type/stack/cas/casstring.class.php. https://github.com/maths/moodle-qtype_stack/blob/master/stack/cas/casstring.class.php#L68. Find that file in your Moodle site, and edit it.

If you tell us (well, mainly Chris) what you have done, we might make the same change in the standard STACK version.

In reply to Tim Hunt

Re: Blacklisted Maxima functions in STACK

by Mikko Vasko -

Hello,

I have a question related to this. I'm trying to generate a question, where the students need to enter a function that is strictly monotonically increasing.

I use in Feedback variables the following code

fd:diff(ans1,x);
flag: 1;
if is(fd>=0)=unknown then flag:0;
if is(fd>=0)=false then flag:0;

and in answer test I check if flag=1.

In Maxima this works fine, but in STACK I get the error "Unsupported keyword: unknown.", because "is" delivers either true, false or unknown.

Is there a way to fix this? Or do you have a better idea how to do the question?

Thanks,

Mikko


In reply to Mikko Vasko

Re: Blacklisted Maxima functions in STACK

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Mikko,

Yes, the short fix is to remove "unknown" from the variable     

private static $teachernotallow 

in the casstring class:  https://github.com/maths/moodle-qtype_stack/blob/master/stack/cas/casstring.class.php

I'm conservative about what has been included, particularly with functions which have global scope within maxima. The "assume" database of functions does precisely this for example.  Unknown is both a maxima function, and a return value (confusingly!) But I see no reason to avoid using it, so I'll commit come changes which enable this to be available in future versions.

If you get this question working *reliably* please let me know!

Chris