Skip to content

Commit

Permalink
2021-08-26
Browse files Browse the repository at this point in the history
  • Loading branch information
bkxcyu committed Aug 26, 2021
1 parent 0a9fd87 commit 77ec545
Show file tree
Hide file tree
Showing 59 changed files with 8,528 additions and 357 deletions.
Binary file modified build/doctrees/FT_Interactive_animation.doctree
Binary file not shown.
Binary file added build/doctrees/FT_Interactive_animation_.doctree
Binary file not shown.
Binary file modified build/doctrees/environment.pickle
Binary file not shown.
Binary file modified build/doctrees/index.doctree
Binary file not shown.
Binary file modified build/doctrees/mdtest.doctree
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -82,37 +82,89 @@
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 63/63 [00:19<00:00, 3.21it/s]\n"
]
}
],
"source": [
"from tqdm import tqdm\n",
"n = 0\n",
"def F(omega,t):\n",
" z = np.exp(-1j*omega*t)\n",
" plt.arrow(0,0,z.real,z.imag,head_width=0.05, head_length=0.1)\n",
" plt.xlim(-1.1,1.1)\n",
" plt.ylim(-1.1,1.1)\n",
" set_center_axis(plt.gca())\n",
" ax1 = plt.gca()\n",
" ax1.set_xlabel('real',position=(1,0),fontsize = 14)\n",
" ax1.set_ylabel('imag',position=(0,1),fontsize = 14)\n",
" set_center_axis(plt.gca())\n",
" textstr = '\\n'.join((r'$e^{-i%.2f t}$' % (omega, ),))\n",
" ax1.text(0.5,0.5,textstr,fontsize = 30)\n",
" global n\n",
" n += 1\n",
" plt.savefig('img/e_'+str(n)+'.png')\n",
" plt.close()\n",
" \n",
"for omega in tqdm(np.arange(0,2*np.pi,0.1)):\n",
" F(omega,1)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "844f1f7b416140468642d679ca0ceb6f",
"model_id": "bf34081fd4da40f79886b15b40429deb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=-0.0031853071795859833, description='omega', max=6.283185307179586, mi"
"interactive(children=(FloatSlider(value=3.1, description='omega', max=6.283185307179586), FloatSlider(value=3."
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"n = 0\n",
"def F(omega,t):\n",
" z = np.exp(-1j*omega*t)\n",
" print(z)\n",
" plt.arrow(0,0,z.real,z.imag,head_width=0.05, head_length=0.1)\n",
" plt.xlim(-1.1,1.1)\n",
" plt.ylim(-1.1,1.1)\n",
" ax1 = plt.gca()\n",
" ax1.set_xlabel('real',position=(1,0),fontsize = 14)\n",
" ax1.set_ylabel('imag',position=(0,1),fontsize = 14)\n",
" set_center_axis(plt.gca())\n",
" textstr = '\\n'.join((r'$e^{-i%.2f t}$' % (omega, ),))\n",
" ax1.text(0.5,0.5,textstr,fontsize = 30)\n",
"# global n\n",
"# n += 1\n",
"# plt.savefig('img/e_'+str(n)+'.png')\n",
"\n",
" \n",
"interactive_plot = interactive(F,omega=(-2*np.pi, 2*np.pi, 0.01),t=(0, 2*np.pi, 0.1))\n",
"interactive_plot = interactive(F,omega=(0, 2*np.pi, 0.1),t=(0, 2*np.pi, 0.1))\n",
"output = interactive_plot.children[-1]\n",
"output.layout.height = '600px'\n",
"\n",
Expand All @@ -135,15 +187,13 @@
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0bf79c71fa134fae996aa284419a8fb9",
"model_id": "a7a227158e5f4e55b9fc10aac9ef7af1",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -174,7 +224,7 @@
" ax1.set_ylabel('imag',position=(0,1),fontsize = 14)\n",
" ax1.set_aspect(1)\n",
" textstr = '\\n'.join((r'$sin(2\\pi t)e^{-2\\pi it}\\cdot e^{%.2f}$' % (freq, ),))\n",
" ax1.text(0.05,1.1,textstr,fontsize = 15)\n",
" ax1.text(0.05,1.1,textstr,fontsize = 30)\n",
" ax2.scatter(ft_line[:,0],ft_line[:,1])\n",
" ax2.set_xlabel('$freq$',fontsize=14)\n",
" textstr2 = '\\n'.join((r'$ A = \\left|\\int^{+\\infty}_{-\\infty}sin(2\\pi t)e^{-2\\pi it}\\cdot e^{%.2f} dt\\right|$' % (freq, ),))\n",
Expand All @@ -187,6 +237,52 @@
"interactive_plot"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 400/400 [02:53<00:00, 2.30it/s]\n"
]
}
],
"source": [
"from tqdm import tqdm\n",
"n = 0\n",
"ft_line = np.empty(shape =(1,2))\n",
"def F(freq,t):\n",
" global ft_line\n",
" fig, (ax1, ax2) = plt.subplots(2, 1)\n",
" t = np.linspace(0, np.pi, num=1000)\n",
" ft = np.exp(2*np.pi*freq*1j*t) * np.sin(2*np.pi*t)\n",
" Amp = abs(ft.sum())\n",
" if ft_line.shape ==(1,2):\n",
" ft_line = np.array([[freq,Amp]])\n",
" ft_line = np.append(ft_line,np.array([[freq,Amp]]),axis=0)\n",
" ax1.plot(ft.real,ft.imag)\n",
" set_center_axis(ax1)\n",
" ax1.set_xlabel('real',position=(1,0),fontsize = 14)\n",
" ax1.set_ylabel('imag',position=(0,1),fontsize = 14)\n",
" ax1.set_aspect(1)\n",
" textstr = '\\n'.join((r'$sin(2\\pi t)e^{-2\\pi it}\\cdot e^{%.2f}$' % (freq, ),))\n",
" ax1.text(0.05,1.1,textstr,fontsize = 30)\n",
" ax2.scatter(ft_line[:,0],ft_line[:,1])\n",
" ax2.set_xlabel('$freq$',fontsize=14)\n",
" textstr2 = '\\n'.join((r'$ A = \\left|\\int^{+\\infty}_{-\\infty}sin(2\\pi t)e^{-2\\pi it}\\cdot e^{%.2f} dt\\right|$' % (freq, ),))\n",
" ax2.set_ylabel(textstr2,fontsize = 14)\n",
" global n\n",
" n += 1\n",
" plt.savefig('img/e_'+str(n)+'.png')\n",
" plt.close()\n",
" \n",
"for omega in tqdm(np.arange(-2,2,0.01)):\n",
" F(omega,1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
315 changes: 315 additions & 0 deletions build/doctrees/nbsphinx/src/FT_Interactive_animation_.ipynb

Large diffs are not rendered by default.

820 changes: 820 additions & 0 deletions build/doctrees/nbsphinx/src/FT_code.ipynb

Large diffs are not rendered by default.

315 changes: 315 additions & 0 deletions build/doctrees/nbsphinx/src/F_test.ipynb

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/doctrees/nbsphinx/src_FT_code_2_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/doctrees/nbsphinx/src_FT_code_3_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/doctrees/nbsphinx/src_F_test_3_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added build/doctrees/src/FT_code.doctree
Binary file not shown.
Binary file added build/doctrees/src/F_test.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0a342fd571fd48c8e0f0149659b3a936
config: c14f61d1e82ab4a58cbb0bbf18d3a4b8
tags: 645f666f9bcd5a90fca523b33c5a78b7

0 comments on commit 77ec545

Please sign in to comment.