# Re: Determining the inverse function operation from a function definition

## Laurence Finston <lfinsto1@gwdg.de>

28 Apr 2005 14:32:10 -0400

*From comp.compilers*

| List of all articles for this month |

**From: ** | Laurence Finston <lfinsto1@gwdg.de> |

**Newsgroups: ** | comp.compilers |

**Date: ** | 28 Apr 2005 14:32:10 -0400 |

**Organization: ** | GWDG, Goettingen |

**References: ** | 05-04-067 |

**Keywords: ** | theory |

On Wed, 26 Apr 2005, Ron Foster wrote:

*> It "feels" as though the inverse operation could be accomplished by*

*> backing-out the original operation steps in reverse order, but it appears*

*> that such an approach could also be fraught with peril.*

Perhaps you could express your equations by means of matrices and invert

the latter. It seems to me your example using Fahrenheit and Celsius

would be susceptible to such an approach. However, I'm not a

mathematician, so I might be wrong about this.

There are probably many examples of code for inverting matrices,

but you could use mine if you like (as long as you adhere to

the conditions of the GNU General Public License).

It's in the function `Transform::inverse()' in the file

`transfor.web' at

http://savannah.gnu.org/cgi-bin/viewcvs/3dldf/3dldf/Group/CWEB/

It uses the Gauss-Jordan algorithm with column pivot

search. I've taken the algorithm from Stoer, Josef.

_Numerische Mathematik 1_,

Achte, neu bearbeitete und erweiterte

Auflage. Springer-Verlag. Berlin 1999. ISBN 3-540-66154-9,

page 205, and adapted it to C++ for 4 x 4 matrices. It could

easily be adapted to matrices of other sizes.

The algorithm itself is, of course, in the public domain.

Laurence Finston

http://www.gnu.org/software/3dldf/LDF.html

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.