Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
I have to make program which can draw a function grap. I mean I have field where I can write function(I mean this standard one - nothing advanced) and somewhere a graph of this function appear. Is it possible by wxMathPlot?
Well, it depends on what do you mean exactly: if you mean that you can create an application that does this, the answer is yes. You have to implement the function parser, and then a plot layer which draws it. On the other hand, if you mean to ask if wxMathPlot already does this, the answer is no: it's just a library for plotting data, but the task of generating data is left to the programmer. Other tools like KmPlot ( http://edu.kde.org/kmplot/ ), or math tools like octave and scilab, already accomplish to this task very well.
Ok, I will try that kmplot as well.
I am thinking about using wxMathPlot. You said that I need to generate data to it. Can I made it by function parser? For example : http://warp.povusers.org/FunctionParser/. If so, how?
Well, I never used that library, but looking quickly at the documentation, I believe that the easiest way to use it is to implement a class inheriting from mpFX, then calling the Eval() function of the parser inside the GetY() method.
I 've done some similar functions to gpPanel ( library. It use wxMathPlot for plotting.. Parser I made myself. It is a lot of simpler than those discussed in this implementation, but it does list the most common mathematical operators (-+/*sin/cos/… also closing phrases "4*(4-4)") . Parser has a few bug, which I have not had time to repair, but mostly it works. Print library environment is a bit more complicated, but if you examine a little, you can find tips for your implementation.
Could I use your parser? I have really little time… Could you show/send me one?
you can use, but I take no responsibility for errors in calculation:).
If you find errors in calculating the results, so tell them where the patterns revealed.
used for something like this:
#include "gpFormula.h" //all needed is in here.
double x, y;
gpFormula xform( "2*Y" ); //formula to parse
xform.AddVariable("Y", y); //insert Y variable
x = xform; // '=' -operator calculate the formula…
So you say, for example how to convert simple function y=sin(2x)?