Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ketch/764e8dd4a91399eef5be to your computer and use it in GitHub Desktop.
Save ketch/764e8dd4a91399eef5be to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:7893bd50213afe62d916fada22310858c7aa2def417638195b831513028e4cd7"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from nodepy import rk"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"ssp22 = rk.SSPRK2(2)\n",
"print ssp22"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"SSPRK(2,2)\n",
"\n",
" 0 |\n",
" 1 | 1\n",
"_____|__________\n",
" | 1/2 1/2\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print ssp22.alpha\n",
"print ssp22.beta"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[0 0]\n",
" [1 0]\n",
" [1/2 1/2]]\n",
"[[0 0]\n",
" [1 0]\n",
" [0 1/2]]\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"ssp43 = rk.SSPRK3(4)\n",
"print ssp43"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"SSPRK43\n",
"\n",
" 0 |\n",
" 1/2 | 1/2\n",
" 1 | 1/2 1/2\n",
" 1/2 | 1/6 1/6 1/6\n",
"_____|____________________\n",
" | 1/6 1/6 1/6 1/2\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print ssp43.alpha\n",
"print ssp43.beta"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[0 0 0 0]\n",
" [1 0 0 0]\n",
" [0 1 0 0]\n",
" [2/3 0 1/3 0]\n",
" [0 0 0 1]]\n",
"[[0 0 0 0]\n",
" [1/2 0 0 0]\n",
" [0 1/2 0 0]\n",
" [0 0 1/6 0]\n",
" [0 0 0 1/2]]\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"ssp93 = rk.SSPRK3(9)\n",
"print ssp93"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"SSPRK93\n",
"\n",
" 0 |\n",
" 1/6 | 1/6\n",
" 1/3 | 1/6 1/6\n",
" 1/2 | 1/6 1/6 1/6\n",
" 2/3 | 1/6 1/6 1/6 1/6\n",
" 5/6 | 1/6 1/6 1/6 1/6 1/6\n",
" 1/2 | 1/6 1/15 1/15 1/15 1/15 1/15\n",
" 2/3 | 1/6 1/15 1/15 1/15 1/15 1/15 1/6\n",
" 5/6 | 1/6 1/15 1/15 1/15 1/15 1/15 1/6 1/6\n",
"______|______________________________________________________\n",
" | 1/6 1/15 1/15 1/15 1/15 1/15 1/6 1/6 1/6\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print ssp93.alpha"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[0 0 0 0 0 0 0 0 0]\n",
" [1 0 0 0 0 0 0 0 0]\n",
" [0 1 0 0 0 0 0 0 0]\n",
" [0 0 1 0 0 0 0 0 0]\n",
" [0 0 0 1 0 0 0 0 0]\n",
" [0 0 0 0 1 0 0 0 0]\n",
" [0 3/5 0 0 0 2/5 0 0 0]\n",
" [0 0 0 0 0 0 1 0 0]\n",
" [0 0 0 0 0 0 0 1 0]\n",
" [0 0 0 0 0 0 0 0 1]]\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print ssp93.beta"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[0 0 0 0 0 0 0 0 0]\n",
" [1/6 0 0 0 0 0 0 0 0]\n",
" [0 1/6 0 0 0 0 0 0 0]\n",
" [0 0 1/6 0 0 0 0 0 0]\n",
" [0 0 0 1/6 0 0 0 0 0]\n",
" [0 0 0 0 1/6 0 0 0 0]\n",
" [0 0 0 0 0 1/15 0 0 0]\n",
" [0 0 0 0 0 0 1/6 0 0]\n",
" [0 0 0 0 0 0 0 1/6 0]\n",
" [0 0 0 0 0 0 0 0 1/6]]\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"ssp104 = rk.loadRKM('SSP104')\n",
"print ssp104"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"SSPRK(10,4)\n",
"The optimal ten-stage, fourth order SSP Runge-Kutta method\n",
" 0 |\n",
" 1/6 | 1/6\n",
" 1/3 | 1/6 1/6\n",
" 1/2 | 1/6 1/6 1/6\n",
" 2/3 | 1/6 1/6 1/6 1/6\n",
" 1/3 | 1/15 1/15 1/15 1/15 1/15\n",
" 1/2 | 1/15 1/15 1/15 1/15 1/15 1/6\n",
" 2/3 | 1/15 1/15 1/15 1/15 1/15 1/6 1/6\n",
" 5/6 | 1/15 1/15 1/15 1/15 1/15 1/6 1/6 1/6\n",
" 1 | 1/15 1/15 1/15 1/15 1/15 1/6 1/6 1/6 1/6\n",
"______|____________________________________________________________\n",
" | 1/10 1/10 1/10 1/10 1/10 1/10 1/10 1/10 1/10 1/10\n"
]
}
],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print ssp104.alpha"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[0 0 0 0 0 0 0 0 0 0]\n",
" [1 0 0 0 0 0 0 0 0 0]\n",
" [0 1 0 0 0 0 0 0 0 0]\n",
" [0 0 1 0 0 0 0 0 0 0]\n",
" [0 0 0 1 0 0 0 0 0 0]\n",
" [0 0 0 0 2/5 0 0 0 0 0]\n",
" [0 0 0 0 0 1 0 0 0 0]\n",
" [0 0 0 0 0 0 1 0 0 0]\n",
" [0 0 0 0 0 0 0 1 0 0]\n",
" [0 0 0 0 0 0 0 0 1 0]\n",
" [0 0 0 0 9/25 0 0 0 0 3/5]]\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print ssp104.beta"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[0 0 0 0 0 0 0 0 0 0]\n",
" [1/6 0 0 0 0 0 0 0 0 0]\n",
" [0 1/6 0 0 0 0 0 0 0 0]\n",
" [0 0 1/6 0 0 0 0 0 0 0]\n",
" [0 0 0 1/6 0 0 0 0 0 0]\n",
" [0 0 0 0 1/15 0 0 0 0 0]\n",
" [0 0 0 0 0 1/6 0 0 0 0]\n",
" [0 0 0 0 0 0 1/6 0 0 0]\n",
" [0 0 0 0 0 0 0 1/6 0 0]\n",
" [0 0 0 0 0 0 0 0 1/6 0]\n",
" [0 0 0 0 3/50 0 0 0 0 1/10]]\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment