News
Index
Working with MUMIE as author
- Initial steps:
- Articles:
- Problems:
- Programming with Python
- Visualizations with JSXGraph
- Media Documents:
Working with MUMIE as teacher
Using MUMIE via plugin in local LMS
FAQ
You're not logged in
Working with MUMIE as author
Working with MUMIE as teacher
Using MUMIE via plugin in local LMS
FAQ
At the beginning of the visualization you can define variables. A variable can later be used to:
12 \begin{variables}
\end{variables}
Supported are random integers, doubles, and rationals.
randint
12 \randint{name}{min}{max} %creates a random integer from [min, max] and store it as name
\randint[Z]{name}{min}{max} %same as above, but avoiding zero
randdouble
1 \randdouble{name}{min}{max} %creates a random real number between [min, max]
randrat
1 \randrat{name}{minNumerator}{maxNumerator}{minDenominator}{maxDenominator} %creates a random rational number with numerator from [minNumerator, maxNumerator] and denominator from [minDenominator,maxDenominator]
You can use \randadjustIf
also in the variables environment of a visualization.
The syntax is the same as \randadjustIf
in generic problems, and you can use almost all types of variables
in the condition argument. Exception is a coordinate of point on a parametric curve, or any variable depending on such.
1 \randadjustIf{variables}{condition}
Example:
1234 \randint[Z]{x1}{-5}{5}
\randint[Z]{x2}{-5}{5}
\point{p}{x1^2,x1+x2}
\randadjustIf{x1, x2}{p[x]+p[y] >= 10} % redraw both x1 and x2 if the sum of the coordinates of p is at least 10.
This group consists of numbers, functions and geometry variables. This type of variables can also be editable by the user and be dependant on other variables.
The common syntax of the variables is:
1 \type[editable]{name}{value}
Exceptions to this syntax are \slider
, \pointOnCurve
, \sequence
and \string
.
\text{}
, and dragged around when you put it on a \plot{}
.The flag editable not only affects whether the user can change the variable/element, but also its dependence behaviour on the variables which occur
in its definition.
Exceptions from this behaviour:
The geometric objects lines, circles, vectors, affines, polygons, angles, and arcs are intimately linked to points occuring as defining points in its definition.
That means two things:
Example:
123456 \begin{variables}
\number[edtiable]{n}{0.5} % creates a real number with value 0.5 which is editable in text,
\point{p}{n,n} % creates a non-editable point whose x-coordinate and y-coordinate both equal the number n,
\point[editable]{q}{n,-n} % creates an editable point with x-coordinate n and y-coordinate -n,
\segment[editable]{s}{p,q} % creates the segment starting at p and ending at q.
\end{variables}
In this example, the point _p_ is not editable. The user will neither be able to drag it in the canvas nor to change its value
in the text. However, if the user changes the value of _n_, the point will move to the new coordinates (n,n).
The point _q_ is editable, and hence the user can drag it in the canvas, and also change its value in text. Its initial
coordinates are given as (0.5,-0.5) as initially n=0.5. As _q_ is editable, however, it will not move when _n_ is changed.
Finally, the segment _s_ is intimately linked to the points _p_ and _q_. If one of the points move/are moved, _s_ changes accordingly
to stay the segment linking _p_ and _q_. Although _s_ is editable, it can not be dragged, since the point _p_ can not be dragged.
However, in text the displayed value of _s_ -- which is its length -- can be changed. In this case, the second point _q_
will be moved to fit the desired distance to _p_. If the second point wouldn't be editable, the displayed value would not be changeable.
1234567891011 \begin{variables}
\number{simple}{0.5} % creates a real number with the value of 0.5
\number[editable]{simple2}{1/2} % also creates 0.5, but this time the number is editable in text
\number{simpleint}{0.5} % also would create 0.5; but by the field command below turns it into an integer with value 1 (0.5 rounded to an integer.)
\randint{randomA}{-5}{5} %creates a random value
\randint{randomB}{-5}{5} %creates a random value
\number[editable]{a}{randomA} %creates an editable number variable a with initial value randomA
\number[editable]{b}{randomB} %creates an editable number variable b with initial value randomB
\end{variables}
\field{simpleint, a}{integer} % Defines simpleint and a to always be integers
\field{b}{rational} % Defines b to be displayed as a rational fraction and not as a decimal.
For giving the value of a number you can use
all of the math functions abs, acos, acosh, asin, asinh, atan, atanh, cbrt, ceil, clz32, cos, cosh, exp, floor, ln, log, log10, log1p, log2, sign, sin, sinh, sqrt, tan, tanh, trunc,
as well as all number values, coordinates of points/vectors, and values of functions defined earlier.
1234 \slider{s}{2}{0}{4}
\function{f}{s*sin(x)}
\function[editable]{g}{sqrt(x^2+1)}
\function{h}{f*g+(1+x)}
The value of a function is a function expression containing (at most) one indeterminate. You can use
all of the math functions abs, acos, acosh, asin, asinh, atan, atanh, cbrt, ceil, clz32, cos, cosh, exp, floor, ln, log, log10, log1p, log2, sign, sin, sinh, sqrt, tan, tanh, trunc,
as well as all number values and coordinates of points/vectors defined earlier.
You are even allowed to use the names of previously defined functions.
1234 \point[editable]{p0}{0,0} % creates an editable point at 0,0
\randint[Z]{a}{-3}{3}
\randint[Z]{b}{-3}{3}
\point[editable]{p1}{a, b} % creates an editable point with random default coordinates
With set you can display section(s) of the 2d coordinate system (basically a set of (x,y)-tuple) that fulfills the given relation.
123 \number[editable]{p}{1}
\number[editable]{q}{-1}
\set{s}{|p*x+q*y|<sqrt(2)}
The value in the definition is a relation expression involving the indeterminates x
and y
.
You can use variables as for number and function expressions, and you can combine relations with AND and OR, and negate them
with NOT.
For example, to create a set equivalent to the above example, you can also use:
1 \set{s2}{p*x+q*y<sqrt(2) AND p*x+q*y>-sqrt(2)}
You can use the square brackets or parenthesis to group a part of the relation
1 \set{s3}{y > 0 AND [x < -3 OR x > 3]}
The argument list for slides is different to those for other variables.
1 \slider[stepsize]{name}{initialvalue}{leftbound}{rightbound}
Here, name
and field
are as usual. The other arguments are provided by expressions
determining numbers. The argument stepsize
(in square brackets) is optional with continuous default.
All arguments stepsize
, leftbound
, rightbound
will be fixed and not editable.
There is no optional argument for editability, as the nature of a slider is the given one.
If named in the \plot
-command of a canvas, the slider will be added to the canvas in the lower left corner
(or above other sliders if several are shown). If used in text, the current slider value will be shown
as an editable number.
12 \slider{s}{2}{0}{4}
\function{f}{s*sin(x)}
In this example, the slider can be used to manipulate the function f.
With the command \string
, you can define a text variable. Syntax is
1 \string[editable]{name}{value}{position}
This allows to place simple text (given in value
) at the specified position
in the canvas.
The additional argument position
has to be given as two number expressions separated by comma.
The command \sequence
allows to visualize sequences. The syntax is
1 \sequence[editable]{name}{format}{value}
The format
has to be either 'explicit' or 'recursive'.
The value consists of a comma separated list of
n
-th value of the sequence (same rules apply as for functions).s
you refer to the previous values using s[n-1]
, s[n-2]
etc.Example:
1234 \sequence{Fib}{recursive}{1,Fib[n-1]+Fib[n-2],1,1}
\number{goldenRatio}{(1+sqrt(5))/2}
\number{conj}{1-goldenRatio}
\sequence{Fib2}{explicit}{1,1/sqrt(5)*(goldenRatio^n-conj^n)}
The first sequence is the Fibonacci sequence in its usual recursive form.
The second is also the Fibonacci sequence in its well-known explicit form
using the golden ratio and its conjugate.
The points of a sequence can be colored in different colors depending on certain conditions.
See Coloring the points of sequences.
With the command \horizontalStrip
and \verticalStrip
, you can visualize ranges
around values on the x-axis or y-axis. The syntax is the usual one
1 \horizontalStrip[editable]{name}{value}
and
1 \verticalStrip[editable]{name}{value}
For example
1 \horizontalStrip{s}{1, 0.2, >0}
will be displayed in the canvas as the set of all points whose y-coordinate differs
from 1 by at most 0.2, and whose x-coordinate is bigger than 0.
In detail, the value consists of a comma separated list of two or three arguments.
For \horizontalStrip
, these are
For verticalStrip
, the roles of the x-coordinate and y-coordinate are just swapped.
With the command \onClickArrows
, you can let the user create arrows by clicking at two points, one after another.
The user can remove the arrows by clicking on them again.
You can provide a set of points eligible as source points as well as a set of points eligible as target points for the arrows,
and also give a maximum number of arrows that the user can create.
Furthermore, you can provide two set of arrows that are already shown on initialization. One set which are fixed, and cannot be removed by the user, the other which can be removed.
The syntax is the usual one
1 \onClickArrows{name}{value}
where the value consists of a comma separated list of
If a list in 1. or 2. is empty (or not given at all), all points visible on the canvas are eligible.
If the maximum number of arrows is not given, the number of arrows is not limited.
The fixed arrows are not counted in the maximum number of arrows, but the non-fixed ones are.
Example:
12345 \point{p1}{1,1}
\point{p2}{1,2}
\point{q1}{2,1}
\point{q2}{2,2}
\onClickArrows{a}{[p1,p2],,4,[ [q1,p1],[q2,p2] ],}
Here the value consists of
Hence two arrows, one from q1 to p1 and one from q2 to p2 are shown from the start, and cannot be removed.
The user can create up to 4 arrows. The source points for these arrows are limited to p1 and p2, but the
target points are arbitrary.
For evaluating which arrows are created by the user, there are several functions/attributes available.
These functions can be used in the definition of other variables, or conditions for IFELSE and have their meaning from
regarding the arrows as describing an assignment from the set of points of possible sources to the set of
points of possible targets. The fixed arrows are taken into account for these functions.
Example for using them:
12345678910 \begin{variables}
\point{p1}{1,1}
\point{p2}{1,2}
\point{q1}{2,1}
\point{q2}{2,2}
\onClickArrows{a}{[p1,p2],,4,[ [q1,p1], [q2,p2] ],}
\number{h}{a[hasTarget(q1)*a[hasTarget(q2)]]}
\end{variables}
\text{\IFELSE{a[isMap]=1}{The arrows represent a map.}{The arrows don't represent a map.}}
\text{\IFELSE{h=1}{Both points, q1 and q2 are targets.}{At least one of the points q1 and q2 are not targets.}}
The command \checkbox
allows to add a checkbox. The syntax is
1 \checkbox{name}{value}
Subsequently, the value can be used like a number variable and the checkbox can be styled like other variables, too.
12345678910111213141516171819202122232425262728293031 \begin{visualization}[550][650]{viz}
\title{Kern und Bild}
\begin{variables}
...
\checkbox{kernToggle}{1}
\checkbox{bildToggle}{0}
...
\number{hideKern0D}{dirac(detA*kernToggle)
\number{hideBild2D}{dirac(detA*bildToggle)}
...
\end{variables}
...
\label{kernToggle}{Kern(A) zeigen}
\label{bildToggle}{Bild(A) zeigen}
...
\color{kernToggle}{orange}
\color{bildToggle}{green}
...
\begin{canvasRow}
\begin{canvas}
...
\plot[coordinateSystem]{...,kernToggle}
\end{canvas}
\begin{canvas}
...
\plot[coordinateSystem]{...,bildToggle}
\end{canvas}
\end{canvasRow}
...
\end{visualization}
Using the command \onClickSelect
, one can let the user select objects that are visible on the canvas.
The information which objects are selected can then be used in definitions of other variables.
The syntax is
1 \onClickSelect{name}{value}
The value consists of a comma separated list of variable names, naming the objects that are allowed to be selected.
Optionally, one can append to this list a second list (this one enclosed in square brackets) of those objects which should be preselected.
E.g. if p
and q
are such objects, value could be p,q,[p]
meaning that p
and q
can be selected and p
is already preselected.
By setting a style for the onClickSelect-variable, you can define how the appearance of the objects change, when they are selected, e.g. if
the objects to be selected are points, and they should appear green, you can use\style{sel}{fillcolor: 'green', strokecolor: 'green'}
or just \style{sel}{color: 'green'}
.
Here sel
is the name of the onClickSelect-variable.
For accessing the information whether an object p
is selected, you can use sel[p]
in the definition of other variables. See the example below.
12345678910111213141516171819202122232425262728 \begin{visualization}{viz}
\title{Select the right point}
\begin{variables}
\point{p1}{1,1}
\point{p2}{1,-1}
\onClickSelect{sel}{p1,p2}
\number{p1Selected}{sel[p1]} % is 1 if p1 is selected and 0 otherwise
\number{p2Selected}{sel[p2]} % is 1 if p2 is selected and 0 otherwise
\number{n}{sel} % stores the number of currently selected objects
\end{variables}
\style{sel}{fillcolor: 'green'}
\begin{canvas}
\plotSize{300}
\plotLeft{-3}
\plotRight{3}
\plot[coordinateSystem]{p1,p2,sel}
\end{canvas}
\text{Click on the point that lies in the first quadrant.}
\text{\IFELSE{n=0}{You didn't select any point yet.}{
\IFELSE{n=2}{You selected both points.}{
\IFELSE{p1Selected}{Yes. This point is in the first quadrant.}{
No. This point is not in the first quadrant.
}
}
}
}
\end{visualization}
Using the commands \graphNode
and \graphEdge
, one can design directed graphs.
The syntax is
12 \graphNode{name}{value}
\graphEdge{name}{value}
where the value of a graph node consists of two number expressions determining the position of the node (of course the two expressions are separated by comma). The value of a graph edge consists of a list of 2 up to 4 arguments:
As for (most) other variable types, for both graphNodes and graphEdges one can provide an optional argument editable
by which a graph node can be dragged and the weight of the edge can be changed in text, respectively.
Example (source code to the directed graph above):
123456789101112131415161718192021222324252627282930 \begin{visualization}{vis}
\begin{variables}
\graphNode[editable]{P1}{0,0}
\graphNode[editable]{P2}{3,1.2}
\graphNode{P3}{3,3}
\graphNode{P4}{0,3}
\graphEdge{e1}{P1,P2,,8}
\graphEdge{e1r}{P2,P1,0.5,8}
\graphEdge[editable]{e2}{P2,P3,0.3}
\graphEdge{e3}{P3,P4}
\graphEdge{e4}{P4,P1}
\end{variables}
\label{P1}{A}
\label{P2}{B}
\label{P3}{C}
\label{P4}{D}
\label{e1r}{$p$}
\label{e2}{$q$}
\begin{canvas}
\plotSize{320}
\plotLeft{-1}
\plotRight{4}
\plotBottom{-1}
\plot[noToolbar]{P1,P2,P3,P4,e1,e2,e3,e4,e1r}
\end{canvas}
\text{The edge $p$ has the weight $\var{e1r}$.\\ The edge $q$ has the weight $\var{e2}$.}
\end{visualization}
Internally, graph nodes are points with default styling, and graph edges are arrows. So if you want to change their appearance you can use the same styling commands as for those.
Updated by Andreas, 1 year ago – 6134722