Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Reverse Polish Notation Question

by nat47 (Sexton)
on May 01, 2015 at 20:35 UTC ( [id://1125394]=note: print w/replies, xml ) Need Help??


in reply to Re: Reverse Polish Notation Question
in thread RPN Question

I don't actually have any code that isn't working or needs fixing. I've gotten to the point where I have converted a single-variable linear equation string into a RPN string. I posted the string in the OP. Now, I have no idea where to go from here. I'm thinking it was a mistake to try to use RPN to solve for 1 variable.

Replies are listed 'Best First'.
Re^3: Reverse Polish Notation Question
by GotToBTru (Prior) on May 01, 2015 at 20:48 UTC

    When I simplify your equation, I get -8 = 0. I suppose the algorithm works the same on solvable versus insolvable equations, but the latter makes it harder to test your results!

    What you have does not resemble RPN as I understand it.

    2 (4x - 8) + 3x = 11x + 1 - 9 LHS: 4 x * 8 - 2 * 3 x * + RHS: 11 x * 1 + 9 -
    Dum Spiro Spero
      Agh, I spent several hours trying to get my RPN code to work. I swore I had it working correctly.

        Okay, not complete so I had to add some things like, say, output. But it does appear to work.

        Starting with: 3(7x-1)+10x-4+3x=90x+1 it outputs: 3 7 x * 1 - * 10 x * + 4 - 3 x * + 90 x * 1 + -

        So .. what will you do with this? What was the point of getting it into RPN in the first place?

        Dum Spiro Spero
      I posted the code that I wrote, I'm hoping nothing is too wrong with it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1125394]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-19 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found