# Convert Equations

• 02-12-2010
SolarFlea
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.
• 02-12-2010
dwks
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.
• 02-13-2010
grumpy
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.
• 02-13-2010
jeffcobb
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...
• 02-13-2010
SolarFlea
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
• 02-13-2010
jeffcobb
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.
• 02-13-2010
SolarFlea
Thanks!
Quote:

Originally Posted by jeffcobb
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!