# Calculating Complex Equations...

Hi,

I am developing a mathematical application that involves the storage and process of equations of cubic and quartet order. I am storing the data in an MSDE database. The equation is stored in the database in the following format, (all equations are structured this way at the moment);

3.5604e-3*x(3) + 4.5394e-2*x(2) + 2.9238e+1*x(1) + 2223

The x(3) is interperated as x cubed, x(2) x squared.

The UI extracts this equation and has to break it into its atomic parts substituting x with a user input and calculating it accordingly.

Can anyone advise me on a more efficient storage format of the equations and a technique to break the equation into its constituent parts for ease of calculation.

kind regards Imran Farooq
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
1) you can use the SPLIT function to break up each member of the polynomial :

Split(strFormula,"+")

you can then split each part, into the two factors, using the *

Split(Part, "*")

then extract the power of x from the (...) (if the () is present)

actually rather close to a problem I solved a long time ago (1963 - in FORTRAN, after my Freshman year in college, worked as a Summer Intern at what is now UCSD, in La Jolla, Calif)...and no, I do not have the code.

AW
0
Commented:
You could easily make a class for it that would hold an array of coefficients.  You wouldn't even need to include the variable and the exponent if you have similar equations.
You can then save the object using serialization.
0

Experts Exchange Solution brought to you by