Solved

Calculating Complex Equations...

Posted on 2003-11-07
3
417 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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