{ "cells": [ { "cell_type": "markdown", "id": "26100ad0", "metadata": {}, "source": [ "The investigation below suggests that the found polynomial families are appell sequences <=> are have translation properties <=> have interesting derivative properties \n", "\n", "1. https://en.wikipedia.org/wiki/Bernoulli_polynomials#Differences_and_derivatives\n", "2. https://en.wikipedia.org/wiki/Appell_sequence\n", "\n", "Q: are $p_m(n, k)$ linearly independent? Sol: show $p_m(0, k) = k^m$. Then this uses the fact the $x^m$ are linearly independent polynomials. Simple using the recurrence definition. \n", "\n", "Q: given a polynomial $p$ that is BH, is it a linear comb. of $\\{p_m\\}$? Given any polynomial in (n,k), is it a linear combination of $\\{p_m\\}$? Scratch: the bernoulli polynomials have an inversion formula, take a look at that. \n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "ab663fcf", "metadata": {}, "outputs": [], "source": [ "from sympy import *" ] }, { "cell_type": "code", "execution_count": 66, "id": "cc5e1c51", "metadata": {}, "outputs": [], "source": [ "x = symbols('x')\n", "k = symbols('k')\n", "a = symbols('a')\n", "n = symbols('n')" ] }, { "cell_type": "code", "execution_count": 161, "id": "ff310a99", "metadata": {}, "outputs": [], "source": [ "import functools\n", "\n", "\n", "def bh(m):\n", " if m < 0:\n", " return lambda n, k: 0\n", " if m == 0:\n", " return lambda n, k: 1\n", " elif m == 1:\n", " return lambda n, k: k\n", " else:\n", " \n", " def alternating_tangent(n):\n", " # https://mathworld.wolfram.com/TangentNumber.html \n", " return 2 ** (2*n) * (2**(2*n)-1) * Abs(bernoulli(2*n)) / (2*n)\n", " \n", " def R(n, k):\n", " running_sum = 0\n", " for j in range(1, round(m/2) + 1):\n", " i = m - 2*j\n", " running_sum += (-1)**(j) * alternating_tangent(j) * binomial(m-1, (2 * j - 1)) * bh(i)(n, k)\n", " return running_sum\n", " \n", " def fm(n, k):\n", " return k * bh(m-1)(n,k) + n * R(n, k)\n", " \n", " return fm\n", " \n", "bh_ = lambda m: (lambda x: bh(m)(n, x)) # fixing n\n" ] }, { "cell_type": "code", "execution_count": 167, "id": "e41ddfff", "metadata": {}, "outputs": [], "source": [ "def f(m):\n", " def fm(n, k):\n", " return (k + n) ** (m)\n", " return fm\n", "\n", "f_ = lambda m: (lambda x: f(m)(n, x)) # fixing n\n" ] }, { "cell_type": "code", "execution_count": 169, "id": "71c8dce8", "metadata": {}, "outputs": [], "source": [ "for s in [f_, bh_]:\n", " assert expand(s(2)(x-2)) == expand(s(2)(x) - 2 * s(1)(x) * 2 + s(0)(x) * 4)\n", " assert expand(s(3)(x+1)) == expand(s(3)(x) + 3 * s(2)(x) + 3 * s(1)(x) + s(0)(x))" ] }, { "cell_type": "code", "execution_count": 181, "id": "d4a6eae7", "metadata": {}, "outputs": [], "source": [ "# satifies appell seq. \n", "assert expand(diff(bh_(3)(x), x)) == expand(3 * bh_(2)(x))\n", "assert expand(diff(bh_(4)(x), x)) == expand(4 * bh_(3)(x))\n", "assert expand(diff(bh_(5)(x), x)) == expand(5 * bh_(4)(x))" ] }, { "cell_type": "code", "execution_count": 228, "id": "d3400f51", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{4}$" ], "text/plain": [ "k**4" ] }, "execution_count": 228, "metadata": {}, "output_type": "execute_result" } ], "source": [ "collect( (expand(bh(4)(1, k+1) + bh(4)(1, k-1)))/2, n)" ] }, { "cell_type": "code", "execution_count": 230, "id": "36385ebb", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle 2 k^{3} + 6 k^{2} + 12 k + 8$" ], "text/plain": [ "2*k**3 + 6*k**2 + 12*k + 8" ] }, "execution_count": 230, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(f(3)(1, k + 1) + f(3)(1, k - 1)) " ] }, { "cell_type": "code", "execution_count": 203, "id": "833c7aa9", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{3} - 3 k n + 3 k$" ], "text/plain": [ "k**3 - 3*k*n + 3*k" ] }, "execution_count": 203, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(2 *binomial(3,0)*bh(3)(n, k) + 2 *binomial(3,1)*bh(1)(n, k))" ] }, { "cell_type": "code", "execution_count": 231, "id": "4c4d41a7", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{4}$" ], "text/plain": [ "k**4" ] }, "execution_count": 231, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(bh(4)(0, k))" ] }, { "cell_type": "code", "execution_count": 234, "id": "489fefe7", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle 2 k^{4} + 2 k^{3} - 12 k^{2} n - 6 k n + 6 n^{2} + 4 n$" ], "text/plain": [ "2*k**4 + 2*k**3 - 12*k**2*n - 6*k*n + 6*n**2 + 4*n" ] }, "execution_count": 234, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(bh(4)(n+1, k+1) + bh(3)(n+1, k+1) + bh(4)(n+1, k-1) + bh(3)(n+1, k-1) )" ] }, { "cell_type": "code", "execution_count": 237, "id": "070290f6", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle 2 k^{4} + 2 k^{3} - 12 k^{2} n - 6 k n + 6 n^{2} + 4 n$" ], "text/plain": [ "2*k**4 + 2*k**3 - 12*k**2*n - 6*k*n + 6*n**2 + 4*n" ] }, "execution_count": 237, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(2 * bh(4)(n, k) + 2*bh(3)(n, k))" ] }, { "cell_type": "code", "execution_count": 238, "id": "4bacbde4", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{4} + 5 k^{3} - 6 k^{2} n + 3 k^{2} - 15 k n - 8 k + 3 n^{2} - n - 2$" ], "text/plain": [ "k**4 + 5*k**3 - 6*k**2*n + 3*k**2 - 15*k*n - 8*k + 3*n**2 - n - 2" ] }, "execution_count": 238, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(bh(4)(n+1, k+1) + bh(3)(n+1, k+1))" ] }, { "cell_type": "code", "execution_count": 240, "id": "01f7f470", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{4} - 3 k^{3} - 6 k^{2} n - 3 k^{2} + 9 k n + 8 k + 3 n^{2} + 5 n + 2$" ], "text/plain": [ "k**4 - 3*k**3 - 6*k**2*n - 3*k**2 + 9*k*n + 8*k + 3*n**2 + 5*n + 2" ] }, "execution_count": 240, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(bh(4)(n+1, k-1) + bh(3)(n+1, k-1))" ] }, { "cell_type": "code", "execution_count": 242, "id": "160f9129", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{4} - 6 k^{2} n + 3 n^{2} + 2 n$" ], "text/plain": [ "k**4 - 6*k**2*n + 3*n**2 + 2*n" ] }, "execution_count": 242, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(bh(4)(n, k) )" ] }, { "cell_type": "code", "execution_count": 243, "id": "08d78c73", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{6} - 15 k^{4} n + 45 k^{2} n^{2} + 30 k^{2} n - 15 n^{3} - 30 n^{2} - 16 n$" ], "text/plain": [ "k**6 - 15*k**4*n + 45*k**2*n**2 + 30*k**2*n - 15*n**3 - 30*n**2 - 16*n" ] }, "execution_count": 243, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(bh(6)(n, k))" ] }, { "cell_type": "code", "execution_count": 246, "id": "e4158568", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 1\n", "1 k\n", "2 k**2 - n\n", "3 k**3 - 3*k*n\n", "4 k**4 - 6*k**2*n + 3*n**2 + 2*n\n", "5 k**5 - 10*k**3*n + 15*k*n**2 + 10*k*n\n", "6 k**6 - 15*k**4*n + 45*k**2*n**2 + 30*k**2*n - 15*n**3 - 30*n**2 - 16*n\n" ] } ], "source": [ "for m in range(7):\n", " print(m, expand(bh(m)(n, k)))" ] }, { "cell_type": "code", "execution_count": 252, "id": "01df2d3a", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle k^{6} - 15 k^{4} n + 45 k^{2} n^{2} + 30 k^{2} n - 15 n^{3} - 30 n^{2} - 16 n$" ], "text/plain": [ "k**6 - 15*k**4*n + 45*k**2*n**2 + 30*k**2*n - 15*n**3 - 30*n**2 - 16*n" ] }, "execution_count": 252, "metadata": {}, "output_type": "execute_result" } ], "source": [ "expand(bh(6)(n, k))" ] }, { "cell_type": "code", "execution_count": null, "id": "72ab3575", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.0rc2" } }, "nbformat": 4, "nbformat_minor": 5 }