# Ticket #21639: 0001-Implement-derivative-of-gegenbauer-n-a-x-w.r.t-x.patch

File 0001-Implement-derivative-of-gegenbauer-n-a-x-w.r.t-x.patch, 2.0 KB (added by mafra, 5 years ago)

Patch implementing the derivative of gegenbauer(n,a,x) wrt x

• ## src/sage/functions/orthogonal_polys.py

```From e71983bcef03a1429cb3bc58065709a1f5e93529 Mon Sep 17 00:00:00 2001
From: "Carlos R. Mafra" <crmafra@gmail.com>
Date: Tue, 4 Oct 2016 17:52:47 +0100
Subject: [PATCH] Implement derivative of gegenbauer(n,a,x) w.r.t x

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
---
src/sage/functions/orthogonal_polys.py | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py
index 8a593d5..88e6509 100644```
 a class Func_ultraspherical(GinacFunction): conversions={'maxima':'ultraspherical', 'mathematica':'GegenbauerC', 'maple':'GegenbauerC', 'sympy':'gegenbauer'}) def _derivative_(self, n, a, x, diff_param): """ Return the derivative of the Gegenbauer polynomial in terms of other Gegenbauer polynomials. EXAMPLES:: sage: var('a n') (a, n) sage: derivative(gegenbauer(n,a,x),x) 2*a*gegenbauer(n - 1, a + 1, x) sage: derivative(gegenbauer(3,a,x),x) 4*(a + 2)*(a + 1)*a*x^2 - 2*(a + 1)*a sage: derivative(gegenbauer(n,a,x),a) Traceback (most recent call last): ... NotImplementedError: derivative w.r.t. to the second index is not supported yet """ if diff_param == 0: raise NotImplementedError("derivative w.r.t. to the index is not supported yet") elif diff_param == 1: raise NotImplementedError("derivative w.r.t. to the second index is not supported yet") elif diff_param == 2: return 2*a*ultraspherical(n-1, a+1, x) raise ValueError("illegal differentiation parameter {}".format(diff_param)) ultraspherical = Func_ultraspherical() gegenbauer = Func_ultraspherical()