Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 176 additions & 29 deletions examples/Sage-ACSV-Tests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"source": [
"# Binomial coefficients\n",
"F1 = 1/(1-x-y)\n",
"diagonal_asy(F1, as_symbolic=True)"
"diagonal_asy(F1, as_symbolic=True, use_msolve=False)"
]
},
{
Expand All @@ -60,14 +60,36 @@
{
"data": {
"text/plain": [
"4*4^n/(pi^1.0*n^1.0)"
"4^n/(sqrt(pi)*sqrt(n))"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Binomial coefficients\n",
"F1 = 1/(1-x-y)\n",
"diagonal_asy(F1, as_symbolic=True, use_msolve=True)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4*4^n/(pi*n)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Lattice paths enumeration sequence (on main diagonal)\n",
"F2 = (1+x)*(1+y)/(1-w*x*y*(x+y+1/x+1/y))\n",
Expand All @@ -76,16 +98,16 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.225275868941647?*33.97056274847714?^n/(pi^1.5*n^1.5)"
"1.225275868941647?*33.97056274847714?^n/(pi^(3/2)*n^(3/2))"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -98,19 +120,41 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.225275868941647?*33.97056274847714?^n/(pi^(3/2)*n^(3/2))"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Apéry sequence (on main diagonal)\n",
"F3 = 1/(1 - w*(1 + x)*(1 + y)*(1 + z)*(x*y*z + y*z + y + z + 1))\n",
"diagonal_asy(F3, as_symbolic=True, use_msolve=True)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<html>\\(\\displaystyle \\frac{{\\left(12 \\, \\sqrt{2} + 17\\right)}^{n} \\sqrt{\\frac{17}{2} \\, \\sqrt{2} + 12}}{4 \\, \\pi^{1.5} n^{1.5}}\\)</html>"
"<html>\\(\\displaystyle \\frac{{\\left(12 \\, \\sqrt{2} + 17\\right)}^{n} \\sqrt{\\frac{17}{2} \\, \\sqrt{2} + 12}}{4 \\, \\pi^{\\frac{3}{2}} n^{\\frac{3}{2}}}\\)</html>"
],
"text/latex": [
"$\\displaystyle \\frac{{\\left(12 \\, \\sqrt{2} + 17\\right)}^{n} \\sqrt{\\frac{17}{2} \\, \\sqrt{2} + 12}}{4 \\, \\pi^{1.5} n^{1.5}}$"
"$\\displaystyle \\frac{{\\left(12 \\, \\sqrt{2} + 17\\right)}^{n} \\sqrt{\\frac{17}{2} \\, \\sqrt{2} + 12}}{4 \\, \\pi^{\\frac{3}{2}} n^{\\frac{3}{2}}}$"
],
"text/plain": [
"1/4*(12*sqrt(2) + 17)^n*sqrt(17/2*sqrt(2) + 12)/(pi^1.5*n^1.5)"
"1/4*(12*sqrt(2) + 17)^n*sqrt(17/2*sqrt(2) + 12)/(pi^(3/2)*n^(3/2))"
]
},
"metadata": {},
Expand All @@ -125,29 +169,53 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.09677555757474702?*5.884442204019508?^n/(sqrt(pi)*sqrt(n))"
"(0.09677555757474702?*5.88444220401951?^n/(sqrt(pi)*sqrt(n)),\n",
" [[0.548232473567013?, 0.3099773361396642?]])"
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Example with two critical points with positive coords, neither of which is obviously non-minimal\n",
"F4 = -1/(1-(1-x-y)*(20-x-40*y))\n",
"diagonal_asy(F4, as_symbolic=True)"
"diagonal_asy(F4, as_symbolic=True, return_points=True)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.09677555757474702?*5.884442204019508?^n/(sqrt(pi)*sqrt(n)),\n",
" [[0.548232473567013?, 0.3099773361396642?]])"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Example with two critical points with positive coords, neither of which is obviously non-minimal\n",
"F4 = -1/(1-(1-x-y)*(20-x-40*y))\n",
"diagonal_asy(F4, as_symbolic=True, use_msolve=True, return_points=True)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -169,7 +237,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand All @@ -191,7 +259,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -200,7 +268,7 @@
"1.015051765128218?*5.828427124746190?^n/(sqrt(pi)*sqrt(n))"
]
},
"execution_count": 10,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -213,7 +281,29 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.015051765128218?*5.828427124746190?^n/(sqrt(pi)*sqrt(n))"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Delannoy generating function\n",
"F7 = 1/(1 - x - y - x*y)\n",
"diagonal_asy(F7, as_symbolic=True, use_msolve=True)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand All @@ -222,7 +312,7 @@
"1/7*(0.6234898018587335? + 0.7818314824680299?*I)^n + 1/7*(0.6234898018587335? - 0.7818314824680299?*I)^n + 1/7*(-0.2225209339563144? + 0.9749279121818236?*I)^n + 1/7*(-0.2225209339563144? - 0.9749279121818236?*I)^n + 1/7*(-0.9009688679024191? + 0.4338837391175581?*I)^n + 1/7*(-0.9009688679024191? - 0.4338837391175581?*I)^n + 1/7"
]
},
"execution_count": 11,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -235,7 +325,29 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1/7*(0.6234898018587335? + 0.7818314824680299?*I)^n + 1/7*(0.6234898018587335? - 0.7818314824680299?*I)^n + 1/7*(-0.2225209339563144? + 0.9749279121818236?*I)^n + 1/7*(-0.2225209339563144? - 0.9749279121818236?*I)^n + 1/7*(-0.9009688679024191? + 0.4338837391175581?*I)^n + 1/7*(-0.9009688679024191? - 0.4338837391175581?*I)^n + 1/7"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# One variable example with many minimal critical points on same torus\n",
"F8 = 1/(1 - x^7)\n",
"diagonal_asy(F8, as_symbolic=True, use_msolve=True)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand All @@ -244,7 +356,7 @@
"([(1.285654384750451?, 1, 1, 0.03396226416457560?)], [[0.7778140158516262?]])"
]
},
"execution_count": 12,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -257,7 +369,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 18,
"metadata": {},
"outputs": [
{
Expand All @@ -266,7 +378,7 @@
"0.9430514023983397?*4.518911369262258?^n/(sqrt(pi)*sqrt(n))"
]
},
"execution_count": 13,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -278,12 +390,47 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"0.9430514023983397?*4.518911369262258?^n/(sqrt(pi)*sqrt(n))"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"F10 = (x^2*y^2 - x*y + 1)/(1-x-y-x*y+x*y^2+x^2*y-x^2*y^3-x^3*y^2)\n",
"diagonal_asy(F10, as_symbolic=True, use_msolve=True)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.068693934883829?*3.910193204291776?^n/(sqrt(pi)*sqrt(n))"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Does not finish computing (hangs on computing GB for critical point system)\n",
"#F = (1-x^3*y^6+x^3*y^4+x^2*y^4+x^2*y^3)/(1-x-y+x^2*y^3-x^3*y^3-x^4*y^4-x^3*y^6+x^4*y^6)"
"#Does not finish computing (hangs on computing GB for critical point system)\n",
"from sage_acsv import diagonal_asy\n",
"var('x,y,w,z,n')\n",
"F = (1-x^3*y^6+x^3*y^4+x^2*y^4+x^2*y^3)/(1-x-y+x^2*y^3-x^3*y^3-x^4*y^4-x^3*y^6+x^4*y^6)\n",
"diagonal_asy(F, as_symbolic=True, use_msolve=True)"
]
},
{
Expand All @@ -307,7 +454,7 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "SageMath 9.7",
"display_name": "SageMath 10.2",
"language": "sage",
"name": "sagemath"
},
Expand All @@ -321,7 +468,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.11.1"
}
},
"nbformat": 4,
Expand Down
Loading