Thread: Convert Equations

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    3

    Convert Equations

    I am new to C++ , and am trying to learn to convert professional equations to a linear form that C++ can understand.
    Can any of you please tell me where to find a tutorial or guide on how to do this. I have Googled it and only found people trying to get someone else to do their homework. I need to learn how to do this.
    Thank you.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    What do you mean by "professional equations"? And how exactly does C++ understand linear equations?

    Are you just trying to solve some equations, or do differentiation or something? Are you trying to determine intersections between quadratic or cubic equations or something more complicated? Is your equation hard-coded or are you writing a general solver?

    You need to be more specific.

    I can tell you that this is likely to be a lot harder than you expect. Even just parsing a string like "x^3 - 5*x^2" is a bit complicated.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    I suspect that SolarFlea is using "professional equations" to refer to equations in a document produced with the MathType editor, or something similar. Imperative programming (as defined in computer science) is also sometimes described in a manner that causes novices to describe it as coding in a "linear form".

    If that is the case, s/he is seeking the impossible: essentially looking for a way to take equations from a document and generate imperative C++ code to represent or (maybe) solve them.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #4
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    I would look into Matlab if you have the $$ and are on Windows or Scilab if you don't and are on *NIX. Both will help you design advanced formulas for solving different things and then help convert them into C (at least) code...
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    3

    Equations clarified

    What I am asking is, what steps do you take to make an equation, as a math teacher would write it on the board into a form that C++ can utilize.


    example: jm+5=3k-7 into k = (j * m + 5 + 7)/ 3

  6. #6
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    Solar: read this first: Operators in C and C++ - Wikipedia, the free encyclopedia

    This will get you started doing it right if you wanted to do it by hand. At least it will help lead you to the right answers.
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  7. #7
    Registered User
    Join Date
    Feb 2010
    Posts
    3

    Thanks!

    Quote Originally Posted by jeffcobb View Post
    Solar: read this first: Operators in C and C++ - Wikipedia, the free encyclopedia

    This will get you started doing it right if you wanted to do it by hand. At least it will help lead you to the right answers.
    Thank you very much!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [33.8] Can I convert a pointer-to-function to a void*?
    By EVOEx in forum C++ Programming
    Replies: 40
    Last Post: 08-19-2009, 07:50 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Convert Char to Int Function
    By drdroid in forum C++ Programming
    Replies: 9
    Last Post: 02-19-2003, 12:53 PM
  4. equations for a program
    By anthonye in forum C Programming
    Replies: 4
    Last Post: 06-19-2002, 04:38 AM
  5. please help ... to convert date to string
    By mel in forum C Programming
    Replies: 1
    Last Post: 06-12-2002, 10:26 AM

Tags for this Thread