# Algebraic Form

Often, we wish to establish if the student's expression has the correct *form*. For example, consider the following written forms of .

Each of these might be considered to be factored. **Establishing ex is factored is not the same as comparing it with**

`factor(ex)`

.### FacForm: factorisation of polynomials

This test checks (i) that SAns is algebraically equivalent to TAns , and (ii) that SAns is "factored" over the rational numbers. The answer test expects the option to be the variable, which is needed to generate feedback. If the answer is incorrect, quite detailed feedback is provided.

An expression is said to be factored if it is written as a product of powers of distinct irreducible factors. Strictly speaking, in establishing that an expression is in factored form, we might not even care whether the terms in the product are fully simplified, as long as they are irreducible. Irreducibility on the other hand means we can't find further factors, but here we need some care. Consider .

- Any non-trivial factorization, e.g. .
- A factorization into irreducible factors over the integers/rational numbers, i.e. .
- A factorization into terms irreducible over the reals, i.e. .
- A factorization into irreducible polynomials over the Gaussian integers, with allowed, i.e. .
- A factorization over the complex numbers, where the factor would also be split into the four terms .

In elementary teaching, meaning 4. is unlikely to occur. Indeed, we might take this example to represent factoring over any extension field of the rational numbers. We normally seek to establish that the factors are irreducible over the integers (which is equivalent to irreducibility over the rational numbers) or the reals. But, unlike a canonical form, we are not particularly interested in the order of the terms in this product, or the order of summands inside these terms.

The FacForm test establishes that the expression is factored over the rational numbers. If the coefficients of the polynomial are all real, at worst you will have quadratic irreducible terms. There are some delicate cases such as: vs and vs , which this test will cope with.

It is also possible a student will do something which is just plain odd, e.g. can be rewritten as which is a "product of powers of distinct irreducible factors" but not acceptable to most teachers. The student's answer must also be a polynomial in the variable (using `polynomialp`

as the test predicate).

### Factorisation of integers

If you would like to ask a student to factor a polynomial, then do not use the `FacForm`

answer test. The `FacForm`

answer test is designed to use with polynomials.

Instead, switch off simplification and define

```
ta:factor(12);
```

and use `EqualComAss`

as the answer test.

Note however that EqualComAss does not think that `2^2*3`

and `2*2*3`

are the same!

### PartFrac: partial fractions

This test checks (i) that SAns is algebraically equivalent to TAns , and (ii) that SAns is in "partial fraction form". The option must be the variable.

To help provide feedback to students on how to calculate the partial fraction form we have special function `poly_about_a(ex, v, a)`

which writes the polynomial `ex`

in variable `v`

about the point `v=a`

. E.g. when written about . This is basically the complete finite Taylor series for the polynomial about . The form "about " can readily be calculated by "shift-expand-shift" and without derivatives. It is, in my view, somewhat neglected. See doi:10.1017/S0025557200003569 for applications to a limit-free derivative for polynomials.

Here, e.g. if we have the question variables

```
n1:4;
p1:(9*y-8)/(y-n1)^2
p2:poly_about_a(num(p1), y, n1);
p3:map(lambda([ex], ex/denom(p1)), p2);
```

then feedback of the following form

```
You need to do more work on the term {@p1@}.
In particular, write the numerator {@num(p1)@} about the point {@y=n1@}.
This gives {@num(p1)=p2@}, which allows us to complete the partial fraction form as follows:
\[ {@p1@} = \frac{ {@p2@} }{ {@denom(p1)@} } = {@p3@} = {@ev(p3,simp)@}. \]
```

is rendered as:

You need to do more work on the term . In particular, write the numerator about the point . This gives , which allows us to complete the partial fraction form as follows:

### SingleFrac: Single fractions

This test checks (i) that SAns is algebraically equivalent to TAns , and (ii) that SAns is written as a single fraction. Notes

- This test works at the top level, making sure the expression as a whole is a single fraction.
- if you also want this expression written in lowest terms, then this is quite a separate test. You need to first confirm you have a single fraction then add a new potential response. One way is to use the ../CAS/Predicate functions
`lowesttermsp(ex)`

and compare the result with`true`

with the AlgEquiv test. - The algebraic equivalence check is for convenience. If you only want to check an expression is a single fraction make , i.e. ATSingleFrac(ex,ex) will do.

### LowestTerms

This test checks that all numbers written in the first expression are in lowest terms and that the denominator is clear of surds and complex numbers.

- if you want to check whether a rational polynomial is written in lowest terms, this is not the test to use. Instead, apply the predicate functions
`lowesttermsp`

to the expression. - the second argument to this function is ignored, i.e. this test does not confirm algebraic equivalence. You might as well use 0 here.

### Expanded ###

Confirms SAns is equal to `expand(SAns)`

. Note, the second argument to this answer test is not used (but must be non-empty). Note with this test that an expression such as is not considered to be expanded, and this test will return false.

### CompletedSquare

This test checks (i) that SAns is algebraically equivalent to TAns , and (ii) that SAns is in "completed square form". The option must be the variable.