diff --git a/SasamuraTatsuki/.ipynb_checkpoints/SasamuraTatsuki-checkpoint.ipynb b/SasamuraTatsuki/.ipynb_checkpoints/SasamuraTatsuki-checkpoint.ipynb new file mode 100644 index 0000000..556bd8e --- /dev/null +++ b/SasamuraTatsuki/.ipynb_checkpoints/SasamuraTatsuki-checkpoint.ipynb @@ -0,0 +1,224 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題1\n", + "assign1 = list(range(1,10+1))\n", + "assign1" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[2, 4, 6, 8, 10]" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題2\n", + "assign2 = [i for i in assign1 if i%2==0]\n", + "assign2" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f'}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題3\n", + "list_char = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]\n", + "assign3 = {i:list_char[i] for i in range(len(list_char))}\n", + "assign3" + ] + }, + { + "cell_type": "code", + "execution_count": 128, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "h1 名前:山田 年齢:23歳 性別:男 身長:170.3cm 体重:60.2kg\n", + "h2 名前:高橋 年齢:30歳 性別:女 身長:165.2cm 体重:46.2kg\n", + "------------------------\n", + "h1の年齢をインクリメント\n", + "h1 名前:山田 年齢:24歳 性別:男 身長:170.3cm 体重:60.2kg\n", + "------------------------\n", + "Human.get_count() = 2\n" + ] + } + ], + "source": [ + "#課題4\n", + "class Human:\n", + " __cnt = 0\n", + " def __init__(self,name,age,sex,height,weight):\n", + " Human.__cnt +=1\n", + " self.name = name\n", + " self.age = age\n", + " self.sex = sex\n", + " self.height = height\n", + " self.weight = weight\n", + " def increment_age(self):\n", + " self.age += 1\n", + " @classmethod\n", + " def get_count(cls):\n", + " return cls.__cnt\n", + " def __repr__(self):\n", + " return \"名前:%s 年齢:%d歳 性別:%s 身長:%.1fcm 体重:%.1fkg\"%(self.name,self.age,self.sex,self.height,self.weight)\n", + " \n", + "h1 = Human(name = \"山田\", age = 23,sex = '男', height = 170.3, weight = 60.2)\n", + "h2 = Human(name = \"高橋\", age = 30,sex = '女', height = 165.2, weight = 46.2)\n", + "\n", + "print(\"h1 %s\"%h1)\n", + "print(\"h2 %s\"%h2)\n", + "\n", + "print(\"------------------------\")\n", + "print(\"h1の年齢をインクリメント\")\n", + "h1.increment_age()\n", + "\n", + "print(\"h1 %s\"%h1)\n", + "print(\"------------------------\")\n", + "print(\"Human.get_count() = %d\"%Human.get_count())" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 3., 4.],\n", + " [ 7., 8.]])" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題5\n", + "import numpy as np\n", + "#行列A,Bを初期化\n", + "A = np.array([\n", + " [1.,2.],\n", + " [3.,4.]\n", + "])\n", + "B = np.array([\n", + " [1.,0.],\n", + " [1.,2.]\n", + "])\n", + "#AとBの積を計算\n", + "A.dot(B)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.59999999999999998" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題6\n", + "#ベクトルa,bを初期化\n", + "a = np.array([3.,4.])\n", + "b = np.array([5.,0.])\n", + "#aとbの内積/(aの大きさ*bの大きさ) = cos を計算\n", + "a.dot(b)/(np.linalg.norm(a)*np.linalg.norm(b))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/SasamuraTatsuki/README.md b/SasamuraTatsuki/README.md new file mode 100644 index 0000000..4db05b1 --- /dev/null +++ b/SasamuraTatsuki/README.md @@ -0,0 +1,11 @@ +## 名前 +笹村樹生 +## 大学名 +東京大学 +## 専攻 +精密工学科 +## 今までの開発経験 +全国高等専門学校ロボットコンテストで5年間アセンブリとC言語でロボット制御のプログラムを開発しました。 +現在は競馬の予測アルゴリズムなどを機械学習を用いてpythonで実装しています。 +## 中期的な目標 +脳波や筋電などの生体信号をリアルタイムに解析するブレインマシンインターフェイスを作りたいです。 \ No newline at end of file diff --git a/SasamuraTatsuki/SasamuraTatsuki.ipynb b/SasamuraTatsuki/SasamuraTatsuki.ipynb new file mode 100644 index 0000000..556bd8e --- /dev/null +++ b/SasamuraTatsuki/SasamuraTatsuki.ipynb @@ -0,0 +1,224 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題1\n", + "assign1 = list(range(1,10+1))\n", + "assign1" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[2, 4, 6, 8, 10]" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題2\n", + "assign2 = [i for i in assign1 if i%2==0]\n", + "assign2" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f'}" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題3\n", + "list_char = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"]\n", + "assign3 = {i:list_char[i] for i in range(len(list_char))}\n", + "assign3" + ] + }, + { + "cell_type": "code", + "execution_count": 128, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "h1 名前:山田 年齢:23歳 性別:男 身長:170.3cm 体重:60.2kg\n", + "h2 名前:高橋 年齢:30歳 性別:女 身長:165.2cm 体重:46.2kg\n", + "------------------------\n", + "h1の年齢をインクリメント\n", + "h1 名前:山田 年齢:24歳 性別:男 身長:170.3cm 体重:60.2kg\n", + "------------------------\n", + "Human.get_count() = 2\n" + ] + } + ], + "source": [ + "#課題4\n", + "class Human:\n", + " __cnt = 0\n", + " def __init__(self,name,age,sex,height,weight):\n", + " Human.__cnt +=1\n", + " self.name = name\n", + " self.age = age\n", + " self.sex = sex\n", + " self.height = height\n", + " self.weight = weight\n", + " def increment_age(self):\n", + " self.age += 1\n", + " @classmethod\n", + " def get_count(cls):\n", + " return cls.__cnt\n", + " def __repr__(self):\n", + " return \"名前:%s 年齢:%d歳 性別:%s 身長:%.1fcm 体重:%.1fkg\"%(self.name,self.age,self.sex,self.height,self.weight)\n", + " \n", + "h1 = Human(name = \"山田\", age = 23,sex = '男', height = 170.3, weight = 60.2)\n", + "h2 = Human(name = \"高橋\", age = 30,sex = '女', height = 165.2, weight = 46.2)\n", + "\n", + "print(\"h1 %s\"%h1)\n", + "print(\"h2 %s\"%h2)\n", + "\n", + "print(\"------------------------\")\n", + "print(\"h1の年齢をインクリメント\")\n", + "h1.increment_age()\n", + "\n", + "print(\"h1 %s\"%h1)\n", + "print(\"------------------------\")\n", + "print(\"Human.get_count() = %d\"%Human.get_count())" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 3., 4.],\n", + " [ 7., 8.]])" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題5\n", + "import numpy as np\n", + "#行列A,Bを初期化\n", + "A = np.array([\n", + " [1.,2.],\n", + " [3.,4.]\n", + "])\n", + "B = np.array([\n", + " [1.,0.],\n", + " [1.,2.]\n", + "])\n", + "#AとBの積を計算\n", + "A.dot(B)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.59999999999999998" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#課題6\n", + "#ベクトルa,bを初期化\n", + "a = np.array([3.,4.])\n", + "b = np.array([5.,0.])\n", + "#aとbの内積/(aの大きさ*bの大きさ) = cos を計算\n", + "a.dot(b)/(np.linalg.norm(a)*np.linalg.norm(b))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.0" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}