Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
numer-60-2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kittisak Maneewong
numer-60-2
Commits
82e20c87
Commit
82e20c87
authored
Apr 05, 2018
by
Kittisak Maneewong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Sheet
parent
5290c59f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
169 additions
and
7 deletions
+169
-7
Numerical-Differentiation-1.ipynb
.../numerical-method/09-10/Numerical-Differentiation-1.ipynb
+19
-7
Numerical-Differentiation-2.ipynb
.../numerical-method/09-10/Numerical-Differentiation-2.ipynb
+150
-0
No files found.
sheet/numerical-method/09-10/Numerical-Differentiation-1.ipynb
View file @
82e20c87
...
...
@@ -138,7 +138,9 @@
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def f1x(x):\n",
...
...
@@ -345,7 +347,9 @@
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import sympy\n",
...
...
@@ -355,7 +359,9 @@
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x,y,z,e = sympy.Symbol('x'), sympy.Symbol('y'), sympy.Symbol('z'), sympy.Symbol('e')"
...
...
@@ -364,7 +370,9 @@
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from sympy import sin, cos"
...
...
@@ -373,7 +381,9 @@
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"y = sin(x)*e**(-cos(x))"
...
...
@@ -472,7 +482,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
...
...
@@ -567,7 +579,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.
3
"
"version": "3.6.
1
"
}
},
"nbformat": 4,
...
...
sheet/numerical-method/09-10/Numerical-Differentiation-2.ipynb
View file @
82e20c87
...
...
@@ -333,6 +333,27 @@
"| 0.00125 | 1.28 | 0.367879 | 0.912121 |\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.36787944117144233"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from numpy import e\n",
"e**(-1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
...
...
@@ -371,6 +392,135 @@
"G = 0.367843\n",
"$$\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3678361863589256"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def extra(h1,p):\n",
" from math import e\n",
" g1 = (e**(-(1+h1)) - 2*e**(-1) + e**(-(1-h1)))/(h1**2)\n",
" h1=h1/2\n",
" g2 = (e**(-(1+h1)) - 2*e**(-1) + e**(-(1-h1)))/(h1**2)\n",
" return ((2**p)*g2-g1)/((2**p)-1)\n",
"extra(0.64,2)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3678361863589256"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def G(h):\n",
" from math import e\n",
" return (e**(-(1+h)) - 2*e**(-1) + e**(-(1-h)))/(h**2)\n",
"def extra(h1,p):\n",
" return ((2**p)*G(h1/2)-G(h1))/((2**p)-1)\n",
"extra(0.64,2)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.36784333333333336"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def extra(g1,g2,p):\n",
" return ((2**p)*g2-g1)/((2**p)-1)\n",
"extra(0.380610,0.371035,2)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.36784333333333336"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def g(h):\n",
" cda = {\n",
" 0.64:0.380610,\n",
" 0.32:0.371035,\n",
" 0.16:0.368711,\n",
" 0.08:0.368281,\n",
" 0.04:0.36875,\n",
" 0.02:0.37,\n",
" 0.01:0.38,\n",
" 0.005:0.40,\n",
" 0.0025:0.48,\n",
" 0.00125:1.28\n",
" }\n",
" return cda[h]\n",
"def extra(h,p):\n",
" return ((2**p)*g(h/2)-g(h))/((2**p)-1)\n",
"extra(0.64,2)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.36784333333333336"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"((2**2)*0.371035-0.380610)/3"
]
}
],
"metadata": {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment