Integer to float conversion - prevention

  • Is there some way to prevent Mobius from changing all numbers to floats? I know I can make them strings like $function=x^"2"-"1"; but then if I wish to do something with $function even as simple as $secondfunction=$function; the integers get clobbered anyway and I get $secondfunction being x^2.0-1.0. I find this an annoying issue since when you typeset using mathml() you get a power of 2.0. There are even some weird problems with comparing the integer version to a float version in some cases in the $answer-$response comparison. However my immediate task is that I am trying to pick from a list of different functions and while I can think of a couple of ways to get around this, the best solution would be if Mobius left integers as integers so I am hoping there is some way to do that. 

    Any help (or changes to Mobius) will be greatly appreciated.



  • Hi Andrew,

    There are a few possibilities, depending on what you are trying to do. As you mentioned writing this:


    using either single or double quotes, will do it in that particular variable.

    On the other hand you did mention $ANSWER - $RESPONSE which suggests you are using a Maple-graded response area. In that case, relying on the Maple computation engine for the algorithm code may also be a solution.


  • I would suggest something to the effect of the following:  here is a .zip of the question above that can be imported:  https://naitca-my.sharepoint.c...





    Essentially this will allow you to generate random functions, and automatically convert the function to latex that can be put directly into the question.  This avoids having to use the equation editor.

  • @chrisb thank you. I will see how that works. :)

  • @mschneider  thank you. . I did use Maple to generate MML but had not thought of doing Latex. That might be cleaner.  Much appreciated.

Log in to reply