Skip to content
mkraska edited this page Apr 9, 2022 · 1 revision

Hypotenuse too long or too short?

fb_HAG(H, A, G)

  • H hypothenuse
  • A, G kathetes

Returns a string with feedback text, to be displayed in a feedback branch, where the variables have been checked already using fb_vars. The values are displayed using float() and any stars * are replaced by small spaces. It is not recommended to have more than one symbolic variable in the expressions. This variable must have a declared sign (e.g. assume(a>0)).

fb_HAG(%_H, %_A, %_G):=block([fpprintprec:3,txt:""],
    if %_H <= max(%_G, %_A) then txt: sconcat(
            " Die Hypotenuse (\\(", float(%_H), 
            "\\)) muss gr&ouml;&szlig;er als die gr&ouml;&szlig;te der beiden Katheten (\\(",
             float(%_A), ", ", float(%_G),"\\)) sein."),
    if %_H >= %_G+%_A then txt: sconcat(
            " Die Hypotenuse (\\(", float(%_H), 
            "\\)) muss kleiner als die Summe der beiden Katheten (\\(",
             float(%_A), "+", float(%_G),"=",float(%_G+%_A),"\\)) sein."),
   ssubst("\\,", "*", txt)
);

PRT Node

If you don't need the result of the test elsewhere, then you just put the function call where you want the feedback.

{@fb_HAG(H, A, G)@}

Tryout Space

In order to try code snippets in jsfiddle,

  1. copy the code from the wiki page to the clipboard
  2. follow the link for the JSXGraph version you want to try
  3. Replace the code in the HTML section (contents of <p hidden id="init">) with the content of the clipboard
Clone this wiki locally