<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>libqalculate-0.9.7: Index</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.5 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li class="current"><a href="index.html"><span>Main Page</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div> <div class="contents"> <h1>Index</h1> <p> <h2><a class="anchor" name="intro_sec"> Introduction</a></h2> libqalculate is math libary for expression evaluation with units, variables and functions support and CAS functionality.<p> The main parts of the library is the almighty <a class="el" href="classCalculator.html" title="The almighty calculator class.">Calculator</a> class, the <a class="el" href="classMathStructure.html" title="A structure representing a mathematical value/expression/result.">MathStructure</a> class for mathematical expressions and classes for objects in an epxression, mostly of the class Numbers and sub classes of <a class="el" href="classExpressionItem.html" title="Abstract base class for functions, variables and units.">ExpressionItem</a>.<p> A simple application using libqalculate need only create a calculator object, perhaps load definitions (functions, variables, units, etc.) and use the calculate function as follows: <div class="fragment"><pre class="fragment"> <span class="keyword">new</span> <a class="code" href="classCalculator.html" title="The almighty calculator class.">Calculator</a>(); CALCULATOR->loadGlobalDefinitions(); CALCULATOR->loadLocalDefinitions(); <a class="code" href="structEvaluationOptions.html" title="Options for calculation.">EvaluationOptions</a> eo; <a class="code" href="classMathStructure.html" title="A structure representing a mathematical value/expression/result.">MathStructure</a> result = CALCULATOR->calculate(<span class="stringliteral">"1 + 1"</span>, eo); </pre></div><p> More complex usage mainly involves manipulating objects of the <a class="el" href="classMathStructure.html" title="A structure representing a mathematical value/expression/result.">MathStructure</a> class directly.<p> To display the resulting expression you will normally use MathStructure::format() followed by MathStructure::print() as follows: <div class="fragment"><pre class="fragment"> <a class="code" href="structPrintOptions.html" title="Options for formatting and display of mathematical structures/results.">PrintOptions</a> po; result.<a class="code" href="classMathStructure.html#46583bfc7f4e37479fe6e8be076f57c2">format</a>(po); <span class="keywordtype">string</span> result_str = result.<a class="code" href="classMathStructure.html#633a9c9a43a6e31653d0a970bd97a166">print</a>(po); </pre></div><p> Central to the flexiblity of libqalculate is the many options passed to evaluating and display functions with <a class="el" href="structEvaluationOptions.html" title="Options for calculation.">EvaluationOptions</a> and <a class="el" href="structPrintOptions.html" title="Options for formatting and display of mathematical structures/results.">PrintOptions</a>.<h2><a class="anchor" name="usage_sec"> Using the library</a></h2> libqalculate uses pkg-config.<p> For a simple program use pkg-config on the command line: <div class="fragment"><pre class="fragment"> c++ `pkg-config --cflags --libs libqalculate` hello.c -o hello </pre></div><p> If the program uses autoconf, put the following in configure.in: <div class="fragment"><pre class="fragment"> PKG_CHECK_MODULES(QALCULATE, [ libqalculate >= 0.9.7 ]) AC_SUBST(QALCULATE_CFLAGS) AC_SUBST(QALCULATE_LIBS) </pre></div> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jan 5 08:26:28 2010 for libqalculate-0.9.7 by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address> </body> </html>