## File: Mainpage.dox

package info (click to toggle)
analitza 4:17.08.3-2
• area: main
• in suites: buster
• size: 3,824 kB
• sloc: cpp: 26,899; perl: 63; sh: 16; makefile: 9
 file content (357 lines) | stat: -rw-r--r-- 12,509 bytes parent folder | download | duplicates (3)
 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 /* Main page of docs for analitza library. Copyright (C) 2013 by Percy Camilo Triveño Aucahuasi Distributed under the LGPL. */ /** \mainpage Analitza - KDE Mathematical Library

Overview | \ref getting_started "Getting Started" | \ref tutorials "Tutorials" | \ref examples_showcases "Examples and Showcases"

Analitza is a library that work with mathematical objects. Analitza add mathematical features to your program, such as symbolic computations and some numerical methods; for instance the library can parse mathematical expressions and let you evaluate and draw them. Development of Analitza take place in this repository. \section modules Modules The library consists of the following modules: \li \ref AnalitzaModule "Analitza" is the core module, it is the parser of mathematical expressions. \li \ref AnalitzaPlotModule "AnalitzaPlot" let you draw mathematical objects like functions, equations, etc. \li \ref AnalitzaGUIModule "AnalitzaGUI" several UI components based on QWidget and QML. \ref AnalitzaGUIModule "AnalitzaGUI" depends of \ref AnalitzaPlotModule "AnalitzaPlot" and \ref AnalitzaPlotModule "AnalitzaPlot" depends of \ref AnalitzaModule "Analitza". \section design Design Aspects \ref AnalitzaModule "Analitza" is based on a subset of Mathematical Markup Language (MathML) Version 2.0 so for instance the \ref AnalitzaModule "parser" maintains structures that are mapped with a MathML content tag and thus can generate a MathML presentation for the current expression. This means also that all modules of the library are based implicitly on MathML. Some important classes from each module are: \li \ref Analitza::Expression "Expression" abstracts a valid expression from user input (a QString) and then \ref Analitza::Analyzer "Analyzer" can evaluate the expression. \li \ref Analitza::PlotsModel "PlotsModel" manage the mathematical objects that can be drawn by \ref Analitza::Plotter2D "Plotter2D" or \ref Analitza::Plotter3D "Plotter3D" (both plotters are agnostic of technologies like QtWidgets or QtQuick). \li \ref Analitza::ExpressionEdit "ExpressionEdit" is a widget that allows inline editing of mathematical expressions. \ref Analitza::PlotsView2D "PlotsView2D" is a widget that uses \ref Analitza::Plotter2D "Plotter2D" to show plots (same with \ref Analitza::PlotsView3D "PlotsView3D": it uses \ref Analitza::Plotter3D "Plotter3D"). \section features Features \li Parser can work with lambdas, matrices, vectors, polynomials, custom variables, etc. \li Parser suport some symbolic computations like derivatives, solving equations, etc. \li MathML built-in, so (for instance) is easy to export formulas to Latex. \li Extensible framework for plotting mathematical objects such implicit surfaces, parametrical curves, etc. in many coordinate systems. \li GUI components for input and manage mathematical expressions. @authors Aleix Pol \ Percy Camilo Triveño Aucahuasi \ @maintainers Aleix Pol \ @licenses @lgpl */ /** \page getting_started Getting Started

\ref index "Overview" | Getting Started | \ref tutorials "Tutorials" | \ref examples_showcases "Examples and Showcases"

\section intall_analitza Install Analitza In Linux, if your distribution have already the package then installing is easy, for example in Debian type as root user: \code aptitude install libanalitza-dev \endcode In Windows the task is very simple thanks to KDE Installer you just need to follow the wizard and check to install the Analitza package. For more information about KDE on windows read this. Just remeber that Analitza version depends of KDE version, and your distribution (in case of Linux) or KDE Installer (in case of windows) can have and old version of KDE. \section build Build and Install Analitza In case the repositories doesn't have the library package or you want the last version of Analitza, then you can build and then install the library from sources. First, check this prerequisites: \li Make sure you have Git installed. \li Make sure you have CMake installed. \li Analitza needs a successful installation of KDELibs, however since doesn't use the most heavy/exotics components from KDELibs, then you can build Analitza using an older version of KDELibs, you just need to install the kdelibs-dev package from your repository (from distibution in case of Linux , and from KDE Installer in case of windows) If you still want to build KDELibs then read here the details. \li If you want to use 3D features of Analitza (like drawing implicit surfaces for instance), then you need to make sure that OpenGL development libraries are correctly installed in your system. \li If you want to build a command line calculator called calgebra, then you need the readline development libraries. Next, let's follow these steps in your terminal: \li \code git clone git://anongit.kde.org/analitza\endcode \li For Linux type: \code cd analitza && mkdir build && cd build\endcode For Windows create a folder called build inside analitza and then you need to go there (inside build folder). \li \code cmake .. -DCMAKE_INSTALL_PREFIX=kde4-config --prefix -DCMAKE_BUILD_TYPE=debugfull\endcode \li \code make install\endcode For more information about building KDE Software you can read here and here. \section setup_cmake Setup a CMake Project Once the Analitza is installed, then you have headers and sublibraries binaries for each \ref modules. The installation process ensures that cmake will find the library by using find_package macro, this because an AnalitzaConfig.cmake was installed. Here you have more information about CMake macros. Now, let see this basic template for a CMake project: \code project(mycalculator) find_package(KDE4 REQUIRED) find_package(Qt4 REQUIRED) find_package(OpenGL REQUIRED) find_package(Analitza REQUIRED) include_directories( ${KDE4_INCLUDES}${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}${ANALITZA_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ) set(mycalculator_SRCS main.cpp) kde4_add_executable(mycalculator${mycalculator_SRCS}) target_link_libraries(mycalculator ${KDE4_KDECORE_LIBS}${QT_QTGUI_LIBRARY} ${ANALITZA_LIBRARY}${ANALITZAPLOT_LIBRARY} ${ANALITZAGUI_LIBRARY}${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}${QT_QTOPENGL_LIBRARY} ) \endcode */ /** \page tutorials Tutorials

\ref index "Overview" | \ref getting_started "Getting Started" | Tutorials | \ref examples_showcases "Examples and Showcases"

\section simple_parser A simple parser demo If you want to evaluate a simple math expression like sin(pi/6)+3, first you need to create the \ref Analitza::Expression "Expression" that encapsules the string value and then you can use \ref Analitza::Analyzer "Analyzer" to get the result: \code #include #include #include using namespace std; using namespace Analitza; int main(int argc, char *argv[]) { QString input("sin(pi/6)+3"); Expression exp(input); // create a math expression Analyzer a; // setup the Analyzer instance with its own Variables module a.setExpression(exp); // Analyzer needs to know about expression double result = a.calculate().toReal().value(); // get the numeric result cout << result << endl; return 0; } \endcode You can also use \ref Analitza::Expression "Expression" to make some queries, for example, in regards to the data type of the expression, the next code prints 0 (false): \code bool eq = exp.isEquation(); // or a.expression().isEquation() cout << eq << endl; \endcode \section advanced_parser Some advanced parsing features Lets create a variable k = 2.1 and a function f(x) = sin(x) + k. We will calculate values for a lambda expression (our f(x) function) and get the derivative of f(x) (wich is a lambda expression too: d(f(x))=f'(x)): \code #include #include #include #include using namespace std; using namespace Analitza; int main(int argc, char *argv[]) { Variables *vars = new Variables(); // create a variables container vars->modify("k", 2.1); // add a new variable called k with initial value 2.1 Expression func("x->sin(x) + k"); // create our lambda f(x)=sin(x) + k Cn *x = new Cn(); // create a bound variable to manipulate x in f(x) x->setValue(3.14); // set a initial value for x Analyzer a(vars); // when calculating, Analyzer will access to variables in vars QStack runStack; // Analyzer use this stack to calculate f(x) runStack.push(x); // add our bound variable to the stack Expression result; // an expression instance to save computations and result // play with f(x) a.setExpression(func); a.setStack(runStack); // this is important to calculate lambda expressions result = a.calculateLambda(); cout << func.toString().toStdString() << endl; cout << result.isReal() << endl; // simple query cout << result.toReal().value() << endl; // get f(3.14) // get the derivative of f(x) and play with it Expression dfunc = a.derivative("x"); a.setExpression(dfunc); // update the expression a.setStack(runStack); // this is important, update the stack too result = a.calculateLambda(); cout << dfunc.toString().toStdString() << endl; // get the derivative string cout << result.toReal().value() << endl; // derivative of f(x) at x = 3.14 delete vars; // free the memory return 0; } \endcode */ /** \page examples_showcases Examples and Showcases

\ref index "Overview" | \ref getting_started "Getting Started" | \ref tutorials "Tutorials" | Examples and Showcases

You can find examples of \ref AnalitzaPlotModule "AnalitzaPlot" and also check the tests folders of each modules here, here, and here. Also, remember that Analitza is used by applications like: \li KAlgebra (see the sources). \li A backend of Cantor (see the sources). \li calgebra. */ /** \defgroup AnalitzaModule Analitza This is the main module of Analitza, it provides a parser for mathematical expressions. */ /** \defgroup AnalitzaPlotModule AnalitzaPlot This is module is a plotting framework for mathemathical objects. */ /** \defgroup AnalitzaGUIModule AnalitzaGUI This is module contains UI controls for Analitza. */ // DOXYGEN_SET_PROJECT_NAME = Analitza // DOXYGEN_SET_RECURSIVE = YES // DOXYGEN_SET_FILE_PATTERNS = *.h *.dox // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/abstractlexer.h // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/explexer.h // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/mathmlpresentationlexer.h // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/expressionparser.h // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/pushvalue.h // DOXYGEN_EXCLUDE_PATTERNS = *_p.h */private/* */tests/* */examples/* // vim:ts=4:sw=4:expandtab:filetype=doxygen