Skip to content

Instantly share code, notes, and snippets.

@DSCF-1224
Created August 9, 2020 14:29
Show Gist options
  • Select an option

  • Save DSCF-1224/52fa849e46152e98b1c83b163ab7a216 to your computer and use it in GitHub Desktop.

Select an option

Save DSCF-1224/52fa849e46152e98b1c83b163ab7a216 to your computer and use it in GitHub Desktop.
Julia の Base.Math.evalpoly の動作検証メモ
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[Base.Math.evalpoly — Function](https://docs.julialang.org/en/v1/base/math/#Base.Math.evalpoly)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"v\"1.4.1\""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Base.VERSION"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (1,0)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 0\n",
" 1\n",
" 2\n",
" 3\n",
" 4\n",
" 5\n",
" 6\n",
" 7\n",
" 8\n",
" 9\n",
" 10"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (0,1)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (1,0,0)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 0\n",
" 1\n",
" 2\n",
" 3\n",
" 4\n",
" 5\n",
" 6\n",
" 7\n",
" 8\n",
" 9\n",
" 10"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (0,1,0)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 0\n",
" 1\n",
" 4\n",
" 9\n",
" 16\n",
" 25\n",
" 36\n",
" 49\n",
" 64\n",
" 81\n",
" 100"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (0,0,1)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1\n",
" 1"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (1,0,0,0)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 0\n",
" 1\n",
" 2\n",
" 3\n",
" 4\n",
" 5\n",
" 6\n",
" 7\n",
" 8\n",
" 9\n",
" 10"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (0,1,0,0)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 0\n",
" 1\n",
" 4\n",
" 9\n",
" 16\n",
" 25\n",
" 36\n",
" 49\n",
" 64\n",
" 81\n",
" 100"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (0,0,1,0)) for iter in 0:1:10]"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"11-element Array{Int64,1}:\n",
" 0\n",
" 1\n",
" 8\n",
" 27\n",
" 64\n",
" 125\n",
" 216\n",
" 343\n",
" 512\n",
" 729\n",
" 1000"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"[Base.Math.evalpoly(iter, (0,0,0,1)) for iter in 0:1:10]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.4.1",
"language": "julia",
"name": "julia-1.4"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.4.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment