imran89
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That seems a good idea, how would I hold the coefficients in a class, could you elaborate for me please as this is my first project in c#.
kind regards Imran
kind regards Imran
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