Posts

Difference between Type Stack (S) and Type Queue (Q)

Image
Difference between Type Stack (S) and Type Queue (Q) In this post, I explore the relationship between two learning types—Stack (S) and Queue (Q)—and their outcomes. Here, “Stack” and “Queue” are programming-inspired metaphors: S-type persons learn in a stack-like way, relying on memory, while Q-type persons learn in a queue-like way, relying on an internal image generator. In terms of abstraction, Learning Type (S or Q) is a higher-level concept, Integrated Learning Result is a mid-level concept, and Learning Result is a lower-level concept. For example, we might consider trust as an integrated learning result (a form of social capital), while money can be seen as a measurable outcome derived from that trust. In my code, the parameter b = 0.9 is introduced as an initial-condition bias, reflecting the influence of family inheritance and economic background. The horizontal axis is scaled so that x = 1.0 corresponds to 10 years of life, a scale derived from empirical observation...

To Functional Programming with Python

 To Functional Programming with Python I rewrote the previous code to below as functional Python. Gemini(Google AI) helped me, and it taught me important things. To convert from procedural to functional is difficult for me. The convertion needs a lot of my brain resouces. So from the beginning, I will try to functional programinng with Python... import numpy as np import matplotlib.pyplot as plt # データ生成 x = np.linspace(-3.15, 3.15, 100) def plot_waves(x, wave_func, title): """ 指定された関数に基づいて複数の波を生成し、描画する関数。 Args: x (np.array): x軸のデータ。 wave_func (function): 使用する波の関数 (np.sin または np.cos)。 title (str): グラフのタイトル。 """ plt.figure(figsize=(8, 6)) base_wave = wave_func(x) # 振幅を半分にし、正負を反転させて波を生成 current_wave = base_wave for i in range(10): if i % 2 == 0: # 偶数番目:...

Sin Waves and Cos Waves

Image
 Sin Waves and Cos Waves I wrote some code about Sin waves and Cos waves. I hope you can enjoy this figures. import numpy as np import matplotlib.pyplot as plt # データ生成 x = np.linspace(-3.15, 3.15, 100) y1 = np.sin(x) y2 = -y1 y3 = y1 / 2 y4 = - y3 y5 = y3 / 2 y6 = -y5 y7 = y5 / 2 y8 = -y7 y9 = y7 / 2 y10 = -y9 # グラフ描画 plt.figure(figsize=(8, 6)) plt.plot(x, y1) plt.plot(x, y2) plt.plot(x, y3) plt.plot(x, y4) plt.plot(x, y5) plt.plot(x, y6) plt.plot(x, y7) plt.plot(x, y8) plt.plot(x, y9) plt.plot(x, y10) plt.xlabel("x") plt.ylabel("y") plt.title("Sin Waves") plt.legend() plt.grid(True) plt.show() # データ生成 x = np.linspace(-3.15, 3.15, 100) y1 = np.cos(x) y2 = -y1 y3 = y1 / 2 y4 = - y3 y5 = y3 / 2 y6 = -y5 y7 = y5 / 2 y8 = -y7 y9 = y7 / 2 y10 = -y9 ...

Learning Methods and Result Curves

Image
 Learning Methods and Result Curves I sometimes think about learning methods, Stuck(S) and Que(Q). S tends to learn as y = 1.3X Q tends to learn as y = X**1.3 This difference shows short term winning for S, but if Q survives, Q wins for long term. import numpy as np import matplotlib.pyplot as plt # データ生成 x = np.linspace(0, 5, 100) y1 = 1.3 * x y2 = x ** 1.3 # グラフ描画 plt.figure(figsize=(8, 6)) plt.plot(x, y1, label=r"$y = 1.3x$") plt.plot(x, y2, label=r"$y = x^{1.3}$") plt.xlabel("x") plt.ylabel("y") plt.title("Comparison") plt.legend() plt.grid(True) plt.show()

First Python Note: Why I Started TKGwithPython

 On this blog("TKG with Python"), I will write about what I thought with Python. print("Hello, world!\nThis is TKG!")