**News**

**Working with MUMIE as author**

- Initial steps:
- Articles:
- Problems:
- Programming with Python
- New Visualizations with JSXGraph
- Old Visualizations:
- Media Documents:

**Working with MUMIE as teacher**

**Using MUMIE via plugin in local LMS**

**FAQ**

Mumie Wiki

You're not logged in

**Working with MUMIE as author**

- Initial steps:
- Articles:
- Problems:
- Programming with Python
- New Visualizations with JSXGraph
- Old Visualizations:
- Media Documents:

**Working with MUMIE as teacher**

**Using MUMIE via plugin in local LMS**

**FAQ**

We revise and update this wiki. We apologize for the inconvenience this may cause you.

Random variables can be adjusted to satisfy a specific constraint.

For example we might adjust the variable x to be always greater than the variable y by using

the command `\randadjustIf{x,y}{x<=y}`

The command `\randadjustIf`

has the syntax `\randadjustIf{[varlist]}{[relation]}`

.

**varlist**comma separated list of variables to be adjusted**relation**a relation that defines an avoidance condition under which the variables

in varlist should be adjusted.

123456789101112 `\begin{question}`

` `

`\begin{variables}`

` `

`\randint[Z]{x}{-10}{10}`

` `

`\randint[Z]{y}{-10}{10}`

` `

`\drawFromSet{a}{1,2,3}`

` `

`\drawFromSet{b}{1,2,3}`

` `

`\randadjustIf{x,y}{x <= y} %adjust x and y if x is not greater than y`

` `

`\randadjustIf{b}{a = b} %adjust b if b equals a`

` `

`\end{variables}`

`\end{question}`

The avoidance_relation has to be a logical (boolean) combination (use $$NOT$$, $$AND$$, $$OR$$) of simple comparison

relations $$(=, !=, <, <=, >, >=)$$ between **expressions** in the variables.

These expressions may include **random and non-random** variables defined in the same variable

environment.

See Expressions And Relations

for a more detailed description.

*Hint*:

- Make sure that the avoidance relation can be avoided at all for the random variables with the ranges given.

The`\randint`

commands jointly define a product set which has to have a non-empty intersection with the

complement of the avoidance set. Otherwise you get a runtime error when the problem is run. - Even if the intersection is non-empty but has a equi-distribution probability being too small,

a runtime error might be the result, though the algorithm tries its best to find an admissible point.

\randadjustIf on a variable defined by \drawFromSet only works for (the default) type _number_

You may call randadjustIf multiple times to adjust *disjoint* lists of variables as in the following example:

1234567891011 `\begin{question}`

` `

`\begin{variables}`

` `

`\randint[Z]{x}{-10}{10}`

` `

`\randint[Z]{y}{-10}{10}`

` `

`\randint[Z]{c}{-10}{10}`

` `

`\randint[Z]{d}{-10}{10}`

` `

`\randadjustIf{x,y}{x <= y} %adjust x and y if x is not greater than y`

` `

`\randadjustIf{c,d}{c = d OR c = x}`

` `

`\end{variables}`

`\end{question}`

You should *NEVER* adjust a variable that has impact to the constraint of a previous `\randadjustIf`. The following example might lead to problems:

1234567891011121314 `\begin{question}`

` `

`\begin{variables}`

` `

`\randint[Z]{x}{-10}{10}`

` `

`\randint[Z]{y}{-10}{10}`

` `

`\randint[Z]{c}{-10}{10}`

` `

`\randint[Z]{d}{-10}{10}`

` `

`\function[calculate]{x2}{x+2}`

` `

`\randadjustIf{y}{x2 <= y} %adjust y if x+2 is not greater than y`

` `

`\randadjustIf{c,x}{c = d OR c = x} % here the variable x will be re-adjusted, the value of x2 changed`

` `

`% and the constraint from previous randadjustIf might be broken.`

` `

`\end{variables}`

`\end{question}`

Just as random variables defined inside the question environment, global variables

(which are defined in the problem environment) can be adjusted, too.

You may use `\randadjustIf`

in the same

manner as explained above, also multiple times for disjoint sets of global variables. You should *NOT* adjust

global variables within a question, but only in the problem environment where they are defined.

Updated by **Andreas Maurischat**, **6 months ago **– 0a4657a