Visualization If and Else
In the \text
command you can use \IF{condition}{text}
and \IFELSE{condition}{text}{othertext}
to write text which will only be visible if a certain condition holds.
It's possible to ask for two conditions by combining them with the command AND: \IF{condition1 AND condition2}{text}
1 2 3 4 5 6 7 8 | \begin{genericVisualization}[100prc][600]{applet}
\begin{variables}
\number[editable]{a}{real}{1}
\number[editable]{b}{real}{2}
\number{adivb}{real}{var(a)/var(b)}
\end{variables}
...
\text{\IFELSE{b=0}{\infinity}{\var{adivb}}}
|
The condition can be a logical composition of elementary conditions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | \usepackage{mumie.genericvisualization}
\lang{de}{\title{Titel}}
\lang{de}{Freier Text}
\begin{visualizationwrapper}
\begin{genericVisualization}[100prc][900]{applet}
\begin{variables}
\randint{a}{-5}{5}
\end{variables}
\text{\IFELSE{var(a)>0 AND var(a)<0}{Ist wahr}{Es ist nicht wahr }}
\end{genericVisualization}
\end{visualizationwrapper}
|
The syntax used for condition is similar to the condition syntax of \randadjustIf
.
It is also possible to combine multiple \IFELSE
as in the following example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | \begin{genericVisualization}[100prc][600]{applet}
\begin{variables}
\number[editable]{a1}{real}{1}
\number[editable]{b1}{real}{2}
\number[editable]{c1}{real}{3}
\number[editable]{a2}{real}{4}
\number[editable]{b2}{real}{5}
\number[editable]{c2}{real}{6}
\end{variables}
...
\text[c]{\begin{align}\var{a1}x &+& \var{b1}y &=& \var{c1}\\\var{a2}x &+& \var{b2}y &=& \var{c2} \end{align}} % display linear equation system
\text[c]{
\IFELSE{(a1/a2) = (b1/b2)}
{
\IFELSE{(a1/a2) = (c1/c2)}
{The above equation system has infinite number of solutions.}
{The above equation system has no solution.}
}
{The above equation system has exactly one solution.}
}
|