Subject: [Ufl] [Question #212068]: Reducing a fraction

From: Jan Blechta <[email-masked]>
Date: Tue, 23 Oct 2012 11:11:15 -0000

New question #212068 on UFL:
https://answers.launchpad.net/ufl/+question/212068

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

-- 
You received this question notification because you are a member of UFL
Team, which is an answer contact for UFL.

---

From: Martin Sandve Alnæs <[email-masked]>
Date: Tue, 23 Oct 2012 13:25:26 +0200

> 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.

No, there is no way to do that in ufl without writing additional
algorithms for it.

Such simplification may be feasible for this particular case but
generalized can be a very hard problem.

Martin

> _______________________________________________
> Mailing list: https://launchpad.net/~ufl
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ufl
> More help   : https://help.launchpad.net/ListHelp

---

From: Martin Sandve Alnæs<[email-masked]>
Date: Tue, 23 Oct 2012 12:31:04 -0000

Question #212068 on UFL changed:
https://answers.launchpad.net/ufl/+question/212068

Martin Sandve Alnæs posted a new comment:
Jan, I added an automatic simplification for the case f/f -> 1, see if
that helps. It does not, however, handle the case (g*f)/f, only g*(f/f),
so it may not help you.