making text look nice
Introduction
Following applet shows how you can make texts with equations look nice.
- You don't want terms with coefficient 0 in it.
- You don't want double signs.
- You want a proper solution of an equation as an integer if so and if not you don't want a fraction with negative signs for both nominator and denominator.
How do you do this?
- Equation of a function: Create:
- a slider a from -4 to 4 with increment 1.
- a slider b from -4 to 4 with increment 1.
- a slider c from -4 to 4 with increment 1.
- a function
f(x) = a x² + b x + c
- a functiong(x) = Polynomial(a x² + b x + c)
- Show the equations of f and g in a dynamic text and experiment with the sliders. You'll notice that the command Polynomial(< Funcion>) avoids 0 and 1 as coefficients. - Solving equations: Create:
- a slider d from -5 to 5 with increment 2.
- a slider e from -5 to 5 with increment 2.
- a slider h from -4 to 4 with increment 1.
How to show the solving of the equation
dx + e = h
nicely? Left you see the Textfield in a 'normal' way, which doesn't always look nice. Right we use some tricks to avoid double signs and to show a nice solution.
- first row:
- Create a function
ff(x) = Polynomial ( d x + e).
- use ff in a dynamic text for the left side of the equation to prevent double signs. - second row:
- Create a function f
ff(x) = Polynomial (dx)
to avoid 1 as a coefficient. - Define a textsigne = If(e < 0, "+", "")
to use in the right side of the equation and add-e
. If e = -3: signe will show a + sign, -e hasn't got a sign on its own, so the right side will show: -4 + 3. Change slider e to 3: signe will be blank and -e will be -3, so the right side will show: - 4 - 3. - third row:
- Create a dynamic text with the command
FractionText((h - e) / d)
. This command will show the solution in its most simple form: If the nominator is a multiple of the denominator the solution will be shown as an integer, if not as a fraction. If both nominator and denominator are negative, both signs will be ommitted.