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

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.

These assumptions are illustrative and model-specific; they are not claims about individuals, but a way to explore how initial conditions can shape long-term learning dynamics.

The graphs below suggest that the difference in integrated learning results between S and Q converges to zero around x = 7 (≈ age 70), implying that long-term outcomes may balance out despite early differences.


    import numpy as np
    import matplotlib.pyplot as plt
    
    # データ生成
    x = np.linspace(0, 8, 100)
    
    def generate_line_data(x, a, b):
        """
        線形データを生成する純粋関数
        """
        return x * a + b
    
    def generate_exp_data(x, c, d):
        """
        指数データを生成する純粋関数
        """
        return x ** c + d
    
    def integrated_line_data(x, a, b):
        return (a / (1 + 1)) * x ** (1 + 1) + x * b
    
    def integrated_exp_data(x, c, d):
        return (1 / (c + 1)) * x ** (c + 1) + x * d
    
    def plot_data(x, y1, y2, title, name1, name2):
        """
        データをプロットする関数 (副作用あり)
        """
        plt.figure(figsize=(8, 6))
        plt.plot(x, y1, label=f'{name1}')
        plt.plot(x, y2, label=f'{name2}')
    
        plt.xlabel("x")
        plt.ylabel("y")
        plt.title(title)
        plt.legend()
        plt.grid(True)
        plt.show()
    
    # データの生成(純粋関数)
    y_s = generate_line_data(x, 1.3, 0.9)
    y_q = generate_exp_data(x, 1.3, 0)
    
    # グラフ描画
    plot_data(x, y_s, y_q, "Learning Results", "Type S", "Type Q")
    
    # データの生成(純粋関数)
    integrated_y_s = integrated_line_data(x, 1.3, 0.9)
    integrated_y_q = integrated_exp_data(x, 1.3, 0)
    
    # グラフ描画
    plot_data(x, integrated_y_s, integrated_y_q, "Integrated Learning Curves", "Intecrated Type S", "Integrated Type Q")
    
    # データの生成(純粋関数)
    difference_y_s_y_q = y_q - y_s
    difference_integrated_y_s_y_q = integrated_y_q - integrated_y_s
    
    # グラフの描画
    plot_data(x, difference_y_s_y_q, difference_integrated_y_s_y_q, "Difference", "Type Q - Type S", "Integrated Type Q - Integrated Type S" )

Popular posts from this blog

Sin Waves and Cos Waves