ねこでじ(Nekodigi)

Nekodigi’s diary

学習中の気づきをまとめています。応援よろしくお願いします

【おすすめ】本当に参考になったYouTubeチャンネルまとめ!

まとめ

今回は、今まで参考にしてきたYouTubeチャンネルをまとめてみました。

シュミレーション

こーじ 【人工知能
www.youtube.com
人工知能物理エンジンを組み合わせて、バーチャルロボットを動かしているチャンネルです。
物理エンジンくん 【物理エンジン
www.youtube.com
物理エンジンでアニメなどのシーンを検証する動画が多くありましたが、最近はハイレベルな内容を分かりやすく解説しています。

科学全般

Kruzgesagt 【科学+哲学】
www.youtube.com
世界最大の教育系チャンネルです。映像のクオリティも高く映画のように楽しめます。
3Blur1Brown 【数学】
www.youtube.com
高度な内容を解説していますが、視覚化されているので分かりやすいです。

ビジネス

中田のYoutube大学 【ビジネス】
www.youtube.com
ビジネス以外でもいろいろなジャンルで投稿があります。どの動画も説得力があり分かりやすいです。

コーディング

The Coding Train 【アルゴリズム
www.youtube.com
私がアルゴリズムについて学ぶきっかけになったチャンネルです。ホワイトボードを使った解説が分かりやすいです。
Sebastian Lague 【ハイレベルアルゴリズム
www.youtube.com
非常に完成度の高く、解説も分かりやすいです。しかし、それ以上に内容が高度です。

おわりに

今回は、クオリティの高いチャンネルに厳選してまとめました。
ぜひとも、一度チャンネルをチェックしてみてください!

【PC Building】Build an amazing Ryzen 9 water cooling PC.

Abstract

Final result

f:id:Nekodigi:20201228114711j:plain
I bought the BTO PC 4 years ago. However, I wanted to upgrade and customize so I build a new PC. First I decided to build an air cooling PC but AM5 might be strong so I used the money for cooling.
I live in Japan but the German water cooling maker is good and it's expensive in Japan so personally imported it.

All parts

f:id:Nekodigi:20201228094313j:plain

Spec

CPU 16C/32T/3.5GHz(full)/4.7GHz(turbo)
GPU Quadro M2000 + RTX 3080
SSD 1TB Gen3 + 1TB Gen4
HDD 10TB
RAM 64GB/3200MHz
M/B X570 Taichi
FAN Dynamic X2(116.2m³/h) x3 + Noctua 3000(269.3m³/h) x6
Pump EK-Quantam Kinetic(1000L/h/5.2m)
Radiator NexXxoS UT60 420mm

Parts

Main parts

f:id:Nekodigi:20201228095504j:plain

Memory-Trident Z Neo 32GBx2

f:id:Nekodigi:20201228095753j:plain
Trident Z is good for Ryzen and it has beautiful LED

GPU-Palit RTX 3080

f:id:Nekodigi:20201228095802j:plain
Palit GPU is cheeper than ZOTAC but sync might not works.

PSU-RM850

f:id:Nekodigi:20201228100145j:plain

Ryzen 3950

f:id:Nekodigi:20201228100457j:plain
Ryzen 5000 released but it's too expensive, and AM5 will be strong so I chose 3950.

PG4NVZ 1TB

f:id:Nekodigi:20201228100726j:plain
It's cheaper than Samsung and faster.

BarraCuda 8TB

f:id:Nekodigi:20201228102628j:plain

X570 Taichi

f:id:Nekodigi:20201228102909j:plain
It has wifi, bluetooth and more port.

Carryover parts

Seagate 2TB HDD
Quadro M2000
970 EVO

Water cooling parts

f:id:Nekodigi:20201228103416j:plain

Noctua A14 IndustrialPPC 3000

f:id:Nekodigi:20201228103455j:plain
It's one of the most powerful fans in the world.

Fitting

f:id:Nekodigi:20201228103857j:plain
f:id:Nekodigi:20201228103842j:plain
I chose fittings that both ends join tubes by mistake. It was an awful mistake I made.

Flowmeter

f:id:Nekodigi:20201228103815j:plain
Sadly I couldn't use it because I don't have enough fitting because of that mistake.

Fan hub

f:id:Nekodigi:20201228105050j:plain

NexXxoS UT60 420

f:id:Nekodigi:20201228104213j:plain
It's so powerful radiator.

Eisblock XPX Aurora Plexi RGB

f:id:Nekodigi:20201228104430j:plain
So beautiful water block.

EK-Quantum Kinetic 160 DCC D-RGB

f:id:Nekodigi:20201228104746j:plain
Powerful pump incruded in it and beautiful.

Making

Main

f:id:Nekodigi:20201228105212j:plain
Mounting the CPU was very easy and no force needed.
f:id:Nekodigi:20201228105224j:plain
Mounting the RAM need force.
f:id:Nekodigi:20201228105227j:plain
f:id:Nekodigi:20201228105315j:plain
Unmounting the heatsink is a little difficult. Then I will mount SSD.
f:id:Nekodigi:20201228105818j:plain
Mount GPU, cooling parts (make sure CPU grease), and place M/B to the PC case. Then let's test it. I use WS 2818 for lightning if you interested in this please watch this and source code.
www.youtube.com

Water-cooling

Water-cooling is very powerful if you build it wisely.
f:id:Nekodigi:20201228110551j:plain
f:id:Nekodigi:20201228110624j:plain
A big radiator like this will overwhelm air cooling. I tried to make a fan sandwich but maybe it's enough to place one side. Then connect tubes and test it 24 hours. In my case, the pump needs to be connected to PSU, M/B, and M/B should be turned on.
f:id:Nekodigi:20201228113028j:plain
I found the tube bent so I fixed it with tegus. Have a good water cooling day :)

【Cities Skylines】The first megapolis and monument!!

Abstract

f:id:Nekodigi:20201227231807p:plain
I epic games store has a free game sale but I missed it. I always wanted cities skylines so I bought it. I played it 4 days throughout and I finally could make megapolis!
f:id:Nekodigi:20201227231913p:plain
In addition, I could get the first monument (Space elevator).
f:id:Nekodigi:20201227231950p:plain

Strategy and tips

Use highways

Using highways and one-way roads is a good way to solve traffic jams. By the way, I didn't know highways should be connected to both the up line and the down line it took several minutes to understand.

Refine before making it bigger

If I make a city bigger I will face more problems, so it's important to refine the city before. In addition, if time passes in a good environment the building will level up and capacity increase and profitable.

Adjust budget and taxes

Especially, the water system is too overpowering in the early stage so I reduce the budget. And it's also good for emergencies like death wave. Increasing the budget can be a good solver.

Make a good intersection and use public transportation.

Traffic jam is fatal especially industry and commercial area and most of the times traffic jams come from intersections. Therefore, making good intersections like template intersection or making a bypass is good. In addition metro, train and other public transportation are good to solve traffic jam.

district

Making districts is good when planning a city. In addition, we can make districts that utilize natural resources.

【PC Building】Aquatuning.jpから個人輸入した感想

概要

個人輸入は初めてでとても不安だったのですが、非常にうまくいきました。飛行機で来るかと思いきや、船できたのでとても焦りましたが、2~3週間ほどで届きました。なんと今回液体が入っていたのにもかかわらず、関税はかからず消費税のみでした。どちらのしても着払いなのは注意です。てっきり税関で足止めされていたのかと思っていましたが、スムーズに通っていたようです。
f:id:Nekodigi:20201227142608j:plain

【Processing】Newton Fractal given Solutions

Abstract

www.youtube.com
Newton-Raphson's method is a method to solve an equation recursively. In addition, when we visualize it we can get an amazing fractal so I made a program that can generate fractal given point (or
complex number solution)

How it works

Generate an equation from solutions

The equation given solutions is like (x-a)(x-b)...=0. (a,b...are solution) What I should do is just calculate the coefficients of that equation. To do that I implemented multiplication of formula. This is the source code that calculate coefficients from solutions.
gist.github.com

Generate a Newton Fractal from an equation

