Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7656421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:45:33+00:00 2026-05-31T12:45:33+00:00

After doing some research, I learned about the postfix notation, and how to parse

  • 0

After doing some research, I learned about the postfix notation, and how to parse an expression.

My code converts to postfix notation, and then it evaluates it using the stack based method. For example:

Initial expression: 5 + 2^(4 - 1)
Postfix notation: 5 2 4 1 - ^ + 
Result: 13

Now I am trying to expand this program to be able to evaluate expressions with functions, like sin, cos, log, for example: 5 + sin (2 + log (2)).
My initial idea was, before parsing it, to find these functions, evaluate their results, and replace it in the string. But I don’t think it’s a very good idea…

So how can I do this in an efficient way?

Here is some code written in c#, if it is of any use: http://pastebin.com/7wB81fyQ, but I would prefer some pseudo-code so that I understand what I am writing better… I’m not one of those guys who just copy and paste.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:45:34+00:00Added an answer on May 31, 2026 at 12:45 pm

    Treat these functions like any other operator plus braces. First calculate what’s in the braces, then execute the function.

    Initial: 3 * Sin(4 + 5)
    Postfix: 4 5 + Sin 3 *       (that's how I would enter it in a HP calculator)
    or:      3 4 5 + Sin *
    

    Other than +, which consumes two numbers, Sin consumes only one number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After doing some research, everyone seems to advise learning and using some form of
I've got a Java/Flex project that I'm building using Maven. After doing some research
After doing some research and reading information about OpenCV object detection, I am still
After doing some research here, and using Google I'm still confused as to why
After doing some research about namespacing in PHP I'm trying to figure out what
After doing some research on the subject, I've been experimenting a lot with patterns
After doing some work with Ruby, Rails, and RSpec last summer and I learned
After doing some research, it would seem that errno 150 occurs when either table
I think it is not complicated but after doing some research I can't find
after doing some research it seems that AppDomains are not really a tool for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.