Solved

Calculating Complex Equations...

Posted on 2003-11-07
3
425 Views
Last Modified: 2010-04-16
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
0
Comment
Question by:imran89
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9703538
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
 
LVL 1

Accepted Solution

by:
jdauie earned 60 total points
ID: 9708835
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
 

Author Comment

by:imran89
ID: 9709732
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
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question