Examples for plot functions¶

\begin{question}
\text{Determine the gradient of the function with the following graph\\
(respectively the slope of the straight line):}
\type{input.number}
\field{real}
\explanation{This explains everything in case of wrong answer...} %%only for correction
\begin{variables}
\function{f}{0.5x+2} % defines a function named f
\number{result}{0.5}
\end{variables}
\plotF{1}{f} % First entry labels the plots, second entry for the function to be plotted.
\plotFrom{1}{-3.0} % Domain of definition of function
\plotTo{1}{3.0}
\plotColor{1}{red}
\plotLeft{-4} %%defines the range of the coordinate system.
\plotRight{4} %%
\plotSize{250} %%function plot canvas has size 250x250, default is 300x300
\begin{answer}
\text{Gradient:}
\solution{result}
\end{answer}
\end{question}

\begin{question}
\text{Identify the functions by their graphs?}
\type{mc.yesno}
\field{rational}
\explanation{This explains everything in case of wrong answer...} %%only for correction
\begin{variables}
\function{f}{0.5x+2} % defines a function named f
\function{f_sin}{sin(x)}
\function{f_cos}{cos(x)}
\end{variables}
\plotF{1}{f_sin}
\plotFrom{1}{-4 }
\plotTo{1}{4}
\plotColor{1}{red}
\plotF{2}{f_cos}
\plotFrom{2}{-3}
\plotTo{2}{3}
\plotColor{2}{blue}
\plotLeft{-4.5} %%defines the canvas bound left
\plotRight{4.5} %%and right
\plotSize{250} %%function plot canvas has size 250x250 instead of default 300x300
\begin{choice}
\text{blue curve is graph of sin(x)}
\solution{false}
\end{choice}
\begin{choice}
\text{blue curve is graph of cos(x)}
\solution{true}
\end{choice}
\begin{choice}
\text{red curve is graph of sin(x)}
\solution{true}
\end{choice}
\begin{choice}
\text{red curve is graph of cos(x)}
\solution{false}
\end{choice}
\end{question}

\begin{question}
\begin{variables}
\function{g}{x/|x|}
\function{h}{0}
\end{variables}
\text{Consider the function g defined by g(x) = $g$ for x \ne 0, and g(0)= 0. Is g continuous?}
\type{yesno}
\field{rational}
\explanation{This explains everything in case of wrong answer...} %%only for correction
\plotF{1}{g}
\plotFrom{1}{-10 }
\plotTo{1}{10}
\plotColor{1}{black}
\plotF{2}{h}
\plotFrom{2}{-0.01 }
\plotTo{2}{0.01}
\plotColor{2}{black}
\plotLeft{-10} %%defines the canvas bound left
\plotRight{10} %%and right
\plotSize{200} %%function plot canvas has size 200x200 instead of default 300x300
\begin{choice}
\text{Yes or no?}
\solution{false}
\end{choice}
\end{question}