Skip to content

Commit

Permalink
Replaced diff_eq() with diff_eq_python() to see the influence
Browse files Browse the repository at this point in the history
cython + cython 0.866ms
python + cython 3.81 ms
python + python 4.4 ms
  • Loading branch information
kangwonlee committed Oct 13, 2018
1 parent 489cddd commit bcb0197
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 10.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
"metadata": {},
"outputs": [],
"source": [
"def diff_eq_python(xi):\n",
"\n",
" # dx/dt + x = 0\n",
" return -xi\n",
"\n",
"\n",
"def euler_python():\n",
"\n",
" # initial values\n",
Expand All @@ -186,7 +192,7 @@
" dx_dt = 0\n",
" \n",
" for i in range(1, n):\n",
" dx_dt = diff_eq(result_x[i-1])\n",
" dx_dt = diff_eq_python(result_x[i-1])\n",
" result_x[i] = result_x[i-1] + dx_dt * delta_t\n",
" result_t[i] = result_t[i-1] + delta_t\n",
"\n",
Expand Down

0 comments on commit bcb0197

Please sign in to comment.