Skip to content

Instantly share code, notes, and snippets.

@pgtwitter
Created July 24, 2023 15:58
Show Gist options
  • Save pgtwitter/d1efa82e31a3ed7cc5f1dd8c684f373f to your computer and use it in GitHub Desktop.
Save pgtwitter/d1efa82e31a3ed7cc5f1dd8c684f373f to your computer and use it in GitHub Desktop.
-1の11乗根の1から10乗において,奇数乗を加え,偶数乗を引いた時の和
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"source": [
"import sympy\n",
"N = 10\n",
"k = sympy.Symbol('k')\n",
"sympy.summation((-1)**(k-1) * (-1)**(k/(N+1)), (k, 1, N)).simplify()"
],
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/latex": [
"$\\displaystyle - \\left(-1\\right)^{\\frac{6}{11}} - \\left(-1\\right)^{\\frac{4}{11}} - \\left(-1\\right)^{\\frac{8}{11}} - \\left(-1\\right)^{\\frac{2}{11}} - \\left(-1\\right)^{\\frac{10}{11}} + \\sqrt[11]{-1} + \\left(-1\\right)^{\\frac{9}{11}} + \\left(-1\\right)^{\\frac{3}{11}} + \\left(-1\\right)^{\\frac{7}{11}} + \\left(-1\\right)^{\\frac{5}{11}}$"
],
"text/plain": [
"-(-1)**(6/11) - (-1)**(4/11) - (-1)**(8/11) - (-1)**(2/11) - (-1)**(10/11) + (-1)**(1/11) + (-1)**(9/11) + (-1)**(3/11) + (-1)**(7/11) + (-1)**(5/11)"
]
},
"metadata": {},
"execution_count": 1
}
],
"metadata": {}
}
],
"nbformat": 4,
"nbformat_minor": 2,
"metadata": {
"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
},
"orig_nbformat": 4
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment