Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
第2回「Python入門(1)」2023年11月6日資料
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
sasasa
November 05, 2023
Education
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
第2回「Python入門(1)」2023年11月6日資料
sasasa
November 05, 2023
More Decks by sasasa
See All by sasasa
第3回「Python入門(2)」2023年11月13日資料
hsasasasa
0
110
Other Decks in Education
See All in Education
未踏峰連山 Frontiers: Creating and Conquering Untrodden Peaks
ishii_mit
1
160
FA26 CLU MS Clinical Psychology New Student Orientation
jdbedics
0
170
形骸化しない社内勉強会の取り組み - オーナーシップの作り方 / In-house study session
soudai
PRO
1
310
One Year of Learning English with AI @エンジニア英語キャリア Meetup #3
kekekenta
0
250
El Clima de España. Tema 2 (PPT)
juanmartin2026
0
3.6k
Fundamentos, Caracteristicas y Aplicaciones de los Modulos NumPy , Matplotlib y Pandas
robintux
0
270
検定資格の価値 ~実はすごいよQC検定~
bunnchinn3
0
210
Soluciones al examen de Geografía 2026. JULIO (Convocatoria Extraordinaria)
juanmartin2026
1
20k
Carbohydrates: Classification, Structure & Chemical Properties
pawan_pharm
0
300
響け!ユーフォニアムと考える「決め方」/Thinking About Decision-Making with Sound! Euphonium
3l4l5
1
190
Book-keeping
bvr7352
0
120
Throw Yourself In! - How I've learned English and What I'm Facing
georgeorge
1
270
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
680
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Practical Orchestrator
shlominoach
192
12k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
490
Balancing Empowerment & Direction
lara
6
1.3k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Faster Mobile Websites
deanohume
310
32k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
340
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
720
Transcript
旭川高専デジタル人材育成講座 『Python入門(1)』 2023年11月6日(月) 笹岡久行(ささおか ひさゆき) 旭川工業高等専門学校 電気情報工学科 (ご注意)本資料は当該講座以外では個人の学習目的での利用可
はじめに
講師紹介(自己紹介) • ホームページから引用 (https://researchmap.jp/)
COMPASS 5.0事業「K-DASH」(AI・数理データサイエンス分野)
(文部科学省ホームページから引用)
旭川工業高等専門学校 デジタル人材育成事業
プログラミング言語「Python」とは?
Pythonって? ChatGPTの回答から
Pythonって?(続き) ChatGPTの回答から
Pythonって?(続き) Googleの検索結果(https://www.rd.ntt/se/media/article/0074.html)から
Pythonって?(続き) Googleの検索結果(https://www.internetacademy.jp/)から
プログラミング言語のシェア ホームページ(https://cmc-japan.co.jp/)から引用
None
「Python入門」講座について
本日の目的 1. Pythonの特徴を説明できる. 2. Pythonで簡単な計算できる. 3. Pythonで簡単なグラフを描くことができる.
Python入門の講座についてのお願い • 60分×4回のオンライン講義だけでは全てを修得するのは難しいです. • もし可能であれば,ぜひご自分でいろいろと試して,学んでください.
Pythonの教材 とても多くの無料で学べる教材があります.例えば, 1. 公式サイト https://www.python.org/ 2. 東京大学「Pythonプログラミング入門」 https://utokyo-ipp.github.io/ 3. 京都大学「プログラミング演習Python2021」https://repository.kulib.kyoto-
u.ac.jp/dspace/bitstream/2433/265459/1/Version2021_10_08_01.pdf 4. 東京工業大学「Python早見帳」https://chokkan.github.io/python/index.html 5. 筑波大学(三谷先生) https://mitani.cs.tsukuba.ac.jp/book_support/python/python_slides.pdf 6. さくらインターネット株式会社「初学者向けTellus学習コース」 https://tellusxdp.github.io/start-python-with-tellus/index.html など
「Python」を使ってみる!
Google「Colaboratory」https://colab.research.google.com/ WebブラウザでPythonのプログラミングが可能 もし,Googleのアカウントがあるとオンラインで成果の保存も可能
None
Pythonで簡単に四則演算ができます. 「+」...足し算 「-」...引き算 「*」(アスタリスク)...掛け算 「/」(スラッシュ)...割り算 「%」・・・剰余(割り算の余り)を求める 「**」・・・累乗(n乗)
計算例
問題1「0.1 + 0.1 + 0.1」の答えは? セル(四角の中)へ式を入力し,「Enter」キーを押す.
(ご参考)丸め誤差とは IT用語辞典(https://e-words.jp/)から引用
(ご参考)丸め誤差を防ぐ方法(chatGPTの回答) いくつか方法を示してくれるので,ぜひ自分で真偽を確かめてみてください.
2次方程式を解いてみる!
ルート(平方根)の計算 mathライブラリにある「sqrt」を利用します. ※ライブラリとは,既にプログラミングされているもの これを読み込むために,初回のみ「import」文を使います.
2次方程式の解の公式 xを求めたい時,a, b, cはそれぞれの方程式の係数もしくは定数項
Pythonに2次方程式を解いてもらう • セルの中に入力し,実行 ◦ 「#」はコメントなので,入力の必要はありません。 「import」や「if」はPythonの命令です。 今回はそのまま入力してください。
答え
問題2 解は?(もし時間があれば...) • 例題のプログラムを参考にして,a, b, cの値(「変数」)を変更し,結果を確認 してください。 (1) x2 +
32x + 255 = 0 (2) 5x2 + 2x + 15 = 0 • もし時間がなければ,すみませんが,各自確認してみてください. ◦ プログラムは,後日,ホームページにおいておきます.
簡単なグラフを書いてみよう!
お願い • 繰り返し,データ構造やライブラリについてはよくわからないと思います. 今回は,サンプルを参考にしてみてください. • サンプルを書き換え,グラフが描けることをご確認ください. • 今回利用するライブラリの詳細な説明は下記URLのホームページや各種書籍 などを参考にしてください. 「matplotlib」ホームページ
https://matplotlib.org/ • (ご参考)さくらインターネット株式会社『初心者向けTellus学習コース』 「Matplotlibの使い方」 https://tellusxdp.github.io/start-python-with-tellus/lesson3.html
(ご参考)ライブラリについて • 有名なライブラリ ◦ 「matplotlib」:グラフを描いたり,データを可視化する時によく使うライブラリ https://matplotlib.org/ ◦ 「pandas」:データ解析を行う時によく使うライブラリ https://pandas.pydata.org/ ◦
「scikit-learn」:機械学習の有名なアルゴリズムが組み込まれたライブラリ https://scikit-learn.org/ ◦ 「NumPy」:高速に大規模な計算を行う時によく使うライブラリ https://www.numpy.org/
準備 • 関数のグラフを描いてみよう。 ◦ 指数関数や2次関数 などの数学の授業で習った関数を描かせてみよう。 一度だけ入力し,実行してください。(何も結果は表示されなければOK)
グラフを書いてみよう!(1) 『 y = x 』のグラフ ↓ 行番号は無視してください。 3行目で「y =
x」の「x」の部分を定義 (難)5行目 xが取る範囲を定義 (難)6行目 グラフを描く範囲を定義 (難)7行目 x, yの座標に点をプロット (難)8行目 補助線(灰色の線)を表示
グラフを書いてみよう!(2) 『 y = x 2』のグラフ ↓ 行番号は無視してください。 3行目で「y =
x2」の「 x2 」の部分を定義 (Pythonでは「**」で◯乗を意味します。)
問題3 グラフを描いてみよう(もし時間があれば...) • 例題のプログラムを参考にして,グラフを確認してください。 (1) y = 5x + 3
(ただし,x は -10 から 10の範囲) (2) y = x2 -4x + 3 (ただし,x は -5 から 5 の範囲) ...演習2での2次方程式の例題 • もし時間がなければ,すみませんが,各自確認してみてください. ◦ プログラムは,後日,ホームページにおいておきます.
まとめ
今回,学んだこと 1. Pythonとは? 2. Pythonを使って簡単な計算をする方法 3. Pythonを使って簡単なグラフを描く方法 • Pythonを使いこなせるともっと多くの楽しいことができます。 •
ぜひ,勉強はもっと続けてください。 ◦ 腕に自身がある方はKaggle等への参加も検討してみてください。 ◦ Kaggle ホームページ https://www.kaggle.com/ • もしご都合がつくようであれば,この後の講座も受講してください. (ご注意)本資料は当該講座以外では個人の学習目的での利用可