Skip to content

Instantly share code, notes, and snippets.

@k3kaimu
Last active August 1, 2020 06:00
Show Gist options
  • Save k3kaimu/6dd25a1ca3cf0423157ab5c29dfb4383 to your computer and use it in GitHub Desktop.
Save k3kaimu/6dd25a1ca3cf0423157ab5c29dfb4383 to your computer and use it in GitHub Desktop.
sqrt(3^pi) と sqrt(pi^pi)を評価する
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# $\\sqrt{3^\\pi}$と$\\sqrt{\\pi^\\pi}$を評価する\n",
"\n",
"ここでは$3.141 < \\pi < 3.142$,$1.098 < \\ln 3 < 1.099$とする."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"PI_L = 3.141\n",
"PI_H = 3.142\n",
"LN3_L = 1.098\n",
"LN3_H = 1.099"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$\\sqrt{3^\\pi} = 3^{\\pi/2}$を評価するために,$a^x$のマクローリン展開を考える\n",
"$$\n",
"a^x = 1 + x \\ln a + \\frac{1}{2} (c \\ln a)^2\n",
"$$\n",
"ただし,$c \\in [0, x]$である.\n",
"$x^2$は$x>0$で単調増加関数のため,$0 < \\frac{1}{2} (c \\ln a)^2 < \\frac{1}{2} (x \\ln a)^2$が成立する.\n",
"また\n",
"$$\n",
"3^{3.141/2} = 3^{1.5705} < 3^{\\pi/2} < 3^{3.142/2} = 3^{1.571}\n",
"$$\n",
"である.\n",
"まず,下限である$3^{1.5705}$を計算すると\n",
"$$\n",
"3^{1.5705} = 3^{1.5} \\times 3^{0.0705}\n",
"$$\n",
"である.\n",
"これに,先ほどのマクローリン展開の下限を入れることで\n",
"$$\n",
"3^{1.5705} > 3^{1.5} \\times (1 + 0.0705 \\ln 3)\n",
"$$\n",
"である.$\\ln 3$の値にも下限値を代入すれば$3^{\\pi/2}$の下限値は以下の通りである."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.59838138559593"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3**1.5 * (1 + 0.0705 * LN3_L)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"上限値も同様に計算すると\n",
"$$\n",
"3^{1.571} < 3^{1.5} * (1 + 0.071 \\ln 3 + \\frac{1}{2} (0.071 \\ln 3)^2)\n",
"$$\n",
"であり,$\\ln 3$の値にも上限値を代入すれば$3^{\\pi/2}$の上限値は以下の通りである."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.617421451649643"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3**1.5 * (1 + 0.071 * LN3_H + 0.5 * (0.071 * LN3_H)**2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"従って,$5.598 < 3^{\\pi/2} < 5.618$であることがわかる.\n",
"実際に$3^{\\pi/2}$の値は以下の通りであり,評価が妥当であることがわかる."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.616429533092847"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3**(math.pi/2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"次に,$\\pi^{\\pi/2}$を評価するために,$(1+x)^a$のマクローリン展開を考える.\n",
"$$\n",
"(1+x)^a = 1 + ax + \\frac{a(a-1)}{2} c^2\n",
"$$\n",
"ただし,$c \\in [0, x]$である.\n",
"$x^2$は$x>0$で単調増加関数のため,$0 < \\frac{a(a-1)}{2} c^2 < \\frac{a(a-1)}{2} x^2$が成立する.\n",
"これを用いて,$\\pi^{\\pi/2}$の下限値を評価するために,次のように変形する.\n",
"$$\n",
"\\pi^{\\pi/2} > 3.141^{3.141/2} = (3 + 0.141)^{1.5705} = 3^{1.5705} \\left(1 + \\frac{0.141}{3} \\right)^{1.5705}\n",
"$$\n",
"$\\left(1 + \\frac{0.141}{3} \\right)^{1.5705}$の部分を評価すると\n",
"$$\n",
" \\left(1 + \\frac{0.141}{3} \\right)^{1.5705} > 1 + 1.5705 \\times \\frac{0.141}{3} \n",
"$$\n",
"であり,これを計算すると以下の通りである."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0738135"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 + 1.5705 * 0.141 / 3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"よって,$\\pi^{\\pi/2}$の下限値は,$ 3^{1.5705} > 5.598$を利用して以下の通りである."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6.006653999999999"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5.598 * 1.073"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"上限値についても同様に評価する.\n",
"$$\n",
"\\pi^{\\pi/2} < 3.142^{3.142/2} = (3 + 0.142)^{1.571} = 3^{1.571} \\left(1 + \\frac{0.142}{3} \\right)^{1.571}\n",
"$$\n",
"ただし,\n",
"$$\n",
" \\left(1 + \\frac{0.142}{3} \\right)^{1.571} < 1 + 1.571 \\times \\frac{0.142}{3} + \\frac{1.571 \\times 0.571}{2} \\left(\\frac{0.142}{3}\\right)^2\n",
"$$\n",
"でありこれを評価すると,"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0753655519291112"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 + 1.571 * (0.142/3) + (1.571 * 0.571)/2 * (0.142/3)**2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"結局,$\\pi^{\\pi/2}$の上限値は,$ 3^{1.571} > 5.618$を利用して"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6.044968000000001"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5.618 * 1.076"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"となり,$6.006 < \\pi^{\\pi/2} < 6.045$と評価できる."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment