4

I wanted to convert the following expression to Functional, Polish and Reverse Polish notation.

$$Y =A + \frac{B+ \dfrac{BA}{B+CA}}{A - \dfrac{BC}{B-C+A}}$$

I know how to do Standard -> Functional -> Polish. But I'm kind of stuck on the RPN. Could someone explain to me how to do it, and what the quickest way is to do this by hand, for example if I had to do it on a much more complex expression? Maybe a shortcut or something like that to make it less tedious?

Also if anyone could check my work I would be really appreciative - for the Functional notation I got:

$+(A, /(+(B, /(*(B, A), (+(B, *(C, A)), -(A, /(*(B, C), -(B, +(C, A))$

and for the Polish obviously the same without the commas and parentheses.

egreg
  • 244,946
n4869
  • 143

3 Answers3

1

To convert from Polish notation to Reverse Polish notation, the variables and constants stay in the same order, but the operations go at the end instead of the front.

So, let's say you have something like C(C(x, C(y, z)), C(C(x, y), C(x, z))). Each C corresponds to a left parenthesis and a right parenthesis. We just move each C from preceding it's left parenthesis to succeeding it's right parenthesis. So, let's label all parentheses:

C (1 C (2 x, C (3 y, z )3 )2 , C (4 C (5 x, y )5 , C (6 x, z )6 )4 )1

Now we move each C to the respective right parenthesis.

(1 (2 x, (3 y, z )3 C )2 C , (4 (5 x, y )5 C , (6 x, z )6 C )4 C )1 C

This becomes

((x, (y, z)C)C, ((x, y)C, (x, z)C)C)C

0

Reverse Polish Notation:

B A ent B ent C A + / B+ ent B C ent B ent C - A + / ent -1 * A + / A +

where ent is "enter"

0

$$+(A, /(+(B, /(*(B, A), (+(B, *(C, A)), -(A, /(*(B, C), -(B, +(C, A))$$

I'm sure that should be $$\rm +(A, \div(+(B, \div(\times(B, A),(+(B, \times(C, A)), -(A, \div(\times(B, C), +(-(B, C), A)))))))) $$

Since $-(B, +(C, A))$ gives you $B-(C+A)$, while $+(-(B, C), A)$ gives you $(B-C)+A$

Also, close all bracket pairs.

Graham Kemp
  • 133,231