Hi, I have the problem, I am creating a mathematical program and I need to write equations. For example:
I write string 5+(3^3)/5 and program write equation like
MSWord equations. Maybe you know the component for delphi6 which can help me?
You have to remember the rules of 'Order of Operation'. They are -
[blue]
1. Calculations must be done from left to right.
2. Calculations in brackets (parenthesis) are done
first. When you have more than one set of brackets,
do the inner brackets first.
3. Exponents (or radicals) must be done next.
4. Multiply and divide in the order the operations
occur.
5. Add and subtract in the order the operations occur.
[/blue]
In other words, the way your example is written will be calculated in the following way -
1) 3^3 = 27
2) 27/5 = 5.4
3) 5 + 5.4 = 10.4
If you wanted to add the 5 before dividing by 5, then the equation needed to look like this -
( 5 + ( 3^3 ) ) / 5
It just a matter of grouping what you want calculated first with ().
As far as I am aware you should be able to use Word's Equation Editor directly (using OLE). I didn't bother to install it with Office because I have no need for it, so I can't test this. Look through your system's list of ActiveX controls or look in the Office folder for something like MSEQED70.OLB (name is just a guess but it will probably have an OLB extension) around which Delphi should be able to create a wrapper. (It may already be available on the VCL Servers tab)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.