moodlesg.math.functions package¶
Submodules¶
moodlesg.math.functions.common module¶
This module implement moodle math functions that are common between grade and answer calculation.
-
moodlesg.math.functions.common.acos(expr)[source]¶ Arc cosine – output in radians.
It is the same that
arccosmoodle math function.
-
moodlesg.math.functions.common.acosh(expr)[source]¶ Inverse hyperbolic cosine – output in radians.
It is the same that
arccoshmoodle math function.
-
moodlesg.math.functions.common.asin(expr)[source]¶ Arc sine – output in radians.
It is the same that
arcsinmoodle math function.
-
moodlesg.math.functions.common.asinh(expr)[source]¶ Inverse hyperbolic sine.– output in radians.
It is the same that
arcsinhmoodle math function.
-
moodlesg.math.functions.common.atan(expr)[source]¶ Arc tangent – output in radians.
It is the same that
arctanmoodle math function.
-
moodlesg.math.functions.common.atanh(expr)[source]¶ Inverse hyperbolic tangent– output in radians.
It is the same that
arctanhmoodle math function.
-
moodlesg.math.functions.common.average(expr1, *expr2)[source]¶ Returns the average of the values in a list of arguments.
-
moodlesg.math.functions.common.ceil(expr)[source]¶ Maps a real number to the smallest following integer.
-
moodlesg.math.functions.common.cos(expr)[source]¶ Cosine – in radians!!! Convert your degree measurement to radians before you take the cos of it.
-
moodlesg.math.functions.common.cosh(expr)[source]¶ Hyperbolic cosine – in radians!!! Convert your degree measurement to radians before you take the cosh of it.
-
moodlesg.math.functions.common.floor(expr)[source]¶ Maps a real number to the largest previous integer.
-
moodlesg.math.functions.common.max(expr1, *expr2)[source]¶ Returns the maximum value in a list of arguments.
-
moodlesg.math.functions.common.min(expr1, *expr2)[source]¶ Returns the minimum value in a list of arguments.
-
moodlesg.math.functions.common.sin(expr)[source]¶ Sine – in radians!!! Convert your degree measurement to radians before you take the sin of it.
-
moodlesg.math.functions.common.sinh(expr)[source]¶ Hyperbolic sine – in radians!!! Convert your degree measurement to radians before you take the sinh of it.
moodlesg.math.functions.compatibility module¶
This module create a common interface to call math functions of grade and answer calculation. Some functions in moodle version has different names and other cases has no equivalent (grade calculation support less functions).
Examples
In Moodle you can evaluate a natural logarithm in both, grade and answer
calculation, but the function has different name. If you need to evaluate
in grade calculation ln is the function but in answer calculation
is log. With MoodleSG both cases are covered with log()
(common convention in programming languages).
>>> mm.mmParams.grade()
>>> a = mm.moodle_var('a')
>>> mm.log(a)
Expression('ln([[a]])')
>>> mm.mmParams.answer()
>>> b = mm.moodle_var('b')
>>> mm.log(b)
Expression('log({b})')
-
moodlesg.math.functions.compatibility.log10(expr)[source]¶ Return base-10 logarithm of a expression.
moodlesg.math.functions.extended module¶
Module contents¶
Module functions contains submodules of functions
that grouping supported functions for moodle (native and extended).