Brainteasers

Find a pythagorean triangle

\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}

            \randadjustIf{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}

Add picture from clipboard (Maximum size: 500 MB)