Newton's iteration is here so I calculated differential of that coefficient.
{\displaystyle z_{n+1}:=z_{n}-{\frac {p(z_{n})}{p'(z_{n})}}}
gist.github.com
Finally, I visualized the number of iteration to get solutions and solutions.

Source code

I named as Newton Rapshon Fractal given Solutions.
github.com

【Processing】Implement 2D FFT and 2D IFFT and Gaussian blur with them. (Cooley-Tukey Algorithm)

Abstract

f:id:Nekodigi:20201226162428g:plain
I found that I could extend the FFT(Cooley Tukey Algorithm) easily to two dimensions so I implemented it immediately.I can convert an image to frequency data and I can get the original image from the frequency data with IFFT. It is often used for data compression and blur.Usually, the calculation time for Gaussian blur increases exponentially depending on its size. However, it takes the same time if even it's big if I use FFT.

How it works

1D FFT and IFFT

This algorithm based on the 1D FFT and IFFT (Cooley-Tukey algorithm). Please refer to these sites and codes for that.
Cooley–Tukey FFT algorithm - Wikipedia
github.com
for IFFT.
Cooley–Tukey Fast Fourier Transform algorithm - Recursive Divide and Conquer implementation in C++ · GitHub

2D FFT and IFFT using 1D ones.

Roughly speaking, we can get 2D FFT by calculating FFT for each direction. I implement it by doing 1D FFT for each row and for each column.

Gaussian blur

I Fourier transforms the original image. Then I make a Gaussian kernel and Fourier transforms it. I multiply and inverse Fourier transforms them and I can get a Gaussian blurred image. Finally, shift image by FFT shift we can get the final result.
based on this site
Simple image blur by convolution with a Gaussian kernel — Scipy lecture notes

Source code

I added it as Cooley Tukey 2D FFT.
github.com

【Processing】FFTをきちんと実装する。

成果物

f:id:Nekodigi:20201215163003g:plain
今まではFFTの仕組みがよく分かっておらず、見つけたものをそのまま使っていたのですが、WikipediaのCooley-Tukey-algorithmというFFTアルゴリズムが思いのほか分かりやすかったのでそれをもとに実装してみました。分かりやすさを重視したので速度は遅めですが、工夫すれば軽量化できます。

仕組み

複素数の計算が少々大変ですが、今回のアルゴリズムの中心部はこんなにもシンプルです。偶数部と奇数部に分けて計算し、組み合わせることで求めることができます。
gist.github.com
参考にしたサイト。
Cooley–Tukey FFT algorithm - Wikipedia
Wikipediaの疑似コードは少し癖があるので、こちらのコードを参考に作成しました。
github.com

コード

先ほどのメインのコードに複素数計算やMinimなどを追加したものです。マイク入力に反応して動きます。
Cooley_Tukey_FFTという名前で追加しています。
github.com

【Processing】MIDI入力をスピーカーで再生する。

概要

電子ピアノからMIDI入力すると、Virtual Midi Synthなどに転送されて音が出ます。単純にMIDI入力をそのまま出力しているだけなので、シンプルです。環境によっては遅延も少ないかもしれません。

コード

Virtual Midi Synthはここからダウンロードできます。
VirtualMIDISynth | CoolSoft
サウンドフォントを自由に入れることができるので便利です。
Processingのコードはこちらです。inputを入力デバイスの番号、outputをVirtual Midi Synthなどに割り当ててください。
gist.github.com

【Processing×Arduino】WS2812Bを使って音に合わせてPCをライティングする。

成果物

固定

www.youtube.com
新しいマザーボードのTaichiにはLEDコントローラーが付いているのはいるのですが、長さが2Mまでという制約が気に入らないので、より良いカスタマイズ性を求めてArduinoでコントロールすることにしました。

音と同期

www.youtube.com
Processingと組み合わせて音と同期させることもできます。

仕組み

Arduinoの制御は基本的には前回と同じですが、シリアル通信でON/OFFと強さがかえられるようにしました。また、色の変化と、光の強さをそれぞれ2つのパラメータで変えられるように改良しました。
nekodigi.hatenablog.com
Processing側では、マイク入力を元にシリアル信号を送り明るさをコントロールできるようにしました。

コード

gist.github.com

【修理】Kraken 7.1 V2をマグネットUSBに!もう断線しない!

成果物

f:id:Nekodigi:20201210210923j:plain
度々躓いたためかなりの頻度で断線して1年以上しまい込まれていたKraken 7.1 V2ですが、マグネット式USBを組み合わせて修理することで、断線が防げるようになりました。

仕組み

パーツ編

今回修理するにあたって使用したのはこちらの製品です。

マグネット式USBはデータ通信ができないことが多いのですが、これはきちんと通信をすることができます。また、もともとのRazerのケーブルと似ていて、マグネットの強さも程よいです。
ただし、端子Micro USBなのでヘッドホンにコネクタを装着する必要があります。コネクタ単体を買ってもいいのですが、ケーブルを分解して使う方が強度が強そうだったのでそちらにしました。また、端子とコネクタどちらも手に入るのでお得です。

手順編

こちらのサイトの通りに分解します。
www.youtube.com
次に変換名人とKrakenのUSBケーブルをはんだ付け分の長さを残して切ります。最後に以下のサイトを参考に接続します。(ほかにも線はありますが4本だけ繋げばよさそうです)
discover.hubpages.com
最後にふたを閉めます(ケーブルを閉めるときにケーブルを挟むようにすると固定もでき一石二鳥です。)

【レビュー】Define 7 XLを使ってみた!

結果

f:id:Nekodigi:20201204220407j:plain
140mmファンで冷やしたい都合上420mmを将来的に導入する可能性が出てきたので、王道Defineのフルタワーケースを買いました。光り物のパーツが多かったので側面は黒いガラスにしました。(LEDテープをMAXで照らしても眩しさが軽減されていてきれいです)上品な見た目になってよかったです。

組み立てまでの流れ

f:id:Nekodigi:20201204224425j:plain

デカい!重い!

以前のケースは中身が入っても8kgだったのに、こちらは空の状態で20kgもあります(笑)
f:id:Nekodigi:20201204224508j:plain
側面にも大きなロゴが
f:id:Nekodigi:20201204224519j:plain
後ろにも細かな説明が書かれています。
f:id:Nekodigi:20201204224630j:plain
箱を開けるとおぞましい量のロゴが( ゚Д゚)
付属品とケースに分かれています。(ほとんどのものは、あらかじめケースについています)
f:id:Nekodigi:20201204224857j:plain
付属品はこんな感じです、取付金具と、上面にファンを取り付ける場合の交換用プレートが入っています。埃が入りそうですが、ケースに網状フィルターが付いているので大丈夫です。
f:id:Nekodigi:20201204225126j:plain
さらにその下には、5インチドライブカバーとねじ類が入っていました。ガラス拭きが入っていたのが地味にうれしかったです。
f:id:Nekodigi:20201204225255j:plain
比べておいてみましたがやっぱり大きい…
f:id:Nekodigi:20201204225458j:plain
電源はスライドさせて入れる感じです。すっきりしてます。
f:id:Nekodigi:20201204225455j:plain
このケースのいいところは何と言っても裏配線で、非常にコンパクトに収めることができます。
f:id:Nekodigi:20201204225856j:plain
ケースが大きくなったので、GPUのサポートを付けられるようになりました。と言いつつねじに干渉するので内側につけてます(アクリル板の厚みが原因です)

【Monopoly Plus】まだVery Easyだけれど、AIに14分で勝った話

成果物

f:id:Nekodigi:20201204215546p:plain
資産管理について学ぶ一環として、Monopolyをやってみました(一応リアルでも口座開設に向けて準備中)資産管理のWebサイト的なものを作っているのでそれもでき次第発表します。20年前のMonopolyをやろうと思ったのですが、CDドライブを取り付けるのが面倒だったので、最近出たMonopoly Plusを購入しました。発売されてすぐなのか60%Offになっているので今が一番の買い時です。

戦略

オレンジ、赤のマスは刑務所との位置関係上最も止まりやすいマスなので、そこにホテルを建てることで勝利しました。金欠などの場合はブラウンやライトブルーがコスパがいいのでおすすめです。また、交渉を使って土地を手に入れたりお金を手に入れることができるので、それを何回も活用しました。特にVery EasyのAIは優しいので、ほぼ間違いなく利益が出ます。

【Processing】雷のような模様を超高速で生成!Laplacian Growthを実装する。

成果物


【Processing】Laplacian Growth Animation
今回は、放電した時などに現れるパターンを生成するLaplacianGrowthを実装してみました。DLAに似た結果を生み出せるアルゴリズムですが、圧倒的に早く計算できます。
f:id:Nekodigi:20201204214553p:plain
その後、しばらく放置したら凄いことになっていました( ゚Д゚)

仕組み

今回は、こちらの論文をもとにしています。周りの候補地との距離情報などをうまく使っていました。
http://gamma.cs.unc.edu/FRAC/laplacian_large.pdf
しかし、コードに落とし込むには少し難しかったので、こちらのRustでの実装をもとに再現しました。
GitHub - ryukau/lightning_rust: Implementation of "Fast Simulation of Laplacian Growth" by Kim, Sewall, Sud and Lin.
論文では与えた形のとうりに成長させるなど、より高度な内容をしていたので、今後詳しく調べていきたいです。

コード

Laplacian Growthという名前で追加しています。
github.com

【Processing】Calabi Yau多様体を動かす。

成果物


【Processing】Calabi Yau Formatted Animation
Calabi Yau多様体超弦理論などで出てくる次元を畳み込んだものなのですが、非常に美しいのでぜひ作りたいと思って調べてみました。また4つの数値を三角関数ブレンドして3次元に落とし込んでいるので、パラメータを変えると動きます。

仕組み

英語のサイトを元にした、こちらの記事がわかりやすいです。
analyticphysics.com
sw1227.hatenablog.com
具体的な数式は紹介されていますが、複素数の計算の実装は自力で行う必要があります。それそれの計算には以下のサイトなどを参考にしました。
sin(z)
Sine - Wikipedia
cos(z)
Trigonometry/Functions of complex variables - Wikibooks, open books for an open world
exp(z)
Complex Exponentiation -- from Wolfram MathWorld

コード

gist.github.com

【Processing】あるxでの三次ベジェ曲線のyの値を三次方程式を使って全て求める。

成果物

f:id:Nekodigi:20201204190547g:plain
前回三次方程式の解を全て求めるプログラムを作ったので、今回はそれを三次ベジェ曲線に使ってみました。

成果物

3次ベジェ曲線はtについての3次方程式の形で表すことができます。方程式をといてtを求めます(実数解のみ採用)そして、そのtをベジェ曲線の式に代入すればyが求められます。
Bézier curve - Wikipedia

コード

Cubic Bezier given Xを改良する形で追加しています。
github.com