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

## "Dr. Diettrich" <drdiettrich@compuserve.de>

28 Apr 2005 14:56:45 -0400

*From comp.compilers*

| List of all articles for this month |

**From: ** | "Dr. Diettrich" <drdiettrich@compuserve.de> |

**Newsgroups: ** | comp.compilers |

**Date: ** | 28 Apr 2005 14:56:45 -0400 |

**Organization: ** | Compilers Central |

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

**Keywords: ** | theory |

**Posted-Date: ** | 28 Apr 2005 14:56:45 EDT |

Ron Foster wrote:

*>*

*> Hi.*

*> I am working on a small project to evaluate and execute unit conversion*

*> expressions. I started wondering whether it was possible to determine what*

*> the reverse conversion rules might blook like.*

*>*

*> For example, one might want to define the classic Celsius to Fahrenheit*

*> convesrion expression along the lines of:*

*>*

*> F( c ) = ( 9 / 5 ) * c + 32.*

*>*

*> It seems as though there's enough information there to deduce the inverse*

*> Fahrenheit to Celsius conversion:*

*>*

*> C( f ) = ( f - 32 ) / ( 5 / 9 )*

Using my school math the result should read:

C( f ) = ( f - 32 ) / ( 9 / 5 )

You can build an expression tree and implement a transformation

procedure for the reverse expression. Using an appropriate language

with built-in list manipulation will simplify things a lot. I remember

one of my first LISP exercises, a conversion from/to RPN...

Things will become a bit more complicated with exponentiation, sine,

or other non-linear functions, which may require more complex

transformations.

IMO you better ask your questions in a math group. Even if your problem

is related to "symbol manipulation" or "transformation", it's not a

matter of compilers nor grammars.

DoDi

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.