Warning, /education/analitza/Mainpage.dox is written in an unsupported language. File is not indexed.
0001 /* 0002 Main page of docs for analitza library. 0003 Copyright (C) 2013 by Percy Camilo Triveño Aucahuasi <percy.camilo.ta@gmail.com> 0004 Distributed under the LGPL. 0005 */ 0006 0007 /** \mainpage Analitza - KDE Mathematical Library 0008 0009 <p><b> 0010 Overview | 0011 \ref getting_started "Getting Started" | 0012 \ref tutorials "Tutorials" | 0013 \ref examples_showcases "Examples and Showcases" 0014 </b></p> 0015 0016 Analitza is a library that work with mathematical objects. Analitza add 0017 mathematical features to your program, such as symbolic 0018 computations and some numerical methods; for instance the library 0019 can parse mathematical expressions and let you evaluate and draw them. 0020 0021 Development of Analitza take place in 0022 <a href="https://commits.kde.org/analitza">this</a> 0023 repository. 0024 0025 \section modules Modules 0026 0027 The library consists of the following modules: 0028 0029 \li \ref AnalitzaModule "Analitza" is the core module, it is the parser of 0030 mathematical expressions. 0031 \li \ref AnalitzaPlotModule "AnalitzaPlot" let you draw mathematical objects 0032 like functions, equations, etc. 0033 \li \ref AnalitzaGUIModule "AnalitzaGUI" several UI components based on 0034 QWidget and QML. 0035 0036 \ref AnalitzaGUIModule "AnalitzaGUI" depends of 0037 \ref AnalitzaPlotModule "AnalitzaPlot" and \ref AnalitzaPlotModule "AnalitzaPlot" 0038 depends of \ref AnalitzaModule "Analitza". 0039 0040 \section design Design Aspects 0041 0042 \ref AnalitzaModule "Analitza" is based on a subset of 0043 <a href="http://www.w3.org/TR/MathML2/">Mathematical Markup Language (MathML) Version 2.0</a> 0044 so for instance the \ref AnalitzaModule "parser" maintains structures that are 0045 mapped with a MathML content tag and thus can generate a MathML presentation 0046 for the current expression. This means also that all modules of the library 0047 are based implicitly on MathML. 0048 0049 Some important classes from each module are: 0050 \li \ref Analitza::Expression "Expression" abstracts a valid expression from 0051 user input (a 0052 <a href="http://qt-project.org/doc/qt-4.8/qstring.html">QString</a>) and then 0053 \ref Analitza::Analyzer "Analyzer" can evaluate the expression. 0054 \li \ref Analitza::PlotsModel "PlotsModel" manage the mathematical objects that can be 0055 drawn by \ref Analitza::Plotter2D "Plotter2D" or 0056 \ref Analitza::Plotter3DES "Plotter3D" (both plotters are agnostic of technologies 0057 like QtWidgets or QtQuick). 0058 \li \ref Analitza::ExpressionEdit "ExpressionEdit" is a widget that allows inline 0059 editing of mathematical expressions. \ref Analitza::PlotsView2D "PlotsView2D" is 0060 a widget that uses \ref Analitza::Plotter2D "Plotter2D" to show plots (same with 0061 \ref Analitza::PlotsView3D "PlotsView3D": it uses 0062 \ref Analitza::Plotter3DES "Plotter3D"). 0063 0064 \section features Features 0065 0066 \li Parser can work with lambdas, matrices, vectors, polynomials, custom variables, etc. 0067 \li Parser suport some symbolic computations like derivatives, solving equations, etc. 0068 \li MathML built-in, so (for instance) is easy to export formulas to 0069 <a href="http://www.latex-project.org/">Latex</a>. 0070 \li Extensible framework for plotting mathematical objects such implicit surfaces, 0071 parametrical curves, etc. in many coordinate systems. 0072 \li GUI components for input and manage mathematical expressions. 0073 0074 0075 @authors 0076 Aleix Pol \<aleixpol@kde.org\> 0077 Percy Camilo Triveño Aucahuasi \<percy.camilo.ta@gmail.com\> 0078 0079 @maintainers 0080 Aleix Pol \<aleixpol@kde.org\> 0081 0082 @licenses 0083 @lgpl 0084 0085 */ 0086 0087 0088 /** \page getting_started Getting Started 0089 0090 <p><b> 0091 \ref index "Overview" | 0092 Getting Started | 0093 \ref tutorials "Tutorials" | 0094 \ref examples_showcases "Examples and Showcases" 0095 </b></p> 0096 0097 \section intall_analitza Install Analitza 0098 0099 In Linux, if your distribution have already the package then installing is 0100 easy, for example in Debian type as root user: 0101 0102 \code 0103 aptitude install libanalitza-dev 0104 \endcode 0105 0106 In Windows the task is very simple thanks to 0107 <a href="http://techbase.kde.org/Projects/KDE_on_Windows/Installation">KDE Installer</a> 0108 you just need to follow the wizard and check to install the Analitza package. For 0109 more information about KDE on windows read 0110 <a href="http://techbase.kde.org/Projects/KDE_on_Windows">this</a>. 0111 0112 Just remeber that Analitza version depends of KDE version, and your 0113 distribution (in case of Linux) or KDE Installer (in case of windows) 0114 can have and old version of KDE. 0115 0116 \section build Build and Install Analitza 0117 0118 In case the repositories doesn't have the library package or you want the 0119 last version of Analitza, then you can build and then install the library from 0120 sources. 0121 0122 First, check this prerequisites: 0123 0124 \li Make sure you have 0125 <a href="http://techbase.kde.org/Development/Git">Git</a> installed. 0126 \li Make sure you have 0127 <a href="http://techbase.kde.org/Development/Tutorials/CMake">CMake</a> installed. 0128 \li Analitza needs a successful installation of 0129 <a href="http://api.kde.org/4.x-api/kdelibs-apidocs/">KDELibs</a>, 0130 however since doesn't use the most heavy/exotics components from KDELibs, 0131 then you can build Analitza using an older version of KDELibs, you 0132 just need to install the kdelibs-dev package from your repository 0133 (from distibution in case of Linux , and from KDE Installer 0134 in case of windows) If you still want to build KDELibs then read 0135 <a href="http://techbase.kde.org/Getting_Started/Build">here</a> the details. 0136 \li If you want to use 3D features of Analitza (like drawing implicit surfaces 0137 for instance), then you need to make sure that 0138 <a href="http://www.opengl.org/">OpenGL</a> 0139 development libraries are correctly installed in your system. 0140 \li If you want to build a command line calculator called calgebra, then you need the 0141 <a href="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html">readline</a> 0142 development libraries. 0143 0144 Next, let's follow these steps in your terminal: 0145 0146 \li \code git clone git://anongit.kde.org/analitza\endcode 0147 \li For Linux type: \code cd analitza && mkdir build && cd build\endcode For 0148 Windows create a folder called build inside analitza and then you need to 0149 go there (inside build folder). 0150 \li \code cmake .. -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=debugfull\endcode 0151 \li \code make install\endcode 0152 0153 For more information about building KDE Software you can read 0154 <a href="http://techbase.kde.org/Getting_Started/Build/KDE_Applications">here</a> 0155 and 0156 <a href="http://techbase.kde.org/Getting_Started">here</a>. 0157 0158 \section setup_cmake Setup a CMake Project 0159 0160 Once the Analitza is installed, then you have headers and sublibraries binaries 0161 for each \ref modules. The installation process ensures that cmake will find 0162 the library by using find_package macro, this because an AnalitzaConfig.cmake 0163 was installed. <a href="http://techbase.kde.org/Development/Tutorials/CMake#Using_CMake_for_a_KDE_Project">Here</a> 0164 you have more information about CMake macros. 0165 0166 Now, let see this basic template for a CMake project: 0167 0168 \code 0169 project(mycalculator) 0170 0171 find_package(KDE4 REQUIRED) 0172 find_package(Qt4 REQUIRED) 0173 find_package(OpenGL REQUIRED) 0174 find_package(Analitza REQUIRED) 0175 0176 include_directories( 0177 ${KDE4_INCLUDES} 0178 ${CMAKE_SOURCE_DIR} 0179 ${CMAKE_CURRENT_BINARY_DIR} 0180 ${ANALITZA_INCLUDE_DIR} 0181 ${OPENGL_INCLUDE_DIR} 0182 ) 0183 0184 set(mycalculator_SRCS main.cpp) 0185 0186 kde4_add_executable(mycalculator ${mycalculator_SRCS}) 0187 0188 target_link_libraries(mycalculator 0189 ${KDE4_KDECORE_LIBS} 0190 ${QT_QTGUI_LIBRARY} 0191 ${ANALITZA_LIBRARY} 0192 ${ANALITZAPLOT_LIBRARY} 0193 ${ANALITZAGUI_LIBRARY} 0194 ${OPENGL_gl_LIBRARY} 0195 ${OPENGL_glu_LIBRARY} 0196 ${QT_QTOPENGL_LIBRARY} 0197 ) 0198 \endcode 0199 0200 */ 0201 0202 0203 /** \page tutorials Tutorials 0204 0205 <p><b> 0206 \ref index "Overview" | 0207 \ref getting_started "Getting Started" | 0208 Tutorials | 0209 \ref examples_showcases "Examples and Showcases" 0210 </b></p> 0211 0212 \section simple_parser A simple parser demo 0213 0214 If you want to evaluate a simple math expression like sin(pi/6)+3, first you need to 0215 create the \ref Analitza::Expression "Expression" that encapsules the string value 0216 and then you can use \ref Analitza::Analyzer "Analyzer" to get the result: 0217 0218 \code 0219 #include <iostream> 0220 #include <analitza/analyzer.h> 0221 #include <analitza/value.h> 0222 0223 using namespace std; 0224 using namespace Analitza; 0225 0226 int main(int argc, char *argv[]) { 0227 QString input("sin(pi/6)+3"); 0228 Expression exp(input); // create a math expression 0229 Analyzer a; // setup the Analyzer instance with its own Variables module 0230 0231 a.setExpression(exp); // Analyzer needs to know about expression 0232 double result = a.calculate().toReal().value(); // get the numeric result 0233 0234 cout << result << endl; 0235 0236 return 0; 0237 } 0238 \endcode 0239 0240 You can also use \ref Analitza::Expression "Expression" to make some queries, 0241 for example, in regards to the data type of the expression, the next code prints 0242 0 (false): 0243 0244 \code 0245 bool eq = exp.isEquation(); // or a.expression().isEquation() 0246 cout << eq << endl; 0247 \endcode 0248 0249 \section advanced_parser Some advanced parsing features 0250 Lets create a variable k = 2.1 and a function f(x) = sin(x) + k. We will 0251 calculate values for a lambda expression (our f(x) function) and get the 0252 derivative of f(x) (wich is a lambda expression too: d(f(x))=f'(x)): 0253 0254 \code 0255 #include <iostream> 0256 #include <analitza/analyzer.h> 0257 #include <analitza/variables.h> 0258 #include <analitza/value.h> 0259 0260 using namespace std; 0261 using namespace Analitza; 0262 0263 int main(int argc, char *argv[]) { 0264 Variables *vars = new Variables(); // create a variables container 0265 vars->modify("k", 2.1); // add a new variable called k with initial value 2.1 0266 0267 Expression func("x->sin(x) + k"); // create our lambda f(x)=sin(x) + k 0268 0269 Cn *x = new Cn(); // create a bound variable to manipulate x in f(x) 0270 x->setValue(3.14); // set a initial value for x 0271 0272 Analyzer a(vars); // when calculating, Analyzer will access to variables in vars 0273 QStack<Object*> runStack; // Analyzer use this stack to calculate f(x) 0274 runStack.push(x); // add our bound variable to the stack 0275 0276 Expression result; // an expression instance to save computations and result 0277 0278 // play with f(x) 0279 a.setExpression(func); 0280 a.setStack(runStack); // this is important to calculate lambda expressions 0281 result = a.calculateLambda(); 0282 0283 cout << func.toString().toStdString() << endl; 0284 cout << result.isReal() << endl; // simple query 0285 cout << result.toReal().value() << endl; // get f(3.14) 0286 0287 // get the derivative of f(x) and play with it 0288 Expression dfunc = a.derivative("x"); 0289 a.setExpression(dfunc); // update the expression 0290 a.setStack(runStack); // this is important, update the stack too 0291 result = a.calculateLambda(); 0292 0293 cout << dfunc.toString().toStdString() << endl; // get the derivative string 0294 cout << result.toReal().value() << endl; // derivative of f(x) at x = 3.14 0295 0296 delete vars; // free the memory 0297 0298 return 0; 0299 } 0300 \endcode 0301 0302 */ 0303 0304 0305 /** \page examples_showcases Examples and Showcases 0306 0307 <p><b> 0308 \ref index "Overview" | 0309 \ref getting_started "Getting Started" | 0310 \ref tutorials "Tutorials" | 0311 Examples and Showcases 0312 </b></p> 0313 0314 You can find 0315 <a href="http://lxr.kde.org/source/kde/kdeedu/analitza/analitzaplot/examples/">examples</a> 0316 of \ref AnalitzaPlotModule "AnalitzaPlot" and also check the tests folders of each 0317 modules 0318 <a href="http://lxr.kde.org/source/kde/kdeedu/analitza/analitza/tests/">here</a>, 0319 <a href="http://lxr.kde.org/source/kde/kdeedu/analitza/analitzaplot/tests/">here</a>, 0320 and 0321 <a href="http://lxr.kde.org/source/kde/kdeedu/analitza/analitzagui/tests/">here</a>. 0322 0323 Also, remember that Analitza is used by applications like: 0324 \li <a href="http://edu.kde.org/kalgebra/">KAlgebra</a> (see the 0325 <a href="http://lxr.kde.org/source/kde/kdeedu/kalgebra/">sources</a>). 0326 \li A backend of <a href="http://edu.kde.org/cantor/">Cantor</a> (see the 0327 <a href="http://lxr.kde.org/source/kde/kdeedu/cantor/src/backends/kalgebra/">sources</a>). 0328 \li <a href="http://lxr.kde.org/source/kde/kdeedu/analitza/calgebra/">calgebra</a>. 0329 0330 */ 0331 0332 0333 /** \defgroup AnalitzaModule Analitza 0334 This is the main module of Analitza, it provides a parser for mathematical expressions. 0335 */ 0336 0337 0338 /** \defgroup AnalitzaPlotModule AnalitzaPlot 0339 This is module is a plotting framework for mathemathical objects. 0340 */ 0341 0342 0343 /** \defgroup AnalitzaGUIModule AnalitzaGUI 0344 This is module contains UI controls for Analitza. 0345 */ 0346 0347 0348 // DOXYGEN_SET_PROJECT_NAME = Analitza 0349 // DOXYGEN_SET_RECURSIVE = YES 0350 // DOXYGEN_SET_FILE_PATTERNS = *.h *.dox 0351 // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/abstractlexer.h 0352 // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/explexer.h 0353 // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/mathmlpresentationlexer.h 0354 // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/expressionparser.h 0355 // DOXYGEN_SET_EXCLUDE += @topdir@/analitza/pushvalue.h 0356 // DOXYGEN_EXCLUDE_PATTERNS = *_p.h */private/* */tests/* */examples/* 0357 // vim:ts=4:sw=4:expandtab:filetype=doxygen