- HeunD
** COULOMB WAVE FUNCTION (see chapter 33 in https://dlmf.nist.gov)
- CoulombF
+
+ ** COMBINATORIAL FUNCTIONS
+ - Catalan
+ - Fibonacci
'''
if(not functions):
print ddExamples.__doc__;
return destiny_ring.element([x**2-2*rm*x-rl*(rl+1), 0, x**2], init=init, name=DinamicString("CoulombF(_1;_2)(_3)", [repr(rm), repr(rl), "x"]));
+##################################################################################
+##################################################################################
+###
+### Combinatorial functions
+###
+##################################################################################
+##################################################################################
+@cached_function
+def Catalan():
+ return DFinite.element([2, 10*x-2, 4*x**2-x], [1,1]);
+
+@cached_function
+def Fibonacci(init=(1,1)):
+ parent, rinit = __check_list([el for el in init], [str(el) for el in DFinite.variables()]);
+ params = [str(v) for v in parent.gens()];
+ pos = ord('a');
+ if(len(init) < 2):
+ if(len(init) < 1):
+ while(chr(pos) in params):
+ pos += 1;
+ rinit = [chr(pos)];
+ if(len(init) == 1):
+ while(chr(pos) in params):
+ pos += 1;
+ rinit += [chr(pos)];
+ return Fibonacci(tuple(rinit));
+
+ if(parent is QQ):
+ destiny_ring = DFinite;
+ else:
+ destiny_ring = ParametrizedDDRing(DFinite, params);
+
+ x = destiny_ring.variables()[0];
+
+ return destiny_ring(((rinit[1]-rinit[0])*x + rinit[0])/(1-x-x**2));
##################################################################################
##################################################################################
else:
try:
try:
- X = self.base()(X);
+ num = self.base()(X); den = self.base().one();
except TypeError as e:
try:
- X = self.base()(str(X));
+ num = self.base()(str(X)); den = self.base().one();
except:
- raise e;
- el = self.element([-self.base_derivation(X), X]);
+ ## Trying the fraction field
+ try:
+ X = self.base().fraction_field()(X);
+ num = self.base()(X.numerator()); den = self.base()(X.denominator());
+ except:
+ try:
+ X = self.base().fraction_field()(str(X));
+ num = self.base()(X.numerator()); den = self.base()(X.denominator());
+ except:
+ raise e;
+
+ dnum = self.base_derivation(num); dden = self.base_derivation(den);
+ el = self.element([dden*num - dnum*den, num*den]);
name = str(X);
try:
name = X._DDFunction__name;