• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Jacobi Polynomials</title>
5<link rel="stylesheet" href="../../math.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Math Toolkit 2.12.0">
8<link rel="up" href="../sf_poly.html" title="Polynomials">
9<link rel="prev" href="gegenbauer.html" title="Gegenbauer Polynomials">
10<link rel="next" href="../bessel.html" title="Bessel Functions">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="gegenbauer.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_poly.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../bessel.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="math_toolkit.sf_poly.jacobi"></a><a class="link" href="jacobi.html" title="Jacobi Polynomials">Jacobi Polynomials</a>
28</h3></div></div></div>
29<h5>
30<a name="math_toolkit.sf_poly.jacobi.h0"></a>
31        <span class="phrase"><a name="math_toolkit.sf_poly.jacobi.synopsis"></a></span><a class="link" href="jacobi.html#math_toolkit.sf_poly.jacobi.synopsis">Synopsis</a>
32      </h5>
33<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">jacobi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
34</pre>
35<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span>
36
37<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Real</span><span class="special">&gt;</span>
38<span class="identifier">Real</span> <span class="identifier">jacobi</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">beta</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">x</span><span class="special">);</span>
39
40<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Real</span><span class="special">&gt;</span>
41<span class="identifier">Real</span> <span class="identifier">jacobi_derivative</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">beta</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">k</span><span class="special">);</span>
42
43<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Real</span><span class="special">&gt;</span>
44<span class="identifier">Real</span> <span class="identifier">jacobi_prime</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">beta</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">x</span><span class="special">);</span>
45
46<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Real</span><span class="special">&gt;</span>
47<span class="identifier">Real</span> <span class="identifier">jacobi_double_prime</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">beta</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">x</span><span class="special">);</span>
48
49<span class="special">}}</span> <span class="comment">// namespaces</span>
50</pre>
51<p>
52        Jacobi polynomials are a family of orthogonal polynomials.
53      </p>
54<p>
55        A basic usage is as follows:
56      </p>
57<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">jacobi</span><span class="special">;</span>
58<span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0.5</span><span class="special">;</span>
59<span class="keyword">double</span> <span class="identifier">alpha</span> <span class="special">=</span> <span class="number">0.3</span><span class="special">;</span>
60<span class="keyword">double</span> <span class="identifier">beta</span> <span class="special">=</span> <span class="number">7.2</span><span class="special">;</span>
61<span class="keyword">unsigned</span> <span class="identifier">n</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
62<span class="keyword">double</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">jacobi</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">beta</span><span class="special">,</span> <span class="identifier">x</span><span class="special">);</span>
63</pre>
64<p>
65        All derivatives of the Jacobi polynomials are available. The <span class="emphasis"><em>k</em></span>-th
66        derivative of the <span class="emphasis"><em>n</em></span>-th Gegenbauer polynomial is given
67        by
68      </p>
69<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">jacobi_derivative</span><span class="special">;</span>
70<span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0.5</span><span class="special">;</span>
71<span class="keyword">double</span> <span class="identifier">alpha</span> <span class="special">=</span> <span class="number">0.3</span><span class="special">;</span>
72<span class="keyword">double</span> <span class="identifier">beta</span> <span class="special">=</span> <span class="number">7.2</span><span class="special">;</span>
73<span class="keyword">unsigned</span> <span class="identifier">n</span> <span class="special">=</span> <span class="number">3</span><span class="special">;</span>
74<span class="keyword">double</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">jacobi_derivative</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">beta</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">k</span><span class="special">);</span>
75</pre>
76<p>
77        For consistency with the rest of the library, <code class="computeroutput"><span class="identifier">jacobi_prime</span></code>
78        is provided which simply returns <code class="computeroutput"><span class="identifier">jacobi_derivative</span><span class="special">(</span><span class="identifier">n</span><span class="special">,</span>
79        <span class="identifier">lambda</span><span class="special">,</span>
80        <span class="identifier">x</span><span class="special">,</span><span class="number">1</span><span class="special">)</span></code>.
81      </p>
82<p>
83        <span class="inlinemediaobject"><object type="image/svg+xml" data="../../../graphs/jacobi.svg"></object></span>
84      </p>
85<h4>
86<a name="math_toolkit.sf_poly.jacobi.h1"></a>
87        <span class="phrase"><a name="math_toolkit.sf_poly.jacobi.implementation"></a></span><a class="link" href="jacobi.html#math_toolkit.sf_poly.jacobi.implementation">Implementation</a>
88      </h4>
89<p>
90        The implementation uses the 3-term recurrence for the Jacobi polynomials,
91        rising.
92      </p>
93</div>
94<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
95<td align="left"></td>
96<td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
97      Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
98      Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
99      Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
100      Daryle Walker and Xiaogang Zhang<p>
101        Distributed under the Boost Software License, Version 1.0. (See accompanying
102        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
103      </p>
104</div></td>
105</tr></table>
106<hr>
107<div class="spirit-nav">
108<a accesskey="p" href="gegenbauer.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_poly.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../bessel.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
109</div>
110</body>
111</html>
112