wxEcMath - Official documentation  0.6.4
Overview

wxEcMath is the name given to the library, which contains sub-classes. You really need to know wxEcEngine, wxEcPlot, wxEcComplex and wxEcMatrix.

To compile the library, you just need to include it in your workspace. There is no makefile, and no shared library.

Depending on your needs, you will have to include header files. New names begin with prefix "wxEc". If you don't need a class, don't include the associated header file.

#define wxECM_USEDEBUG
#include "ec_defs.h" //always required !
#include "ec_engine.h"
#include "ec_plot.h"
#include "ec_complex.h"
#include "ec_matrix.h"
See also
wxECM_USEDEBUG

To perform a simple computation, it is not harder than :

{
double result;
wxEcEngine calc;
if (calc.SetFormula(wxT("3+4")))
{
result = calc.Compute();
if (calc.GetLastError() == wxECE_NOERROR)
; //well done !
else
wxLogError(calc.TranslateError(calc.GetLastError()));
//better luck next time !
}
else
wxLogError(calc.TranslateError(calc.GetLastError()));
}

To create a plot, do like other common components :

{
wxEcPlot *m_plot;
...
m_plot = new wxEcPlot(this, wxID_ANY, wxDefaultPostion, wxDefaultSize);
m_yourSizer->Add(m_plot, 1, wxEXPAND|wxALL, 5);
}

To draw a curve, you have to create a new object :

{
wxEcPlot *m_plot; //assumed correctly initialized by you
int curveID;
wxEcCurve newcurve;
newcurve.Parse(wxT("sqr(x)/10 $ -7 4*pi"));
curveID = m_plot->AddCurve(newcurve);
m_plot->Refresh();
}
Remarks
Samples detail various types of wxEcCurve. Explore the code and find the use of wxEcPlot::AddCurve().

If you want to use complex numbers, it is not complicated :

{
wxEcComplex a(4,3), b(-1,0), c, d;
c = a + b;
d = a * c;
b.Re = d.Im;
//...
}

When using matrixes, you will have to initialize each cell before being able to operate. Automated fills can be managed by wxEcMatrix::Clear(), wxEcMatrix::Factor() and wxEcMatrix::AddConstant().

{
wxEcMatrix matA(2,2), matB(2,1), matC;
matA.SetValue(1,1, 1.0); //the first parameter is the n-th line
matA.SetValue(1,2, 2.0); //the second paramater is the n-th column
matA.SetValue(2,1, 3.0); //the third parameter is the value of the designated cell
matA.SetValue(2,2, 4.0);
matB.SetValue(1,1, 5.0);
matB.SetValue(2,1, -6.0);
matC = matA * matB;
wxMessageDialog(NULL, matC.DumpAsString()).ShowModal();
}
Warning
A matrix stores values in double format. At C++ compilation, make sure your values won't be considered as integer values. Thus, you must write "my_matrix.Clear(2.0/3.0)" not "my_matrix.Clear(2/3)". In case of doubt, wxEcMatrix::DumpAsString() can show you the content of the matrix.



Documentation generated with Doxygen 1.8.10
Hosted on :
Get wxEcMath at SourceForge.net