# Reducing a fraction

Hi,

is there a way one can manipulate (by some algorithm) UFL expression or form to reduce a term like

something * x[0] / x[0]

to mathematically equivalent

something * 1

which has polynomial degree smaller by two. Moreover it could prevent division by zero.

I'm not asking for a generel algorithm doing a division of rational functions but rather if user can apply some transformation rule locating products with factors x[0] and 1/x[0] and remove it.

I admit I could do this transformation by hand but consider situation when this expression is result of automatic calculations (e.g. automatic differentiation).

Thanks

Jan

## Question information

- Language:
- English Edit question

- Status:
- Answered

- For:
- UFL Edit question

- Assignee:
- No assignee Edit question

- Last query:

- Last reply:

## Can you help with this problem?

Provide an answer of your own, or ask Jan Blechta for more information if necessary.