maths / moodle-qtype_stack

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

Solve inequalities #1018

Open sdirnboeck opened 1 year ago

sdirnboeck commented 1 year ago

Hi!

I'm trying to find a way to solve inequalities in STACK, since the function "solve" does not solve inequalities. I now found the function "solve_rat_ineq" but I am unsure of how to include it into STACK. Through "stack_include" it does not work as is (I'm using this version I found on github: https://github.com/calyau/maxima/blob/master/share/solve_rat_ineq/solve_rat_ineq.mac

Is there a good way to include that function? Or is there a better way to do solve inequalities?

Thank you! Selina

smborio commented 1 year ago

Hi Selina,

I would recommend you also post this question in the STACK community in Zulip Chat. There is a channel dedicated to question troubleshooting.

I potentially did something not very elegant, solving equation and then running a couple of if then else statements. Others in the community might have better solutions though, my suggestion fails in many cases and a deeper analysis is needed for example if there are discontinuities. Others in the community may be able to provide better solutions!

Thanks,

Santiago

sangwinc commented 1 year ago

Also, I think this is "a Maxima question" not so much a "STACK thing". Better support for this is definitely needed, as is documentation and examples. Some docs are here

https://docs.stack-assessment.org/en/CAS/Inequalities/ This is also related to intervals: https://docs.stack-assessment.org/en/CAS/Real_Intervals/ After all, what does is mean to "solve an inequality"?

I wasn't aware of solve_rat_ineq in Maxima. I don't know every contributed package intimately!

aharjula commented 1 year ago

Chris, from the point of view of including stuff, this is a STACK thing. Including that particular URL presents multiple issues:

  1. The use of error inside the code, which would not work as it is forbidden, but maybe we could have some alternative for it, and maybe we already do.
  2. More importantly, though, the issue of $ versus ; which is a relic of STACKs past. At this point, we could just as well allow it as an alternative statement terminator to ease the loading of simpler libraries in the more typical library form.

For anyone including stuff, the basic rule is that if you can copy-paste it into the question-variables and STACK accepts it then STACK will also accept it as an inclusion, as long as the inclusion does not include more inclusions within itself...

You should really think about $, as when we get the next parser (you could allow it with the current one as well), it would be easy to simply allow it at the same time. Naturally, in our logic, it would be equivalent to ; but it would become an acceptable way of inputting things. Maybe at some future point, it would even have meaning. Basically, the time when we collected values through the output of the statement, and it mattered whether the statement was silenced or not, are in the past and have been since cassession2.

sangwinc commented 1 year ago

Thanks Matti, Yes, I hadn't thought about the problem of including code with $. Yes, I think we should include this as a legitimate terminating character to match core Maxima syntax.

sdirnboeck commented 5 months ago

Hi everyone! Are there any updates on this topic?