Saturday, April 15, 2023

Nothing to be afraid of the Artificial Intelligence (AI)

I always wonder why people tend to be afraid of the AI so much. It sounds just a resemblance to those industrial workers kicked out of their factory job when a new machinery was introduced during the industrial revolution. I actually believe that the further AI development will rather make humanity thrive instead of being destroyed.

I have realised that people in general tend to overestimate the artificial intelligence (AI) because of what the media agitate. The AI is just an application whose capacity really depends on the underneath structure, the infrastructure and the platform. Well, there is no worry to be afraid of the AI taking over humans. The AI is more intelligent for some field but not all the fields which humans are familiar with. 



Moreover, the neuron network of the AI and the humans are completely different. The brain cells and the nerves of humans and the majority natural creatures are interrelated with the other organs of their body. For instance, gut heavily influences their thought process and mindset. In contrast, the AI thought process and neuron networks are self-contained inside their CPI and memory.

Sunday, April 09, 2023

Brownian Motion -> Wiener Process -> Ito Process

This is the mathematical and statistical model referring to a physics theory. Originally, this was invented to predict the randomly floating atoms' movement. This is applied to financial modelling to predict the random walk movement of stock prices. 

Wiener process is derived from the model of Brownian motion to take an account of the variance varying differently from Brownian motion. The popular model is Ito Process invented by Prof. Kiyoshi Ito, Japanese mathematician, which is the derivation of Wiener process. 
 
Ito-Process is more practical to explain in the financial market modelling because the future expected prices of financial assets often drift away from the current point. 

The equation introduced here shows the differential of the variable in the time series. The drift coefficient denotes the lagging effect or the seasonal effect of the variable at a certain time period. The diffusion coefficient is simply the random walk part based on the normally distributed random variable while its theoretical explanation is far more complicated than explained here. 
 
With Python, the diffusion is described as numpy.random.normal(0,SD) where SD stands for standard deviation or volatility in the financial modelling.

After plotting the time series, the expected value at the target time period tends to form a normal distribution. Then, the expected value is calculated under the given confidence interval with the confidence level (usually 95%) / the significance level (usually 5%). In case, it had better test the normality to avoid the bias. 
 
Together with the unit root test assessing the stationarity of financial market and the capital asset pricing model indicating the assets' profitability and risk, the random walk model based on Ito process are popularly used in the financial market analyses.



Thursday, January 26, 2023

Adam Smith's grave in Canongate Kirkyard on the Royal Mile, Edinburgh, S...

 


Adam Smith's grave in Canongate Kirkyard on the Royal Mile, Edinburgh, Scotland, UK. Whenever I visit Edinburgh, I give Adam Smith, the father of economics, a prayer.

 This newly started YouTube channel exhibits various short videos of Scotland.

Please visit to watch! Cheers!

 

 


 

Tuesday, January 17, 2023

Python Experiment: Macroeconomic Theory: Income Price Inflation Control Simulator in the ADAS model


 I have created a macroeconomic policy simulator with Python programming. 

This refers to the aggregate demand and supply interaction based on the simplified IS-LM interaction influencing the aggregate demand (AD) and the labour market and the capital cost influencing the short-run aggregate supply (AS). These curves are composed of the two main parameters, the aggregate income level and the price level, as well as the money supply (MS) basing the IS-LM, and the wage index (W) basing the labour market. 

My Python codes are as follows: 

# Default Parameters
import random
Y=[20,30]  # The aggregate income level: Change here to see each effect
P=[100,102] # The price level: Change here to see each effect
W=[10]
WB=0.2
MS=[100]
rHD=10 
CapCost=[10]

# Function representing the price inflation
def PrInf():
    return ((P[-1]-P[-2])/P[-2])

PrInf()

# Higher function
# The aggregate demand influence
def Y_Inv(MSlmis,Ylmis,dp):
    r_MS=pow(MSlmis/10,-1.05)+rHD*(PrInf()) #LM side
    return pow(Ylmis,-1*(r_MS-PrInf())) #IS-side

Y_Inv(MS[-1],Y[-1],PrInf())

# A part of the short-run aggregate supply influence (The Labour Market).
def Y_Lab(Wlab,Plab):
    return (50-(50/(Wlab/Plab)))/100

Y_Lab(W[-1],1+PrInf()+0.000001)


def AggregateDemandCurve(Ydd):
    Pd=Y_Inv(MS,Ydd)/Ydd
    return Pd

def AggregateSupplyCurve(Wlab,Plab,Css):
    Ps=Css+Y_Lab(Wlab,Plab)
    return Ps
    

def AggregateSupplyCurveShift(Y1,Y2,Pinv):
    dp=(Y_Inv(MS[-1],Y1,Pinv))-(Y_Inv(MS[-1],Y2,Pinv)) #AggregateDemandCurve(Yd1)-AggregateDemandCurve(Yd2)
    return dp

print(Y_Inv(MS[-1],Y[-1],PrInf()),Y[-1],PrInf())
print(Y_Inv(MS[-1],Y[-2],PrInf()),Y[-2],PrInf())
AggregateSupplyCurveShift(Y[-1],Y[-2],PrInf())


