equation solving

This is a discussion on equation solving within the C Programming forums, part of the General Programming Boards category; Hey y'all, I'm designing a calculator application and know how to do pretty much everything that the calulator needs to ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    4

    Question equation solving

    Hey y'all,
    I'm designing a calculator application and know how to do pretty much everything that the calulator needs to do except for a couple things, but once I get one figured out I should be able to get the other. I need to know how to take an equation as input and parse the equation, evaluate, and give the answer. I also need to know how to take an equation as input and graph the equation on the screen. An answer to either or both of these questions would be much appreciated. Nothing real fancy, just something to get me pointed in the right direction would be fine. Thanks alot.

    -AJ

  2. #2
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Calculator? I asume u would use the functions in math.h.

    if the operators and numbers of the equation are seperated by spaces that you can use strtok to get each individual character and parse them.

    Anyway it's just a suggestion hope it helps.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    3

    Re: equation solving

    hi dear,
    you can use a stack to get the user to enter the entire string as a character type in infix notation with parenythesis & then solce the entire string using push & pop functions of the stack according to their precedence

    this is only a suggesition.
    sk_agarwals

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    You can put the equation in a tree and then calculate the result by traversing through the tree.

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,597
    You can use scripts.

    When the user presses + on the calc you would do an add. Token for it might be <add v1,v2> or whatever. If you used a small scripting language you could solve very complex equations on your calc.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    4
    So you mean actually create my own small language designed specifically for evaluating the equations?

    -AJ

  7. #7
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Just evaluating an expression isn't too hard but if you mean solve x in

    5 = 4 + x + (3 * x)
    looks a bit harder.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 11-04-2006, 04:06 AM
  2. IDEA: Equation solver
    By Magos in forum Contests Board
    Replies: 2
    Last Post: 01-07-2003, 11:46 AM
  3. Solving linear equations
    By PJYelton in forum C++ Programming
    Replies: 1
    Last Post: 12-05-2002, 06:00 PM
  4. Equation solving
    By Sang-drax in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 11-24-2002, 02:13 PM
  5. Quadratic Equation Program
    By Ambizzy in forum C Programming
    Replies: 4
    Last Post: 02-19-2002, 09:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21