Examples for input function questions


\begin{variables}
      \function{f}{x^4-5x^3+4x^2+3x+7}        % defines a function named f   
      \derivative{f_1}{f}{x}      
      \derivative{f_2}{f_1}{x}            
      \derivative{f_3}{f_2}{x}
      \functionNormalize{f_1}     % Simplify the function f_1 
      \functionNormalize{f_2}     
      \functionNormalize{f_3}     
\end{variables}

\begin{question}
      \text{\textbf{Step 1}\\ 
            \textit{Let f(x) = $f$.} \\ 
            \textit{Compute f':}}
      \explanation{Calculate the derivative of f}
      \type{input.function}

      \begin{answer}
            \text{ f'(x) = }
            \solution{f_1}
            \checkAsFunction{x}{-10}{10}{100}       %The syntax is given by \checkAsFunction{ variable}{ min}{ max}{ steps}.
      \end{answer}
\end{question}

\begin{question}
      \text{\textbf{Step 2}\\ \textit{Compute f''(x):}}
      \explanation{Calculate the derivative of f'}
      \type{input.function}

      \begin{variables}
            \earlierAnswer{f_1}{1,1}
      \end{variables}      

      \begin{answer}
            \text{ f''(x) = }
            \solution{f_2}
            \checkAsFunction{x}{-10}{10}{100}               
      \end{answer}

\end{question}

\begin{question}
      \text{\textbf{Step 3}\\ \textit{Compute f'''(x):}}
      \explanation{Calculate the derivative of f''}
      \type{input.function}

      \begin{variables}
            \earlierAnswer{f_1}{1,1}
            \earlierAnswer{f_2}{2,1}
      \end{variables}

      \begin{answer}
            \text{ f'''(x) = }
            \solution{f_3}
            \checkAsFunction{x}{-10}{10}{100}               
      \end{answer}

\end{question}

\begin{question}
      \type{input.function}
      \field{real}

      \begin{variables}
            \function{c}{sqrt(2x^2+1)}
            \function{f}{sqrt(y)}
            \function{g}{2x^2+1}
      \end{variables}

      \text{\textbf{Question 2}\\
            \textit{Enter two functions f and g, such that their composition is $c$.}}               
      \explanation{Shows up in the correction in case the students answer is wrong.}

      \begin{answer}
            \text{ f(y) = } % this function by itself is neither correct nor incorrect. 
            \solution{f}
            \inputAsFunction{y}{h}
      \end{answer}

      \begin{answer}
            \text{ g(x) = } % truth can only be checked be checking the compostition of the two functions.
            \solution{g}
            \inputAsFunction{x}{k}
            \checkFuncForZero{h[k]-c}{-10}{10}{100} 
            \score{2.0}
      \end{answer}

      \begin{answer}
            \text{ f[g[x]] = }
            \solution{c}
            \checkAsFunction{x}{-10}{10}{100}
            \score{0.5}
      \end{answer}
\end{question}

\begin{question}
      \type{input.function}
      \field{real}                      
      \text{\textbf{Question 3}\\\textit{Find an anti-derivative F of $g$}}                     
      \explanation{}

      \begin{variables}
            \function{f}{-cos(7x)}
            \function{g}{7sin(7x)}
      \end{variables} 

      \begin{answer}
            \text{ F(x) = }
            \solution{f}
            \inputAsFunction{x}{k}
            \checkFuncForZero{D[k]-g}{-10}{10}{100}
      \end{answer}            
\end{question}

\begin{question}

      \begin{variables}
            \randint{a}{2}{5}
            \function{f}{sinh(a#4x)} % a#4 stands for a to the power 1/4. 
      \end{variables}

      \type{input.function}
      \field{real}        
      \text{\textbf{Question 4}\\
            \textit{Find a non-zero solution of the differential equation y^{(4)} = $a$y}}

      \begin{answer}
            \text{ y(x) = }
            \solution{f}
            \inputAsFunction{x}{k}
            \checkFuncForZero{|D[D[D[D[k]]]]-a*k| + |1-abs(sign(k))|}{-10}{10}{100}, % Composition of 2 functionals: 
                                                                                                 % checks y^{(4)} = $a$y and $y$ non-zero.                      
      \end{answer}        
\end{question}

\begin{question}
      \type{input.function}
      \field{integer}        

      \begin{variables} % In the following the pythagorean numbers are parametrized.
            \randint{u}{1}{10}
            \randint{v}{1}{10}

            \randadjust{u,v}{u=v} % see Part 9 http://team.mumie.net/projects/support/wiki/GenericTexProblems 

            \function{f}{u*u+v*v}       % note: in fact this is a number resp. a constant function. 
            \functionNormalize{f} % Simplifies the expression as much as possible. 
            \function{a}{|u*u-v*v|}
            \functionNormalize{a}
            \function{b}{2*u*v}
            \functionNormalize{b}
      \end{variables}

      \text{\textbf{Question 5}\\\textit{Find a pythagorean triangle with hypotenuse c = $f$.}\\ 
           Note: By definition a\ne 0 and b \ne 0. }

      \begin{answer}
            \text{ a = }
            \solution{a}
            \inputAsFunction{x}{k}                  
      \end{answer}

      \begin{answer}
            \text{ b = }
            \solution{b}
            \inputAsFunction{x}{m}
            \checkFuncForZero{|k*k+m*m-f*f|+|1-sign(k)|+|1-sign(m)|}{-10}{10}{100}                  
      \end{answer}
\end{question}

wikiplot_inFunc.png (4.12 KB) Sabine Greiser, 01/09/2014 11:39 AM

Wikiplot_infunc
Add picture from clipboard (Maximum size: 500 MB)