blob: 410803ad056683a6466f5f7673c9b2e4e87537e1 [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Logarithmic Functions &mdash; Apache AGE master documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/custom.css" type="text/css" />
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Trigonometric Functions" href="trigonometric_functions.html" />
<link rel="prev" title="Numeric Functions" href="numeric_functions.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> Apache AGE
<img src="../_static/logo.png" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption" role="heading"><span class="caption-text">Introduction</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../intro/overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/setup.html">Setup</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/graphs.html">Graphs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/cypher.html">The AGE Cypher Query Format</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/types.html">Data Types - An Introduction to agtype</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/comparability.html">Comparability, Equality, Orderability and Equivalence</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/operators.html">Operators</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/aggregation.html">Aggregation</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Clauses</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../clauses/match.html">MATCH</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/with.html">WITH</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/return.html">RETURN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/order_by.html">ORDER BY</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/skip.html">SKIP</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/limit.html">LIMIT</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/create.html">CREATE</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/set.html">SET</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/remove.html">REMOVE</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/delete.html">DELETE</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Functions</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="predicate_functions.html">Predicate Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="scalar_functions.html">Scalar Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="list_functions.html">List Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="numeric_functions.html">Numeric Functions</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Logarithmic Functions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#e">e</a></li>
<li class="toctree-l2"><a class="reference internal" href="#sqrt">sqrt</a></li>
<li class="toctree-l2"><a class="reference internal" href="#exp">exp</a></li>
<li class="toctree-l2"><a class="reference internal" href="#log">log</a></li>
<li class="toctree-l2"><a class="reference internal" href="#log10">log10</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="trigonometric_functions.html">Trigonometric Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="string_functions.html">String Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="aggregate_functions.html">Aggregation Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="user_functions.html">User defined functions</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">AGE Beyond Cypher</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced_overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html">Using Cypher in a CTE Expression</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html#using-cypher-in-a-join-expression">Using Cypher in a Join expression</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html#cypher-in-sql-expressions">Cypher in SQL expressions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/prepared_statements.html">Prepared Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/plpgsql.html">PL/pgSQL Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/sql_in_cypher.html">SQL In Cypher</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Apache AGE</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>Logarithmic Functions</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/apache/incubator-age-website/blob/master/docs/functions/logarithmic_functions.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="tex2jax_ignore mathjax_ignore section" id="logarithmic-functions">
<h1>Logarithmic Functions<a class="headerlink" href="#logarithmic-functions" title="Permalink to this headline"></a></h1>
<div class="section" id="e">
<h2>e<a class="headerlink" href="#e" title="Permalink to this headline"></a></h2>
<p>e() returns the base of the natural logarithm, e.</p>
<p>Syntax:e()</p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">float</span><span class="o">.</span>
</pre></div>
</div>
<p>Query</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN e()
$$) as (e agtype);
</pre></div>
</div>
<p>Results</p>
<table>
<tr>
<td>e
</td>
</tr>
<tr>
<td> 2.71828182845905
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="sqrt">
<h2>sqrt<a class="headerlink" href="#sqrt" title="Permalink to this headline"></a></h2>
<p>sqrt() returns the square root of a number.</p>
<p>Syntax:sqrt(expression)</p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">float</span><span class="o">.</span>
</pre></div>
</div>
<p>Query</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN sqrt(144)
$$) as (results agtype);
</pre></div>
</div>
<p>Results</p>
<table>
<tr>
<td>results
</td>
</tr>
<tr>
<td>12
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="exp">
<h2>exp<a class="headerlink" href="#exp" title="Permalink to this headline"></a></h2>
<p>exp() returns e^n, where e is the base of the natural logarithm, and n is the value of the argument expression.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">e(expression)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">Float</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>expression
</td>
<td>An agtype number expression
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>exp(null) returns null.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN e(2)
$$) as (e agtype);
</pre></div>
</div>
<p>e to the power of 2 is returned.</p>
<p>Result:</p>
<table>
<tr>
<td>e
</td>
</tr>
<tr>
<td>7.38905609893065
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="log">
<h2>log<a class="headerlink" href="#log" title="Permalink to this headline"></a></h2>
<p>log() returns the natural logarithm of a number.</p>
<p>Syntax:<code class="docutils literal notranslate"><span class="pre">log(expression)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">Float</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>expression
</td>
<td>An agtype number expression
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>log(null) returns null.</p></li>
<li><p>log(0) returns null.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN log(27)
$$) as (natural_logarithm agtype);
</pre></div>
</div>
<p>The natural logarithm of 27 is returned.</p>
<p>Result:</p>
<table>
<tr>
<td>natural_logarithm
</td>
</tr>
<tr>
<td>3.295836866004329
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="log10">
<h2>log10<a class="headerlink" href="#log10" title="Permalink to this headline"></a></h2>
<p>log10() returns the common logarithm (base 10) of a number.</p>
<p>Syntax:<code class="docutils literal notranslate"><span class="pre">log10(expression)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">Float</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>expression
</td>
<td>An agtype number expression
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>log10(null) returns null.</p></li>
<li><p>log10(0) returns null.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN log(27)
$$) as (natural_logarithm agtype);
</pre></div>
</div>
<p>The common logarithm of 27 is returned.</p>
<p>Result:</p>
<table>
<tr>
<td>natural_logarithm
</td>
</tr>
<tr>
<td>1.4313637641589874
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="trigonometric_functions.html" class="btn btn-neutral float-right" title="Trigonometric Functions" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="numeric_functions.html" class="btn btn-neutral float-left" title="Numeric Functions" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2021, Apache AGE.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Other Versions</span>
v: v0.6.0
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
<dt>Versions</dt>
<dd><a href="../../master/index.html">master</a></dd>
<dd><a href="logarithmic_functions.html">v0.6.0</a></dd>
</dl>
</div>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>