def AggregateDemandCurveShift(Y1,Y2,Wlab,Plab,Csd):
    dp = (Csd+(Y_Lab(Wlab,Plab)*(1+WB*(Y1-Y2)/Y2)))-(Csd+Y_Lab(Wlab,Plab)) #AggregateSupplyCurve(Yd1)-AggregateSupplyCurve(Yd2)
    return dp

print(CapCost[-1]+(Y_Lab(W[-1],PrInf())*(1+WB*(Y[-1]-Y[-2])/Y[-2])))
print(CapCost[-1]+Y_Lab(W[-1],PrInf()))
           
AggregateDemandCurveShift(Y[-1],Y[-2],W[-1],PrInf(),CapCost[-1])

# Calculating the average aggregate income level across all over the time period to generate the long-run aggregate supply interaction
def Ymean():
    Ysum=0
    for i in range(len(Y)):
        Ysum=Ysum+Y[i]
    return Ysum/len(Y)
Ymean()

# Main function: The interaction of the aggregate demand and the short-run aggregate supply
def Shift1(MSlmis=MS,Y1=Y[-1],Y2=Y[-2],Wlab=W,Plab=PrInf(),Csd=CapCost[-1],Pinv=PrInf()):
    OutputGap=Y[-1]-Ymean()
    PriceInflation=((P[-1]-P[-2])/P[-2])
    if (OutputGap>0.05) & (PriceInflation>0.0001): # Positive Inflation
        dP=AggregateDemandCurveShift(Y1,Y2,Wlab,Plab,Csd)
        P.append(P[-1]*(1+dP))
        print(dP)
        MS.append(MS[-1]*(1+OutputGap/Ymean()))
        print(MS[-1])
        Y.append(Y[-1]*(1+(Y_Inv(MS[-1],Y[-1],dP)-Y_Inv(MS[-2],Y[-1],PriceInflation))))
        W.append(W[-1])
        CapCost.append(CapCost[-1])
    elif (OutputGap<-0.05) & (PriceInflation>0.0001): # Negative Inflation
        dP=AggregateSupplyCurveShift(Y1,Y2,Pinv)
        P.append(P[-1]*(1+dP))
        print(dP)
        W.append(W[-1]*(1+Ymean()/OutputGap))
        CapCost.append((1+dP)*CapCost[-1])
        print(W[-1])
        Y.append(Y[-1]*(CapCost[-1]/CapCost[-2]+(Y_Lab(W[-1],dP)-Y_Lab(W[-2],PriceInflation))))
        MS.append(MS[-1])
    elif (OutputGap<-0.05) & (PriceInflation<-0.0001): # Deflation
        dP=AggregateDemandCurveShift(Y1,Y2,Wlab,Plab,Csd)
        P.append(P[-1]*(1+dP))
        print(dP)
        MS.append(MS[-1]*(1+OutputGap/Ymean()))
        print(MS[-1])
        Y.append(Y[-1]*(1+(Y_Inv(MS[-1],Y[-1],dP)-Y_Inv(MS[-2],Y[-1],PriceInflation))))
        W.append(W[-1])
        CapCost.append(CapCost[-1])
    elif (OutputGap<-0.05) & (PriceInflation<-0.0001): # Dereguation
        dP=AggregateSupplyCurveShift(Y1,Y2,Pinv)
        P.append(P[-1]*(1+dP))
        print(dP)
        W.append(W[-1]*(1+Ymean()/OutputGap))
        CapCost.append((1+dP)*CapCost[-1])
        print(W[-1])
        Y.append(Y[-1]*(CapCost[-1]/CapCost[-2]+(Y_Lab(W[-1],dP)-Y_Lab(W[-2],PriceInflation))))
        MS.append(MS[-1])
    else: 
        print("Nothing")
    
    print(OutputGap,P,Y)

  # See the result
Shift1(MS[-1],Y[-1],Y[-2],W[-1],PrInf(),CapCost[-1])

print(Y)
print(P)
print(MS)
print(W)
print(CapCost)

 

 

 

Saturday, January 07, 2023

Liberty s Daughter 育成ゲーム Jupyter Notebook

This is the game demo play of my game created with Python. See the detail including the codes in my blog post: Started creating in Python

Liberty s Daughter 育成ゲーム Jupyter Notebook — (1) 10 years old

 

Liberty s Daughter 育成ゲーム Jupyter Notebook — (2) 11 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (3) 12 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (4) 13 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (5) 14 years old

 

Liberty s Daughter 育成ゲーム Jupyter Notebook — (6) 15 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (7) 16 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (8) 17 YO - 18 YO Ending (Noble Lady Ending)

 

Liberty s Daughter 育成ゲーム Jupyter Notebook — (9) 18 YO - Ending (Revolutionary Ending)

Liberty s Daughter 育成ゲーム Jupyter Notebook — (10) The Other Endings and the Python codes

For the Python codes and the furthermore details, please refer to Started creating in Python.




PS

How to play "Liberty's Daughter 育成ゲーム" with Colaboratory